Skip to content

fix(android): retain foreground close fence evidence - #4619

Open
thymikee wants to merge 6 commits into
0.22from
fix/android-foreground-fence-evidence
Open

thymikee wants to merge 6 commits into
0.22from
fix/android-foreground-fence-evidence

Conversation

@thymikee

@thymikee thymikee commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Summary

Retain bounded Android foreground-close probe observations and timings in request diagnostics, including when a probe throws. Document the JSON fields and request diagnostic in close help and troubleshooting. Five files changed. The two-second fence, deadline, queries, polling, and launch/stop decisions remain unchanged. Android smoke run 43968647877, job 133654642455, associated with #4615, timed out at this fence; its cause remains unproven.

Validation

  • Base 31fc8dfb079d7eac164651a98262fc9b5ba1c6fa; head a13f5f6ee6f3a722ad695a7376216c3357fb22bc. Exact affected: 11 passed, 8 skipped, 1 deduplicated; exact commit, unchanged checkout. Coverage and device lanes remain GitHub-owned; provider integration was deduplicated.
  • Full format, quick checks, and rendered close help passed. Earlier runtime head ad488cc1 passed 29 focused tests and independent source review; the documentation follow-up was authored and cold-checked by the coordinator, without a fresh independent all-range review.
  • Probe and daemon artifact boundaries were tested separately; upload path was traced in source. End-to-end composition and live-device results remain unverified. Changed-head CI is pending.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

View guided diff Turn on auto-fix

@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.14 MB 6.14 MB +840 B
Package (unpacked) 6.14 MB 6.14 MB +840 B
Package (download) 1.86 MB 1.86 MB +295 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 34.3 ms 41.2 ms +6.9 ms
CLI --help 57.0 ms 88.5 ms +31.5 ms

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 3 files

You’re at about 99% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.

View guided diff | Turn on auto-fix | Re-trigger cubic

@apex-sentinel-staging

apex-sentinel-staging Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve

Since the last review: 0 new · 0 still open · 1 no longer raised (1 marked fixed)

No open findings.

1 finding below minor hidden (user_settings.min_severity).

Reviewed with this repository's own Sentinel configuration (a30accf38081).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

Earlier reviews

Review of ad488cc1 · 16.11.2026 23:29 UTC

Apex Sentinel · ✅ Approve

1 finding(s): 1 minor.

🟡 Minor (1)

Where Finding
packages/platform-android/src/app-lifecycle.ts:778 New error details and diagnostic phase are not in the owning help or user docs

1 finding below minor hidden (user_settings.min_severity).

Reviewed with this repository's own Sentinel configuration (a30accf38081).

@apex-sentinel-staging apex-sentinel-staging 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.

Apex Sentinel: 1 new finding on ad488cc. The verdict and the full list are in the summary comment.

@thymikee

Copy link
Copy Markdown
Member Author

The code at a13f5f6 looks right, but there is one gap in the evidence.

The change wraps the foreground probe on every Android close and open --relaunch (app-lifecycle.ts#L828). That is a device-facing app lifecycle route, and the fence behavior must stay the same. The PR body says live-device results are unverified, and the mocked tests here never reach the emulator close path. A mistake in the new try/finally or the bookkeeping would show up only there. Please show a green Android emulator run on this head, or a manual emulator run, where close and open --relaunch on a foreground app both succeed. Record the device, the sha, and the output that proves the close finished within the fence. For the evidence route, a forced timeout with an app that stays foreground should show details.foregroundObservations with at most five records, and an android_close_foreground_fence event in the request ndjson.

The Coverage job is red, but its log ends mid-run in the react-native companion test output with no failure line. Please rerun it and share the failing step output if it fails again. The untested unknown branch noted below may be part of it.

Not blocking, and you can take or leave each: the daemon test in request-router-android-foreground-evidence.test.ts mocks the lifecycle effect and emits the diagnostic itself, so it only checks generic persistence that already worked on the base commit. Either drop it or drive the production emission through the mocked adb provider inside the daemon request scope. waitForAndroidForegroundPackage gains two loose optional params, and targetPackage repeats the package name that the caller's matches callback already holds. A readForeground probe or a single options object would keep the loop unaware of observations. No test returns a null foreground app on the close route, so the unknown result is untested. One case in the foreground timeout table would cover it. The close help string now names the internal phase and detail fields. You could keep the field names in commands.md and mention only details.foregroundObservations in the help.

The resolved thread about help and docs coverage of the new fields is fixed at this head, so it can stay resolved: #4619 (comment).

Before merge, we need a green Android emulator run of close on this head and the actual output of the failing Coverage step.

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