Repository navigation
Drop the runtime's framework facade, so the layer check sees every import - #7137
Merged
Merged
Conversation
…ade's pieces in the layers their imports allow records/framework.js re-exported Lit, signals, the snapshot and presentation primitives and createSemanticApplication, and imported dom/move-focus.js for its effect. Every layer imported it by served path, so dependency-cruiser excluded it and saw no route through it: state/semantic-state.js reached the record folds in records/ through createSemanticApplication, and modules in base/ and state/ pulled in dom/move-focus.js and its graph. The facade goes, and each importer names the module that holds what it uses: - Lit and signals come from /vendor/lit.js and /vendor/signals-core.js, as the library and several runtime modules already imported them. - The snapshot and presentation primitives import only signals, so they move to base/snapshot.js and base/presentation.js. - The publisher moves to state/semantic-application.js, beside state/semantic-state.js, its one importer. semantic-state.js stays in state/, since state/context.js, state/document-identity.js, state/queue-api.js and three readings/ modules import it. The folds the publisher composes (thread/model, thread/identity, pending/model, projection/model, obligations/source) import only state/, base/ and lib/, so they move from records/ to the same paths under state/. leaf.js imports dom/move-focus.js first, so the mover's focus accounting is installed before any module the boot loads can render; before, it was installed partway through the first facade importer's graph. The note on installMoveSelection loses its reason, a cycle through the facade. dependency-cruiser now checks every import. The exact closures of the record readings and the keyboard dispatcher name the application state they always reached, and `one-application-publisher` holds that only semantic-state.js imports the publisher, which replaces the eslint rule architecture/semantic-store-ownership and its test: that rule read imports of the facade by name. The known list stays at 2 entries. activity-view.test.mjs imports dom/move-focus.js, as the page's boot does; it had the mover's focus accounting only because the widget API's graph reached the facade. No behaviour change on a page.
leaf-agent
approved these changes
Nov 25, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 25, 2026
… fails every upward import (#7145) 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_ Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
Removes
browser/runtime/records/framework.js, the facade that every layer imported. The layer check (#7113, #7119) had to exclude it, so it couldn't see routes through it, such asstate/semantic-state.jsreaching the record folds inrecords/throughcreateSemanticApplication. With the facade gone, dependency-cruiser checks every runtime import and still finds only the 2 known crossings. A Leaf page behaves as before. #7119's reviewer proposed this split.Each piece now stands in the lowest layer its own imports allow:
/vendor/lit.jsand/vendor/signals-core.jsdirectly, aslib/and several runtime modules already did.base/snapshot.jsandbase/presentation.js. Both import only signals.state/semantic-application.js(wasrecords/framework/application.js). The five folds it reads move fromrecords/to the same paths understate/:thread/model,thread/identity,pending/model,projection/modelandobligations/source.semantic-state.jsstays instate/, since modules instate/andreadings/import it.one-application-publisherlets onlystate/semantic-state.jsimportsemantic-application.js. It replaces the eslint rulesemantic-store-ownershipand its test, which policed imports through the facade.What to check
dom/move-focus.jsinstalls Leaf's focus accounting around DOM moves. Any entry point that imported the facade used to install it,portable-api.json a plain HTML page included. Nowleaf.jsimports it first, so only a Leaf page installs it, as the module's header says ("off Leaf the browser owns focus"). On a Leaf page it installs earlier than before.createApplicationPublishernow sits inbase/snapshot.jsbesideshareanddefineOwn, so any module can import it, where before only the framework's own modules could. The new rule fencescreateSemanticApplication, which builds the page's one application state.Tests: pre-commit over the change (dependency-cruiser, knip, eslint),
pnpm run test:runtime(1126 pass),pnpm run check,pnpm run build:browser(no generated file changed), the kernel bundle build,tests/smoke/test_plain_page.py, andleaf-dev probe alert-review --base(both arms boot with no console output).