Skip to content

Authorize saved scan-only output marks without parent enumeration - #6109

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

janicduplessis merged 12 commits into
mainfrom
feat/gc-scan-sentinel-proof

Conversation

@janicduplessis

@janicduplessis janicduplessis commented Nov 22, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Saved output marks for checkouts reached only by the home scan cannot currently be authorized without listing their ancestors. Critical cleanup therefore keeps them even when their original discovery evidence is unchanged.

Solution

Keep optional, shared ancestor safety evidence in the existing scan cache. Normal scanning captures directory identities before listing and confirms them before publishing. Targeted validation checks those identities and rereads the named detection sentinels through bounded reads, while retaining fresh root/nested safety checks. Missing or changed evidence keeps the mark until normal scanning refreshes it. Registration, volume, protected-location and link checks remain in force.

Native-Android candidates that require recognition outside the selected root remain kept; #6106 records that ordinary-layout limitation. No new state file, setting or critical ancestor enumeration.

Test plan

  • Isolated mini source build/typecheck; 79 existing discovery/scan tests and 12 new proof tests passed.
  • New real-filesystem cases cover scan-only roots, wildcard additions, in-place manifest edits, unreadable sentinels, legacy evidence, aliases/registration, volume/link changes and evidence changed during capture.
  • A real plain native-Android git repository confirms normal scanning still admits that layout and targeted validation keeps it without parent enumeration.
  • Build, formatting, lint, typecheck, Knip, RPC and API reports passed; 91 affected tests pass on the final head.

Fixes #6093. Follow-up: #6106.

@janicduplessis janicduplessis added area: cli packages/stim-cli, including its README and guide ci-full run the macOS, Windows, Desktop and license jobs on this pull request labels 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. A batch can authorize a saved mark that fails the same check in isolation, and an unrelated stalled build-worker mount can block the pressure sweep.

Findings:

  • [high] A sibling mark can reuse stale ancestor evidence (packages/stim-cli/src/workspace/discovery.ts:450-463)
    Targeted validation shares the ancestor cache across marks. Once the first sibling passes, the second reuses that result without checking the parent's fingerprint or sentinels again. If an Xcode container appears in the parent between checks, the second mark can still reach the output sweep. With injected filesystem metadata, I verified that changing the parent fingerprint made the second sibling return valid in the batch and pending in isolation.
    Recommendation: Give each targeted mark a fresh ancestor cache. Add a two-sibling regression test that changes the parent after the first check and verifies the second mark stays pending without listing the parent.
  • [medium] Targeted lookup synchronously resolves an unrelated build-worker path (packages/stim-cli/src/workspace/discovery.ts:450-452)
    targetedScan constructs scanSkipper(home) before checking whether any saved root needs scan proof. That helper calls realpathSync on the configured server.workerRoot. If its filesystem stalls, the three-second read timeout cannot interrupt it. This can prevent even independently authorized local marks from reaching the sweep when the scan has no matching entry.
    Recommendation: Initialize the skip rules only after finding a requested root that needs scan proof. Resolve the exclusion paths through the bounded asynchronous reader and keep the scan-only mark pending if a required resolution times out.

Disposition

Both findings confirmed and fixed. Each targeted mark now has its own ancestor validation cache. Exclusions are resolved only when a requested, otherwise unproved scan member needs them, using bounded callback realpath reads; an unanswered required exclusion keeps that mark. Added normal two-sibling mutation, independently authorized route/no exclusion reads, and stalled required read regressions. All 91 affected tests and build/lint/typecheck/format/Knip/API/RPC checks pass. The original review covered 5aea79e against 8293faa. No second review under the maintainer's one-review instruction.

@janicduplessis janicduplessis added the review: ai-approved A fresh AI review found nothing left to fix label Nov 22, 2026
@janicduplessis
janicduplessis marked this pull request as ready for review November 22, 2026 05:39
@janicduplessis
janicduplessis merged commit 2386c3e into main Nov 22, 2026
71 of 72 checks passed
@janicduplessis
janicduplessis deleted the feat/gc-scan-sentinel-proof branch November 22, 2026 06:22
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 marks with targeted sentinel proof

1 participant