Draft
Conversation
📋 PR Review Helper📱 Mobile App Build✅ Ready to test! (commit 🕶️ ASG Client Build✅ Ready to test! (commit 🔀 Test Locallygh pr checkout 2189 |
|
Caution Review failedFailed to post review comments 📝 WalkthroughWalkthroughThis PR introduces BES chip log collection and upload capabilities, refactors media controls by replacing a single "silent" flag with separate "flash" and "sound" parameters across mobile, cloud, and glasses platforms, adds a canonical userId field with race-condition fixes for personal org creation, integrates Firebase analytics and incident reporting, and enhances incident log storage to support glasses firmware logs. Changes
Sequence Diagram(s)sequenceDiagram
participant Glasses as Glasses Device
participant BesLog as BesLogManager
participant Handler as K900CommandHandler
participant Service as AsgCameraServer
participant Backend as Backend API
Glasses->>Handler: requestBesLogs(incidentId)
activate Handler
Handler->>Handler: validate Bluetooth connection
Handler->>BesLog: new BesLogManager(incidentId, context, configMgr)
activate BesLog
BesLog->>BesLog: startTimeouts() - first packet 2s, overall 20s
Handler->>Glasses: send mh_logs command (C,V,B framing)
Glasses->>BesLog: onLogPacketReceived(cur, body) - sr_log packets
BesLog->>BesLog: reassemble packets, detect terminator (cur=255)
BesLog->>BesLog: finalize logs, build JSON array per-line
BesLog->>Backend: POST /api/incidents/{id}/logs with structured JSON
activate Backend
Backend->>Backend: route to glassesFirmwareLogs category
Backend-->>BesLog: 200 OK
deactivate Backend
BesLog-->>Handler: logs uploaded or printed if no incidentId
deactivate BesLog
Handler-->>Glasses: session complete
deactivate Handler
sequenceDiagram
participant Mobile as Mobile App
participant Cloud as Cloud Console API
participant OrgService as Organization Service
participant UserModel as User Model
participant DB as MongoDB
Mobile->>Cloud: GET /api/console/account
activate Cloud
Cloud->>OrgService: ensurePersonalOrg(userId)
activate OrgService
OrgService->>UserModel: find existing admin org
alt Admin org exists
OrgService-->>Cloud: return existing org ID
else Create new org
OrgService->>OrgService: generate deterministic slug with user._id suffix
OrgService->>DB: save org (with retry on E11000)
DB-->>OrgService: org created
OrgService->>UserModel: atomic updateOne({organizations, defaultOrg})
UserModel->>DB: $addToSet + $set (no VersionError)
DB-->>UserModel: updated
OrgService-->>Cloud: return new org ID
end
deactivate OrgService
Cloud->>Cloud: re-fetch user with new org state
Cloud-->>Mobile: 200 OK with orgs list
deactivate Cloud
Mobile->>Mobile: apply orgs, persist to localStorage
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Suggested reviewers
Poem
✨ Finishing Touches
🧪 Generate unit tests (beta)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by CodeRabbit
Release Notes
New Features
Bug Fixes
Documentation