Repository navigation
Split the keyboard's register from its key badges and page keys, so each imports only downward - #7115
Merged
Merged
Conversation
…ach imports only downward The runtime's children are moving into layers, where each child imports only itself and the layers below it. `keyboard/` held modules that belong at three levels, so it sat in import cycles with the DOM and geometry owners and with the composer. `geometry.js`, `shadow-stage.js`, `widget-elements.js` and `notifications.js` imported the register, while `page.js` and `command-reference.js` imported the composer's `capture.js`, and `page.js` imported `sample-child.js`. The keyboard is now three children of the runtime: - `keyboard/` keeps the register: bindings, scopes, page registration, dispatch, text entry, the layer stack, control keys, close requests and key sequences. Outside itself it reaches only low owners, such as focus, `dom-move`, `arrivals` and `repaint`, none of which imports it. - `key-badges/` holds the hint session, the command hints, and where chips and badges stand. - `page-keys/` holds the page's own keys and disclosures, the key listener, Go-to, the command reference, the status context and the touch rows. Two children can't end both cycles. `composing/target-picker.js` imports `hints.js` and `key-badge-placement.js`, and `hints.js` imports `geometry.js` and `notifications.js`, which import the register. So the badges sit above the geometry owners and below the composer, while `page.js` sits above the composer. Any cut into two leaves the page keys in a cycle with the composer, `sample-child.js` and `reactions.js`. None of the three children is now in a cycle with another child. The strongly connected component of the runtime's children that held `keyboard/` had 65 children; what remains of it has 14, the thread, obligation, draft and history records and their neighbours, plus the composer with reactions. Behaviour doesn't change. Imports, the dependency-cruiser rules and every mention of a moved path follow the files, and `keyboard/AGENTS.md` keeps the keyboard's policy for all three directories.
leaf-agent
approved these changes
Nov 25, 2026
max-sixty
added a commit
that referenced
this pull request
Nov 25, 2026
#7115 split keyboard/ into keyboard/, key-badges/ and page-keys/, none of which is in an import cycle. Rerunning the same heuristic over the runtime's imports on current main places all 187 children, and the order now leaves 15 backward imports (10 child pairs) where it left 34 (21), so the known list shrinks to match.
max-sixty
added a commit
that referenced
this pull request
Nov 25, 2026
A commit that adds an import against `browser/runtime`'s order now fails pre-commit and names the import, as `src/leaf` has since #6923. This is the runtime half #6923 left out until the package-interface refactor stopped moving runtime files. `.config/dependency-cruiser.mjs` lists the runtime's 187 children in one order, a `layering` rule per child forbids importing a child before it, and `layering-unplaced` fails a child the order doesn't name. The order is Eades, Lin and Smyth's greedy feedback-arc-set heuristic over the children's imports, run on current `main` after the keyboard split (#7115). The 15 backward imports it leaves (10 child pairs) are in `.config/dependency-cruiser-known.json`, which the hook passes over and which only shrinks. Unlike import-linter, dependency-cruiser passes a stale entry silently, so the config's header asks for each entry to go with its import. To weigh: the order is the one the code already mostly takes, not a design. max-sixty chose to move the runtime's children into named layer directories once the modules that cross layers are split; that move rewrites this list to name layers. Probed: passes as committed (1.8 s); fails naming `carry.js → thread/selectors.js` when that known entry is dropped; fails `layering-unplaced` when `age` is left out of the order. Pre-commit passes on the changed files. > _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.
Splits
browser/runtime/keyboard/into three children of the runtime, so that each imports only downward as the runtime's children move into layers.keyboard/keeps the register: bindings, scopes, dispatch, text entry, the layer stack, control keys, close requests and key sequences.key-badges/holds the hint session, the command hints and where chips stand.page-keys/holds the page's own keys, the key listener, Go-to, the command reference, the status context and the touch rows. This ends the import cycles between the keyboard and the DOM and geometry owners (geometry.js,shadow-stage.js,widget-elements.jsandnotifications.jsimport the register), and between the keyboard and the composer.It takes three children rather than two because
composing/target-picker.jsimportshints.js, andhints.jsimportsgeometry.jsandnotifications.js, which import the register. So the badges sit above the geometry owners and below the composer, whilepage.jssits above the composer. None of the three is now in a cycle with another child, and the runtime's largest cycle of children shrinks from 65 children to 14. Worth reading: the new opening ofkeyboard/AGENTS.md, which keeps the keyboard's policy, Touch routes included, for all three directories. The rest of the diff is import paths and the comments that name a moved file. Behaviour doesn't change.max-sixty decided the layer move; the session that asked for this split has read the diff.
Tests:
pnpm run test:runtime(1,130 pass),pnpm run check, pre-commit on the changed files (eslint, dependency-cruiser, knip), the kernel bundle build, and 12 focused keyboard tests (Go-to, the command reference, Escape across layers, letting go of unseen focus, Draw mode, the register's keydown census, the owner index).