Skip to content

fix(layering): unblock main — raise the daemon-server R9 ceiling for #1779's snapshot interactor seam - #1835

Closed
thymikee wants to merge 1 commit into
mainfrom
fix/layering-r9-daemon-command-registry
Closed

fix(layering): unblock main — raise the daemon-server R9 ceiling for #1779's snapshot interactor seam#1835
thymikee wants to merge 1 commit into
mainfrom
fix/layering-r9-daemon-command-registry

Conversation

@thymikee

Copy link
Copy Markdown
Member

main is red on the Layering Guard job. This unblocks it. Not a draft.

Cause: two green PRs, one interaction

Neither PR is wrong; they were green against their own bases and never met until merge.

pnpm check:layering on 9a0d6dead:

[R9 type-cycle-size] scripts/layering/daemon-modularity.ts:1 —
  the largest type-level import cycle grew to 47 files (baseline 46).
[R10 daemon-modularity] src/daemon/daemon-command-registry.ts:1 —
  the largest type cycle now contains 17 daemon-server file(s) (baseline 16)

The joining edge

The +1 node is src/daemon/handlers/snapshot-interactor-capture.ts (new in d76e0f94e), a choke point wedged between two files that were already cycle members:

src/daemon/handlers/snapshot-capture.ts        (member)
  -> src/daemon/handlers/snapshot-interactor-capture.ts   (new, line 22, value)
  -> src/core/interactors.ts  (getInteractor)  (member, line 7, value)

A new file that value-imports one SCC member and is value-imported by another always joins the SCC — +1 node, no new edges.

Attribution is a measured member-list diff of largestTypeCycleMembers, taken at a853734f0 (#1779's parent, 46 members) vs d76e0f94e (47 members). The only differing line is + src/daemon/handlers/snapshot-interactor-capture.ts.

Note on the R10 message: it names src/daemon/daemon-command-registry.ts, which is not the file that grew — that file was already a member at a853734f0. checkTypeCycleBaseline reports members.find(m => targetDagZone(m) === zone), i.e. the alphabetically first member of the over-budget zone. Worth a follow-up; deliberately not touched here.

The fix: explicit ceiling raise (option 3 of the brief)

daemon-server: 16 -> 17 in scripts/layering/daemon-modularity.ts, with a one-line comment naming d76e0f94e and the joining edge. TYPE_CYCLE_BASELINE is derived from the zone ceilings, so the total follows to 47 automatically. daemon-modularity.test.ts pins both numbers as literals, so they move with it.

I did not break the edge, and the maintainer should decide whether that is acceptable. The zero-growth shape (per the #1633 precedent: host the seam in an existing cycle node) means deleting snapshot-interactor-capture.ts and moving the getInteractor call back into snapshot-capture.ts or up into core/interactors.ts. That module is the deliberate vi.mock seam for 43 test files (grep -rl snapshot-interactor-capture src → 44 including itself); relocating it changes every one of those mock paths to a module whose other exports those tests still need unmocked. That is a real refactor, not a red-main fix. Happy to follow up with it as a separate PR if preferred — this PR only restores the gate to matching reality.

check:layering after the fix

Layering guard: OK — 1312 source files satisfy R2-R3 and contain no value-import cycles ...
the largest type-level cycle is 47 files (R9); R10 pins R7 at 21 writer-owned fields /
25 owner claims, R9 at 47 files with zone ceilings, 2 external daemon/types.ts importers,
and zero forbidden logical-module imports beyond 0 recorded migration import(s) ...

Test plan

  • pnpm check:layering — green (47 total / 17 daemon-server), 178/178 layering unit tests pass
  • pnpm typecheck — green
  • pnpm lint — green
  • pnpm format:check — green
  • No production code touched; only scripts/layering/daemon-modularity.ts and its test.

…teractor seam

`pnpm check:layering` is red on main: R9 reports 47 files (baseline 46) and R10
reports 17 daemon-server files (baseline 16).

Two PRs that were each green against their own base:

- #1825 (ef6ec29) made the R9 shrink mandatory and pinned
  LARGEST_TYPE_CYCLE_ZONE_CEILINGS to the then-measured daemon-server 16 / total 46.
- #1779 (d76e0f9) added `src/daemon/handlers/snapshot-interactor-capture.ts`,
  a seam wedged between two existing cycle members:
  `handlers/snapshot-capture.ts` -> `handlers/snapshot-interactor-capture.ts`
  -> `core/interactors.ts` (getInteractor). A choke point between two SCC
  members always joins the SCC, so it is exactly +1 node.

Member-list diff at a853734 vs d76e0f9 confirms `snapshot-interactor-capture.ts`
is the only file that joined; `daemon-command-registry.ts` named in the R10 message
was already a member (the message reports the alphabetically first zone member, not
the file that grew).

Zero-growth hosting would mean deleting the seam and moving the call back into
`snapshot-capture.ts` or `core/interactors.ts`; the seam is the mock point for 43
test files, so that is a real refactor and not a main-unblocking change. Raising the
ceiling explicitly instead, so the growth is a number a reviewer saw move.
@github-actions

Copy link
Copy Markdown

Size Report

Metric Base Current Diff
JS raw 2.30 MB 2.30 MB 0 B
JS gzip 756.3 kB 756.3 kB 0 B
npm tarball 878.0 kB 878.0 kB 0 B
npm unpacked 3.07 MB 3.07 MB 0 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 29.0 ms 28.3 ms -0.7 ms
CLI --help 71.8 ms 69.6 ms -2.2 ms

Top changed chunks: no changes in the largest emitted chunks.

@thymikee

Copy link
Copy Markdown
Member Author

Superseded by maintainer fix.

@thymikee thymikee closed this Aug 18, 2026
@github-actions

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-08-18 14:21 UTC

@thymikee
thymikee deleted the fix/layering-r9-daemon-command-registry branch August 18, 2026 14:21
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