Skip to content

chore(gates): classify #2278 daemon-platform-runtime edges and ratchet handler session authority - #2354

Open
thymikee wants to merge 3 commits into
mainfrom
issue-2278-gates
Open

chore(gates): classify #2278 daemon-platform-runtime edges and ratchet handler session authority#2354
thymikee wants to merge 3 commits into
mainfrom
issue-2278-gates

Conversation

@thymikee

@thymikee thymikee commented Sep 6, 2026

Copy link
Copy Markdown
Member

Summary

Structural no-regrowth checks for the #2278 daemon-platform coupling audit (companion PR carries the audit record and ADR 0022):

  • R74 daemon-platform-runtime-inventory (scripts/layering/daemon-platform-runtime-inventory.ts): classifies every production daemon import of root src/platform-runtime-*.ts modules — 14 edges across 9 files (13 entries; ios-app-session-hint.ts holds an import and a re-export of the same symbol) — as composition-essential, daemon-policy-essential, or leaked-platform-mechanics. The layering check fails on any unclassified edge, on symbol-set drift between a file and its inventory entry, and on stale entries.
  • R75 session-authority-overlay (scripts/layering/session-authority-overlay.ts): symbol-level SessionState-shape / SessionStore-authority overlay, measured inside measureRatchets; a membership ratchet holds the handler-owned file sets at or under the merge base (currently 14 shape / 22 authority files).

Category-3 implementation work is owned by the child issues (#2332, #2333, #2334; the selector seam by #2273/#2274). Part of #2278. 7 files.

Validation

Tested at 0ed7285: pnpm check:layering green (201 tests; R74 13 classified entries, R75 14/22 handler-owned files). Both rules observed red against planted violations before acceptance: an unclassified daemon→root platform-runtime import (R74) and a new handler-owned SessionState import (R75; staged, since the scan reads tracked files only). pnpm check:affected --run passes at 0ed7285. No device-facing changes.

@github-actions

github-actions Bot commented Sep 6, 2026

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
Installed (including dependencies) 4.50 MB 4.50 MB 0 B
Package (unpacked) 4.50 MB 4.50 MB 0 B
Package (download) 1.33 MB 1.33 MB +3 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 28.3 ms 28.3 ms -0.1 ms
CLI --help 78.6 ms 79.9 ms +1.3 ms

@thymikee

thymikee commented Sep 6, 2026

Copy link
Copy Markdown
Member Author

R75 hardcodes src/daemon/types.ts for SessionState, but #2346 moves that declaration to src/daemon/session-state.ts. After that merge the shape overlay silently stops measuring the imports it is meant to ratchet. Reuse the owning declaration discovery and add a planted-red test against the moved declaration path.

@thymikee

thymikee commented Sep 7, 2026

Copy link
Copy Markdown
Member Author

The SessionState move is handled now. One gap remains in R74: dynamic imports are recorded with an empty symbol set. The existing daemon-runtime.ts import of platform-runtime-operation-host.ts therefore admits extra named bindings without triggering symbol drift. Please capture those bindings (or fail closed for this case) and add a planted-red test that expands this existing import. Android smoke also failed restoring the automation route after system UI; that looks unrelated to this tooling-only change.

@thymikee

thymikee commented Sep 7, 2026

Copy link
Copy Markdown
Member Author

Addressed in 4a7c2b7. The layering scanner now captures named bindings from destructured dynamic imports: const { x } = await import(...) records x on the edge, so expanding an existing dynamic import's destructure trips R74's symbol-drift check. The daemon-runtime.tsplatform-runtime-operation-host.ts entry now records recoverLegacyAppLogMarkersAfterDaemonLock; a namespace-form import captures no bindings and therefore drifts against the recorded set (fail-closed when bindings are hidden). Planted-red test: "R74 rejects an expanded destructured dynamic import on a classified edge" extends the existing import with a second binding and asserts the drift violation; scanner semantics are pinned by a model-level test. pnpm check:layering and pnpm check:affected --run are green. Agreed the Android smoke route-restore failure is unrelated to this tooling-only change.

@thymikee

thymikee commented Sep 7, 2026

Copy link
Copy Markdown
Member Author

R74 still has a bypass at 4a7c2b7. Adding a rest binding alongside the approved name, such as { recoverLegacyAppLogMarkersAfterDaemonLock, ...operationHost }, leaves the recorded symbol set unchanged while exposing every other export. The scanner silently ignores RestElement and computed properties. Reject unclassified bindings instead of dropping them, and add a planted-red regression using the existing classified import. CI is green, but this leaves the no-regrowth guarantee incomplete.

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