Repository navigation
Move undo to records/ and the page image to host/, so the layer check fails every upward import - #7145
Merged
Conversation
… fails every upward import The layer check passed over two upward imports that `.config/dependency-cruiser-known.json` listed. Both are gone, so the file goes too, with the hook's `--ignore-known` argument and the config comment about it. Any runtime import that points up now fails the hook. `host/application.js` imported `createUndo` from `annotations/undo.js`. undo.js reached into `annotations/` for two helpers. `reactionPlace`, from reactions.js, had no other caller, so it is now private to undo.js. `commentDraft` came from the selection composer; it moves to `records/drafts.js` with the key and record it builds (`composerCtx`, `composerPayload`), the record's type and its guard `isComposerDraft`. drafts.js already names every draft's key and reads a comment draft's anchor and mode for Threads' Drafts, so the record's shape now has one home there. Every other import of undo.js is at or below `records/`, so it now stands at `records/undo.js`, the lowest layer its imports allow. `host/sample-child.js` lazily imported `annotations/composing/page-image.js`. page-image.js imports `lib/` and `dom/` modules, and it also loads the sample host (`host/sample.js`) lazily to draw a sample's frame, so the lowest layer its imports allow is `host/`. Its other importers, in `annotations/composing/`, stand above that. It now stands at `host/page-image.js`. The layer names in the config say where undo now lives. Every importer, JSDoc type reference and prose path moves to the new paths, with no re-export. No behaviour changes: the browser build regenerates no file, `pnpm run check` passes (1127 runtime tests among it), and alert-review boots on base and head with an empty console and the same 316 requests. Co-authored-by: Claude Opus 5.5 <[email protected]>
leaf-agent
approved these changes
Nov 25, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 25, 2026
Removes three forbidden-closure rules from `.config/dependency-cruiser.mjs` that the layer check now makes redundant. `readings/addressable-names.js`, `readings/anchor-resolution.js` and `readings/target-paint.js` must not reach an application owner or the thread's presenter. Each of those modules sits in `host/`, `panel/` or `records/`, which are all layers above `readings/`. Since #7145 the `layering` rule fails every upward import, so no route from a `readings/` module can reach them. The header comment above the closures now states that rule, so a later renderer below every module it must not reach gets no entry. Each of the other closure roots still forbids at least one module in its own layer or a lower one, which `layering` allows, so they all stay. For example, `records/thread/*` must not reach `records/undo.js`, and `annotations/anchor-paint.js` must not reach `host/delivery.js`. Checks: depcruise passes on the pruned config (526 modules). In a probe, `readings/target-paint.js` imported `host/delivery.js`, and `layering` reported it. > _This was written by Claude Code on behalf of max-sixty_
max-sixty
added a commit
that referenced
this pull request
Nov 25, 2026
…eet the package-interface cut Main moved the runtime's modules into a directory per import layer and dropped the framework facade (#7119, #7137, #7145, #7146); this branch cut the package interface and moved stateless code into lib/. Imports take main's layer paths with the branch's names. dom-move.js, dom-children.js and language-paths.js stay in lib/, where packages import them by served path, and main's dom/ and base/ copies are gone; dom/move-focus.js still installs the focus hooks into lib/dom-move.js. The branch's new readings.js joins host/, since it imports host/reports.js. views.js, work.js and the tests of them stay deleted. Imports of the dropped facade name /vendor/lit.js, /vendor/signals-core.js and base/presentation.js directly. > _This was written by Claude Code on behalf of max-sixty_
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ends the 2 imports in
browser/runtimethat pointed up a layer, so dependency-cruiser's layer check (#7113, #7119, #7137) needs no list of known crossings..config/dependency-cruiser-known.jsonand the hook's--ignore-knowngo, and any upward import now fails pre-commit.annotations/torecords/, the lowest layer its imports allow, sohost/application.js, which creates it, imports downward. It borrowed two things fromannotations/.commentDraft, the draft a comment was written in, moves torecords/drafts.jsbeside every other draft's key, with the composer's draft record (composerCtx,composerPayload,ComposerDraft,isComposerDraft).reactionPlace, whose only caller was undo, becomes private to it.annotations/composing/tohost/, besidehost/sample-child.js, which loads it, andhost/sample.js, which it loads.dom/would put its import ofsample.jsupward.No module re-exports an old path, and a page behaves as before.
What to check:
ComposerDraftinrecords/drafts.jsnamesDraftDrawingfromannotations/composing/drawing-record.jsin a JSDoc type, as drafts.js's other type references already point upward. dependency-cruiser doesn't read JSDoc.Tests: pre-commit over the change (dependency-cruiser finds 0 violations),
pnpm run check(1127 runtime tests pass),pnpm run build:browser(no generated file changed), andleaf-dev probe alert-review --basewith a ⌘Z press (no console output on either arm).