Skip to content

Move undo to records/ and the page image to host/, so the layer check fails every upward import - #7145

Merged
max-sixty merged 1 commit into
mainfrom
agent-afa05e284cf2561f9
Nov 25, 2026
Merged

max-sixty merged 1 commit into
mainfrom
agent-afa05e284cf2561f9

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Ends the 2 imports in browser/runtime that pointed up a layer, so dependency-cruiser's layer check (#7113, #7119, #7137) needs no list of known crossings. .config/dependency-cruiser-known.json and the hook's --ignore-known go, and any upward import now fails pre-commit.

  • Undo moves from annotations/ to records/, the lowest layer its imports allow, so host/application.js, which creates it, imports downward. It borrowed two things from annotations/. commentDraft, the draft a comment was written in, moves to records/drafts.js beside 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.
  • The page image moves from annotations/composing/ to host/, beside host/sample-child.js, which loads it, and host/sample.js, which it loads. dom/ would put its import of sample.js upward.

No module re-exports an old path, and a page behaves as before.

What to check: ComposerDraft in records/drafts.js names DraftDrawing from annotations/composing/drawing-record.js in 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), and leaf-dev probe alert-review --base with a ⌘Z press (no console output on either arm).

This was written by Claude Code on behalf of max-sixty

… 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]>
@max-sixty
max-sixty merged commit 5991556 into main Nov 25, 2026
6 checks passed
@max-sixty
max-sixty deleted the agent-afa05e284cf2561f9 branch November 25, 2026 08:55
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_
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.

2 participants