Skip to content

feat(app): capture regression gates — continuity suite, invariant monitor, rollout-hop capture health - #22892

Merged
Git-on-my-level merged 10 commits into
mainfrom
feat/capture-regression-gates
Oct 20, 2026
Merged

Git-on-my-level merged 10 commits into
mainfrom
feat/capture-regression-gates

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Why

Builds 1.0.560–563 (#20837) skipped the pendant capture start whenever a BLE reconnect landed during an upload pass, and nothing restarted it. Firmware 3.0.21 discards audio while a phone is connected but not subscribed, so the audio was recorded nowhere. About 640 users hit Capture Wedge Detected trigger=connected_no_bytes over a week, and nobody noticed until David lost a dinner on 10-20.

The app fix is #22873. This PR adds the gates that catch the next regression of this class: at dev time first, on TestFlight at the latest, and before a store rollout widens.

Stacked on #22873 (fix/app-capture-recovery @ a9b92cc). It contains that diff until #22873 merges; merge #22873 first.

What changes

1. Dev time: capture-continuity suite (app/test/services/capture/capture_continuity_test.dart)

2. Debug and TestFlight: capture-continuity invariant monitor

  • The gap it closes: the existing connected_no_bytes watchdog only watches open capture sessions. In the feat(app): tiered pendant capture — pause the live uplink after silence, resume on foreground or charge #20837 state there was no session, so it was blind. It is also already exempt from the mobile-capture-recovery-v1 gate, so making it "unconditional" would not have helped.
  • The check: CaptureContinuityMonitor checks every 15 s while a pendant is connected. It declares Capture Wedge Detected with trigger=connected_not_capturing when all of these hold for 60 s:
    • capture is expected (not muted, not Transcribe Later, no caller stop, no phone or call owning capture);
    • there is no capture subscription;
    • no frame reached custody. Orphan audio persisted to the WAL counts as custody, so it stays quiet.
  • Output:
    • the event is emitted in every build, mirrored to the replacement collector;
    • Capture Recovery Resolved fires when capture returns;
    • the Home banner (CaptureContinuityDogfoodBanner) shows only in kDebugMode || Env.isTestFlight builds.
  • Telemetry only: it never retries or restarts anything.
  • Timer: it runs only while a pendant is connected; idle controllers hold no timer.

3. Store rollout hops: capture-health hold (app/scripts/mobile_capture_health.py)

  • Placement: the iOS phased jump to 100% (ios_phased_release_should_complete) and each Android ladder hop (run_android), the two exposure-expanding steps with no health check. Dispatch itself stays gated by the operator release gate.
  • Rubric: mirrors the operator gate's judge (Hermes omi_capture_wedge.py, Observability). The rate is wedge users, reweighted by 100/omi_sample_pct, over pendant users (Device Session Ended), per ($os, $app_build) over 48 h. A build is BAD at more than 2x the previous build (the largest build below it with at least 20 pendant users) or at more than 50 wedge users a day.
  • Deliberate differences from the operator gate:
    • the build is exact: the Android version code, or the iOS build attached to the live App Store version (GET /v1/appStoreVersions/{id}/build), never a same-version sibling;
    • the triggers include connected_not_capturing from layer 2;
    • a missing build or a failed query HOLDS (fail closed).
  • Override: capture_health_override=<reason> on mobile_daily_train.yml and on mobile_rollout_watch.yml (new manual workflow_dispatch) lets one run through, with the reason logged. No new workflow file.
  • Verified read-only against live PostHog 10-20, matching the operator gate:
Build Verdict Detail
iOS 1389 (1.0.563) BAD 34%, 100 a day
iOS 1409 BAD
iOS 1417 (1.0.566) BAD
Android 1461 (1.0.566) BAD 13% against 0%
Android 1445 ok

Before merge (decision for a maintainer)

  • Codemagic needs a read-only PostHog key. mobile-daily-train and mobile-rollout-advance only have the google_play env group. Add POSTHOG_PERSONAL_API_KEY (query read) to a Codemagic group and list it in both workflows in codemagic.yaml. Until then, every hop fails closed (HOLD); use the override input to advance deliberately.
  • 1.0.566 will hold on both platforms once the key is in. That is the gate working: the build predates fix(app): never strand a connected pendant without capture or uploads #22873.

Review

  • Grok round 1 (fixed):
    • iOS is judged on the exact store build from App Store Connect;
    • any PostHog read failure HOLDS instead of raising (an IncompleteRead could have aborted the train);
    • the continuity timer is cancelled synchronously on dispose and re-synced on stage-only device updates;
    • the ledger requires the synthetic fill, so real 80-byte Opus audio can never count as a pendant frame.
  • Grok round 2 (fixed): a malformed App Store Connect build resource now returns "unknown build" (HOLD) instead of raising out of the iOS train. Otherwise the round-1 fixes were confirmed sound.
  • Declined, by design:
    • the baseline is the lower build with the most pendant users (the operator gate's previous_build), not the highest build number;
    • the per-day cap is window users x 24 / hours, as in the operator judge.

Tests

All targeted, under nice -n 19:

  • flutter test test/services/capture test/services/wals test/providers test/pages/conversations: 1434 passed.
  • test/spine (OMI_DEV_CONTROLS=1): 138 passed.
  • flutter analyze on the changed files: clean.
  • python3 app/scripts/mobile_capture_health_test.py (14), mobile_daily_train_test.py (91, including the hop wiring), and both dispatcher tests: OK.
  • run_checks.py --lane local on the changed files: all selected checks pass.

Not verified: on-device behaviour of the monitor and banner (no physical pendant run), and Codemagic runs of the hold (no key provisioned).

Product invariants affected

  • INV-CAP-1 (pendant audio retention): enforced, not changed. Layer 1 asserts it end to end (no notified pendant frame may miss both the socket and the WAL), layer 2 detects it at runtime (a connected pendant nobody consumes), and layer 3 holds a rollout that violates it in the field. Capture behaviour is unchanged; the only controller edits are the continuity-watch hooks.

Failure-Class: none

Line-Count-Exception: app/lib/services/capture/capture_controller.dart | 4520 -> 4539 | 4520 -> 4531 is #22873 (stacked); this PR adds 8 hook lines (import, part directive, timer field, two watch syncs on device update, dispose cancel, custody mark); logic lives in the new capture_continuity_watch.dart part
Line-Count-Exception: app/lib/services/wals/local_wal_sync.dart | 2757 -> 2758 | #22873 (stacked): one read-only currentCodec getter; this PR does not touch the file

UI-Evidence: none -- the only UI is a debug/TestFlight-only diagnostic banner (never shown in store builds), covered by a widget test in capture_continuity_monitor_test.dart

🤖 Generated with Claude Code

Git-on-my-level and others added 8 commits October 20, 2026 21:38
A pendant reconnect landing inside its own reconnect sync pass skipped capture
start, nothing re-drove it, and the pass could hang forever on an untimed BLE
read. A connected but unsubscribed legacy pendant discards audio, so ~4 h was
lost (2026-10-20). Uploads stalled behind the same stuck pass.

- Only the OS periodic window fences live capture; a swallowed pendant start
  is replayed when the fence drops; foreground starts an idle connected pendant.
- Transfer passes get a hard time limit (60 min, 10 min fenced) that releases
  the fence and the in-flight pass; the watchdog wakes while rows are pending;
  any network change wakes a pass; retries and cooldown-end run in background.
- Server close, network change and resume kick an immediate bounded-backoff
  socket reconnect; the keep-alive can no longer die for good.
- Pendant audio reaching the transport with no capture listener is persisted
  to the safety WAL (unless muted or caller-stopped).
- BLE read/write timeouts in Dart; iOS queues same-characteristic reads and
  writes FIFO with a 10 s timeout instead of orphaning the first caller.
- Capture Recovery Observed analytics event; multipart body read timeout.

Failure-Class: FC-automatic-capture-pause-without-retention

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ence orphan WAL priming, stop abandoned passes

- A start swallowed by a sync fence is replayed unless the pendant already
  owns capture or a caller stopped it; the reducer records a suspension when
  a phone recording or call owns capture.
- Orphan WAL priming takes a codec boundary only while the transport still
  has no listener, rechecks after the await, skips it when the WAL already
  tracks the pendant codec, and drops (never mis-tags) packets otherwise;
  a full backlog drops the oldest packet.
- A timed-out pass is marked stale and stops at its next stage boundary; it
  keeps the transfer keep-alive until it exits, and no later pass discovers
  or drains beside it (bounded by a second time limit).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	app/lib/services/connectivity_service.dart
…e abandoned-pass gate, honour late GATT replies

- Orphan audio is written synchronously and only while the WAL already
  tracks the pendant codec; it never takes a codec boundary, so it cannot
  race a live start or wipe a session that subscribed meanwhile.
- An abandoned transfer pass blocks discovery and drain until it really
  exits (no time-based release); every stage, including the post-drain
  refresh/reconcile tail and the catch path, returns once the pass is stale.
- iOS: after a GATT timeout the next op waits for CoreBluetooth's late reply
  (or a 5 s grace) and that reply is never handed to the next waiter.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Wifi-to-cellular handover during an upload pass, a normal server close, a
pendant BLE drop and reconnect mid-pass, and a hung pass: each asserts live
capture is back within 3 s and every emitted pendant packet is durable.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…itor, rollout-hop capture health

Builds 1.0.560-563 (#20837) skipped pendant capture after a reconnect during
an upload pass, and ~640 users lost audio for a week before anyone noticed.
Three layers so the next one is caught at dev time, on TestFlight, or before
a store rollout widens:

1. Dev time: capture_continuity_test.dart streams a simulated pendant (unique
   frame ids) through the real controller, socket service, WAL and transfer
   coordinator: the exact 10-20 reconnect during a stuck upload pass,
   background/foreground, and a ten-minute soak with every fault (network
   change, server close, reconnects mid-pass, background). It complements
   #22873's count-based single-fault guards. PendantFrameLedger asserts every notified frame is streamed or
   persisted (incl. uploaded), and live capture resumes within 5 s. On the
   pre-#22873 tree it loses 125 s (RCA path) and 320 s (soak).

2. Debug/TestFlight: CaptureContinuityMonitor declares Capture Wedge Detected
   trigger=connected_not_capturing when a connected pendant that should be
   captured has no capture subscription and no frame reaches custody for 60 s
   (the state connected_no_bytes cannot see: no capture session). Event in all
   builds; Home banner only in debug/TestFlight. Telemetry only.

3. Store hops: mobile_capture_health.py mirrors the operator gate's judge
   (wedge users reweighted by omi_sample_pct / pendant users per os+build;
   BAD at >2x the previous build or >50 wedge users/day) and holds the iOS
   phased jump and the Android ladder hop. Fails closed; one-shot
   capture_health_override input on the train and rollout-watch workflows.

Stacked on #22873 (fix/app-capture-recovery).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T17:40:58.849008Z 10d6231 New commits
ℹ️ 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.

@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: 600bcff043

ℹ️ 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 thread app/scripts/mobile_capture_health.py Outdated
Comment on lines +145 to +150
def resolve_build(stats: Stats, os_name: str, version: str) -> str | None:
"""The store build of a marketing version: its build with the most pendant users."""
builds = [(key[1], row) for key, row in stats.items() if key[0] == os_name and row.version == version]
if not builds:
return None
return max(builds, key=lambda item: item[1].pendant_users)[0]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Resolve the exact App Store build before judging health

When multiple iOS build numbers share the live marketing version, this selects whichever build has the most pendant users, which can be a TestFlight sibling rather than the binary in the phased App Store rollout. run_ios() then uses that verdict to decide whether to jump the rollout to 100%, so a healthy sibling can mask a regression in the production build. Resolve the live version's attached build from App Store Connect and judge that exact build number.

Useful? React with 👍 / 👎.

Comment on lines +161 to +164
for (final frame in source.processBytes(List<int>.from(packet))) {
phone.onFrameCaptured(frame, captureRoot: _captureEvidenceRoot);
}
CaptureContinuityMonitor.instance.onFrameInCustody();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Only mark orphan frames after WAL admission succeeds

When storage admission is blocked and the pendant buffer has reached its 2,000-frame cap, LocalWalSyncImpl.onFrameCaptured() drops the frame and returns without storing it, but this path still calls onFrameInCustody(). During a connected-without-listener episode, continued orphan packets therefore keep refreshing the custody timestamp even though every frame is being discarded, suppressing the new wedge alert and rollout signal during actual audio loss. The WAL API needs to report whether admission succeeded before custody is recorded.

Useful? React with 👍 / 👎.

Comment on lines +602 to +604
DispatchQueue.main.asyncAfter(deadline: .now() + Self.gattLateReplyGrace) { [weak self] in
guard let self, self.lateReadReply.remove(key) != nil else { return }
self.issueNextRead(key)

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 Retire the old GATT reply before issuing the next operation

If a timed-out CoreBluetooth operation replies after the five-second grace period, this code has already removed the late-reply marker and issued the next request for the same characteristic. Because the delegate callback carries no operation ID, that old reply will dequeue and complete the new request, after which another request may be issued while the real new operation is still outstanding. This can return stale read data or falsely acknowledge writes whenever a BLE reply arrives more than 15 seconds after issuance; reconnect or otherwise invalidate the characteristic queue instead of advancing it on a timer.

Useful? React with 👍 / 👎.

Comment thread app/scripts/mobile_daily_train.py Outdated
Comment on lines +483 to +485
hold = capture_health_hold("ios", version=version)
if hold:
return False, f"phased rollout is {age_hours:.1f}h old; held on capture health: {hold}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Pause the iOS phased release when capture health holds

Returning False here only suppresses the train's early jump to 100%; it does not stop Apple's active phased release from advancing on its normal day-by-day schedule. Consequently, a BAD or unknown verdict can still widen exposure automatically after the first day and eventually reach 100%, contradicting the workflow's promise that capture health holds the rollout in place. The hold path needs to PATCH the phased release to PAUSED or otherwise apply an actual App Store brake.

Useful? React with 👍 / 👎.

Comment on lines +246 to +248
key = env.get(KEY_ENV, "").strip()
if not key:
raise CaptureHealthError(f"{KEY_ENV} is not configured for this workflow")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Provision the PostHog key for both Codemagic rollout lanes

Both production callers reach this branch without POSTHOG_PERSONAL_API_KEY: the committed mobile-daily-train and mobile-rollout-advance definitions import only the google_play variable group, so every scheduled check returns an unknown-health HOLD and Android rollout hops stop indefinitely unless someone manually overrides them. Codemagic requires a secret's variable group to be referenced by the workflow, as described in its environment-variable documentation; import a read-only PostHog group in both lanes before enabling this gate.

Useful? React with 👍 / 👎.

Comment on lines +155 to +157
final codec = state.codecByDevice[deviceId];
final phone = _wal.getSyncs().phone;
final persistable = codec != null && codec.isOpusSupported() && phone.currentCodec == codec;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Buffer orphan packets until their codec is known

When a native-restored subscription forwards audio into a fresh CaptureController while a periodic sync fence has deferred capture startup, codecByDevice is still empty because the codec read only occurs during the deferred start. Every packet therefore takes this non-persistable path and is permanently dropped for the duration of the fence, recreating the audio-loss condition this orphan route is intended to prevent. Buffer the raw packets until the codec is resolved, or resolve the codec before deferring the start, instead of requiring a prior live session to have populated the cache.

Useful? React with 👍 / 👎.

… failure, timer lifetime, strict ledger

- iOS phased jump judges the build attached to the live App Store version
  (GET /v1/appStoreVersions/{id}/build), never a same-version sibling.
- check_rollout holds on any exception, so a dropped PostHog body cannot abort
  the train before other platforms or the candidate submit run.
- The continuity timer is cancelled synchronously on dispose and re-synced on
  stage-only device updates.
- PendantFrameLedger requires the synthetic fill, so real 80-byte Opus audio
  is never counted as a pendant frame.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@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: 0fce883621

ℹ️ 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 +122 to +124
final custody = _lastCustodyAt;
final silentSince = custody != null && custody.isAfter(since) ? custody : since;
if (now.difference(silentSince) < threshold || _declaredAt != null) return;

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 Resolve the episode when custody resumes

If orphan routing begins successfully persisting frames after this monitor has already declared a wedge, onFrameInCustody() advances silentSince, but this branch returns because _declaredAt is non-null and never calls _resolve. As long as the capture subscription remains absent, the dogfood banner therefore continues claiming audio is not recorded, no recovery event is emitted, and a later failure of the orphan path cannot open a fresh episode. Treat resumed custody as recovery before applying the declaration guard.

Useful? React with 👍 / 👎.

Comment on lines +138 to +142
ClientTelemetry.instance.observeWedge(
operationId: const Uuid().v4(),
phase: 'detected',
trigger: trigger,
outcome: 'pending',

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 Mirror the recovery to the replacement collector

When client-telemetry migration is enabled, detection writes a pending wedge using this fresh operation ID, but the ID is immediately discarded and _resolve only emits the legacy Capture Recovery Resolved event. The replacement collector therefore never receives a matching phase: 'resolved'/outcome: 'recovered' terminal, so after PostHog retirement every recovered connected_not_capturing episode remains permanently pending and its recovery latency is lost. Retain the operation ID and mirror resolution as CaptureWedgeMonitor does.

Useful? React with 👍 / 👎.

Comment on lines +1139 to +1141
hold = capture_health_hold("android", build=codes[0])
if hold:
return f"android=staged {staged_version} {codes[0]} @{current:.0%} held on capture health ({hold})"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Check every APK in a multi-code staged release

When Play returns an in-progress release with multiple versionCodes, this checks only codes[0] even though the subsequent hop preserves and advances every code in that release. Google documents versionCodes[] as all APKs in the release and an inProgress release's APKs as being served according to userFraction (Play Developer API); therefore a regressed APK in codes[1:] can expand to the next fraction while a healthy first code passes the gate. Judge every newly staged code, or otherwise identify the exact APKs whose exposure the hop expands.

Useful? React with 👍 / 👎.

Comment on lines +27 to +29
'Share Debug Logs now, then force-quit and reopen Omi.',
),
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Localize the TestFlight banner

This banner is enabled for every TestFlight build, not only local debug sessions, so these hardcoded title and message strings are displayed to TestFlight users in English regardless of locale. Move both strings into the localization resources and reference them through context.l10n; the app guide requires all user-facing strings to use that path.

AGENTS.md reference: app/AGENTS.md:L118-L118

Useful? React with 👍 / 👎.

… of failing the iOS train

Parsing of GET /v1/appStoreVersions/{id}/build moved inside the lookup's
try: a 200 without an attributes dict now means 'unknown build' (the
capture-health hold fails closed) rather than a TrainError that skipped the
rest of run_ios. Tests cover the malformed bodies the module stub hid.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

@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: 10d6231920

ℹ️ 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".

SELECT properties['$os'] AS os, toString(properties['$app_build']) AS build, person_id,
max(100.0 / greatest(coalesce(toFloatOrNull(toString(properties['omi_sample_pct'])), 100.0), 0.01)) AS w
FROM events
WHERE event = 'Capture Wedge Detected' AND properties['trigger'] IN ({triggers})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep wedge events available to the rollout gate

When OMI_CLIENT_TELEMETRY_POSTHOG_RETIREMENT is enabled, both continuity and existing wedge monitors suppress Capture Wedge Detected before it reaches PostHog (capture_composition.dart:185-188 and 206-208), but this gate still queries only PostHog. With Device Session Ended rows still supplying the denominator, affected builds appear to have zero wedge users and can pass both the ratio and absolute-cap checks; keep these events in PostHog until the gate is migrated, or read the replacement collector here.

Useful? React with 👍 / 👎.

Comment on lines +110 to +111
WHERE event = 'Device Session Ended' AND timestamp >= now() - INTERVAL {int(hours)} HOUR
AND properties['$os'] IN ('iOS', 'Android')

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Restrict the denominator to in-scope capture devices

Device Session Ended is emitted for every DeviceType and includes a device_vendor property, but this denominator counts all of them while the selected wedge triggers cover only the Omi/OpenGlass/Friend capture paths. On builds with Apple Watch, Plaud, Bee, Fieldy, Limitless, or Ray-Ban users, those users therefore dilute the candidate's wedge rate even though they cannot produce either numerator trigger, allowing a pendant regression below the absolute 50-user cap to pass the rollout gate. Filter the session rows to the device population covered by these triggers.

Useful? React with 👍 / 👎.

row = stats.get((os_name, str(build)))
if row is None or row.rate is None:
return Verdict(True, f"{os_name} {build}: no pendant sessions in the last {hours}h; cannot judge capture health")
per_day = row.wedge_users * 24.0 / hours

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Normalize the cap by the build's actual exposure time

For a newly staged build, this divides its observed wedge users by the full 48-hour lookback even though the build may have been exposed for only the four-hour Android or twelve-hour iOS observation window. For example, 80 users wedging during a new Android build's first four hours are reported as 40 users/day and remain below the 50/day cap; if the ratio comparison is unavailable or the baseline rate is already elevated, the rollout advances despite already exceeding the absolute cap. Base this normalization on the candidate's first exposure/event time, capped by the configured lookback.

Useful? React with 👍 / 👎.

@Git-on-my-level
Git-on-my-level merged commit 9e8a777 into main Oct 20, 2026
63 of 65 checks passed
@Git-on-my-level
Git-on-my-level deleted the feat/capture-regression-gates branch October 20, 2026 18:33
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