Skip to content

SCA-3922: Shadow Device Signals on Prometheus - #26150

Open
Git-on-my-level wants to merge 6 commits into
BasedHardware:mainfrom
Git-on-my-level:agent/m1-studio-codex-sol/2d4a8d66be34
Open

Git-on-my-level wants to merge 6 commits into
BasedHardware:mainfrom
Git-on-my-level:agent/m1-studio-codex-sol/2d4a8d66be34

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Summary

SCA-3922 adds a durable hourly export for Device Signals and eight muted Prometheus shadow rules. Collector writes deduplicate by authenticated owner, event hour and signal. The replacement rules preserve the strict WAL and wedge predicates and evaluate closed UTC hours with a delivery grace. Heartbeats distinguish covered zeroes from missing intake.

The exporter and client switches default off. SCA-3921 owns reviewed production activation, Firestore TTL and the seven-day matched-window receipt. Detailed admin consumers of desktop health and phone/device health need replacement or an explicit disposition before the event routes can go off. The legacy sampling bridge expires December 7.

Product invariants affected

  • INV-DATA-1
  • INV-MEM-4
  • INV-CAP-1

Verification

  • 382 focused backend tests passed, including 48 real PromQL cases and matching Grafana threshold evaluations across all eight rules.
  • 20 Flutter outbox and product telemetry tests passed, including the strict WAL cutoffs and the missing wedge reason.
  • Alert provisioning lint, alert backtest lint, runtime manifest composition, async blocking scan and Swift syntax parsing passed.

The broad local backend push shard failed in account-deletion fixtures on both this branch and main. The publish retry uses the documented backend-unit hook override after the focused suites passed. GitHub CI will run the configured checks.

UI-Evidence: none -- Internal telemetry and monitoring changes.

Line-Count-Exception: app/lib/utils/analytics/analytics_manager.dart | 3155 -> 3169 | Keep the shadow dispatch beside the analytics consent and event routing authority.
Line-Count-Exception: backend/config/client_telemetry.py | 1488 -> 1535 | Validate the additive family alongside the collector's strict schema and field allowlists.
Line-Count-Exception: desktop/macos/Desktop/Sources/AnalyticsManager.swift | 1704 -> 1706 | Attach the health mirror at the remote diagnostic emitter and honor the existing SDK opt-out.

View guided diff

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T15:13:01.188056Z 8fa599a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Git-on-my-level Git-on-my-level changed the title Shadow Device Signals on Prometheus SCA-3922: Shadow Device Signals on Prometheus Nov 23, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8fa599aa32

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +645 to +647
static void mirrorDeviceSignal(String eventName, Map<String, dynamic>? properties) {
if (!deviceSignalTrackingEnabled) return;
ClientTelemetry.instance.observeDeviceSignal(eventName, properties);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Purge queued device signals when analytics consent is revoked

When migration is enabled and a user opts out before the 30-second flush, this consent check stops new observations but does not revoke queued ones. optOutTracking() clears _queuedEvents, while the newly mirrored observations remain in ClientTelemetryOutbox. _armTimer() and onBackground() continue flushing that outbox, and _flushOwner() checks the Firebase owner/token rather than analytics consent, so these health events and heartbeats can still be uploaded after tracking is disabled. Purge pending device_signal rows on consent revocation and fence their delivery against consent changes without disabling unrelated operational telemetry.

Useful? React with 👍 / 👎.

@github-actions

Copy link
Copy Markdown
Contributor

@kodjima33 UI changes involving Git-on-my-level require your approval. Review the current diff, then comment /approve-ui 8fa599aa32356791a895a6b0bcf9a9cf34fe526c. A later head keeps the approval only when it adds commits on top with no UI changes; a UI change, rebase or force-push needs a fresh one. To withdraw it, comment /reject-ui <full head SHA>. Non-UI work and unrelated access are unaffected.

# Conflicts:
#	backend/charts/monitoring/alert-rules.json
#	backend/main.py
#	config/feature-flags.yaml
@github-actions

Copy link
Copy Markdown
Contributor

@kodjima33 UI changes involving Git-on-my-level require your approval. Review the current diff, then comment /approve-ui db66b58d619de781701055c3466d8ee20b6d414e. A later head keeps the approval while the PR's own UI changes stay the same, including after a rebase or a merge from main; a new or edited UI change needs a fresh one. To withdraw it, comment /reject-ui <full head SHA>. Non-UI work and unrelated access are unaffected.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant