Skip to content

Authorize native Android scan marks without ancestor discovery - #6115

Merged
janicduplessis merged 17 commits into
mainfrom
feat/gc-native-scan-proof
Nov 22, 2026
Merged

janicduplessis merged 17 commits into
mainfrom
feat/gc-native-scan-proof

Conversation

@janicduplessis

@janicduplessis janicduplessis commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

Description

A native Android checkout found by the background scan cannot authorize its saved output marks without repeating ancestor discovery. Critical cleanup therefore keeps those marks even when the checkout still has a valid route. That hold was intentional in the targeted-scan proof until ownership could be checked without listing ancestors.

Solution

Prove conventional app ownership with bounded named manifest reads and canonical ios/android checks, including aliases above the home directory. Stop at the same explicit project boundaries as normal root selection, then reuse its operation and ambiguity rules at the selected root. No ancestor listing, new discovery walk, setting or command is added. Unproved candidates cannot authorize the checkout; an independent recognized app can still prove its route. Cancellation ends the read.

The normal React Native integration and this check share the app-dependency and owned-root predicate. The build-compatibility digest is regenerated; normal build behavior is unchanged.

Test plan

  • 105 affected tests (plus one filesystem-dependent skip on this Mac) cover standalone native Android, React Native ownership changes, an actual conventional-root symlink above home, denied/cancelled reads, aliases, distinct case-sensitive containers, independent recognized siblings, and no parent enumeration.
  • Swift, Exact, Expo, ambiguity and unreadable behavior match ordinary project selection.
  • Build, lint, typecheck, formatting, Knip, RPC and API reports checked against current main.

Fixes #6106.

@janicduplessis janicduplessis added the ci-full run the macOS, Windows, Desktop and license jobs on this pull request label Nov 22, 2026
@janicduplessis

Copy link
Copy Markdown
Collaborator Author

Codex Adversarial Review

Target: branch diff against origin/main
Verdict: needs-attention

Hold the change. An in-memory check against the production code confirmed that a saved mark can pass after ordinary discovery rejects its checkout. A separate regression can prevent reclamation for a checkout that ordinary discovery still recognizes.

Findings:

  • [high] Case-folding can authorize a different Android directory (packages/stim-cli/src/workspace/scan-rules.ts:353-361)
    On a case-sensitive filesystem, Apps/android and apps/android can be distinct Gradle projects. The proof for the uppercase path is also stored under the lowercase key. I changed apps/package.json from {} to an Expo manifest, making the lowercase Android project owned. Ordinary recognition then returned false, but saved-mark validation still returned valid using the uppercase project's proof. That makes the checkout's recorded outputs eligible for a pressure sweep after it loses discovery scope.
    Recommendation: Reuse a proof under the folded spelling only after a bounded identity check confirms both paths resolve to the same directory. Add a case-sensitive regression test with both spellings present.
  • [medium] One unproved Gradle child suppresses an independently recognized app (packages/stim-cli/src/workspace/scan-rules.ts:568-574)
    For a manifest-free checkout containing apps/mobile with an Expo manifest and apps/native with Gradle files, a malformed ancestor package.json makes candidateUnowned throw. The entire mark returns pending before recognition can accept apps/mobile. I confirmed ordinary recognition returned true for this layout. The previous path skipped the unproved native child and could still authorize the mark through Expo. Critical-pressure sweeps consequently lose access to those recorded outputs while the ancestor manifest remains malformed.
    Recommendation: Keep a manifest parse failure local to the candidate whose ownership depends on it, then let recognition evaluate the other children. Preserve cancellation and outstanding-read handling for the whole operation.

Disposition

Both findings confirmed and fixed. A folded spelling reuses a candidate proof only after bounded canonical identity checks; a separately observed real path keeps its own proof. An ownership parse/read failure stays local to its Gradle candidate, while cancellation and the outstanding-read slot still stop the whole operation.

The malformed-ancestor/Expo-sibling regression fails on the reviewed head and passes with the fix. Real-directory fixtures cover distinct case-sensitive paths and a case-insensitive alias; this Mac passed the latter and conditionally skipped the former, which runs on case-sensitive CI. All 105 other affected tests and build/lint/types/format/Knip/RPC/API checks pass.

The sole review covered be4716a8e84cfa04188d9d736b8a0181cc6d90db against 2386c3e6cfb27bc1606a0c556bfb479cc994d479. No second review under the maintainer's one-review instruction. The known Windows #6107 startup failure remains separate.

@janicduplessis janicduplessis added area: cli packages/stim-cli, including its README and guide review: ai-approved A fresh AI review found nothing left to fix labels Nov 22, 2026
@janicduplessis
janicduplessis marked this pull request as ready for review November 22, 2026 06:38
@janicduplessis
janicduplessis merged commit 9ab0be1 into main Nov 22, 2026
43 checks passed
@janicduplessis
janicduplessis deleted the feat/gc-native-scan-proof branch November 22, 2026 07:55
janicduplessis added a commit that referenced this pull request Nov 29, 2026
#6639 removed the hand-edit check on dependency trees, and #6109 and #6115 closed #6093 with the saved sentinel proof for scan-only marks.

Refs #6685
janicduplessis added a commit that referenced this pull request Nov 29, 2026
…6688)

* feat: remove hard-link sampling of dependency trees of unknown size

A tree of unknown size now follows its step's rule: the dormant step takes a linked worktree's tree after the measured ones, and the 7-day source rule keeps a source checkout's tree. Removes link-sample.ts, its two sidecar records and the tests that only protected it, and replaces LLP 0001 "A tree of hard links stays".

Refs #6685

* docs: drop stale hand-edit and #6093 text from LLP 0001 and 0004

#6639 removed the hand-edit check on dependency trees, and #6109 and #6115 closed #6093 with the saved sentinel proof for scan-only marks.

Refs #6685
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli packages/stim-cli, including its README and guide ci-full run the macOS, Windows, Desktop and license jobs on this pull request review: ai-approved A fresh AI review found nothing left to fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Authorize saved scan-only native Android marks without ancestor enumeration

1 participant