Repository navigation
Move validation's checks below their callers, leaving page check in validation - #7116
Merged
Merged
Conversation
… validation `src/leaf`'s children are moving into layer subpackages, each importing only itself and the layers below it. `validation` sits with the page commands, because `validation/command.py` runs `page check` and the render gate. But its other modules are checks that lower modules call: event admission, thread replies, revision activation, the capture, layer composition, the clerk, the agent's state and sample histories. So 15 of the import-linter allowances were imports reaching up into `validation`. This splits the package by what each module needs: - `markup_checks/` holds `markup.py` and `instances.py`: the rules a document's markup meets, checked from the document and registry given. - `authored_checks/` holds `admission.py`, `source.py`, `source_history.py` and `declarations.py` (formerly `composition.py`): the checks of what an author hands in, which read the page directory and log around the markup rules. - `validation/` keeps `command.py`, and now stands above the render gate it runs. Three functions moved to the owners of what they check, which their callers already stand above. `unanswered_media` joins `revision_artifact`, since `validation.md` makes the capture the owner of a `/media/` file the page won't answer. `text_media_errors` joins the message gate in `authored_checks.admission`, beside `checked_text`, which runs it. `incoming_registry` joins `registry.validation`, beside `validate_registry`. In `.config/importlinter.ini`, `authored_checks` stands below every module that calls it, such as `thread`, `clerk` and `vendoring`, and `markup_checks` just above `gesture_words`. Two modules move to where their imports put them: `anchor_capture` below `authored_checks`, which imports it, and `revisioning` above it, since activation runs the source check; that also frees `revisioning`'s allowances into `page_view` and `revision_artifact`. The allowances go from 95 to 77. Two still name these modules, each on an import cycle, and each replaces a crossing the other way: - `authored_checks.source` -> `sample_content`: a sample's history is checked with the message gate, whose samples are checked the same way. `sample_content` admits fixture events, so it stays above event admission, and the source check that calls it stands below. - `render_gate.handover_pass` -> `validation.command`: the server's render pass runs `check_page`, which hands its reading back to that pass. This replaces the three imports the other way. No behaviour changes; every caller and test imports the new paths. > _This was written by Claude Code on behalf of max-sixty_
leaf-agent
approved these changes
Nov 25, 2026
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
src/leaf/validationso the checks lower modules call stand below them, and onlypage checkstays with the page commands. This is one step of movingsrc/leaf's children into layer subpackages: 15 of the 95 import-linter allowances were imports reaching up intovalidation.markup_checks/:markup.pyandinstances.py, the rules a document's markup meets, checked from the document and registry given. Event admission imports it downward now.authored_checks/:admission.py,source.py,source_history.pyanddeclarations.py(formerlycomposition.py), the checks of a page's saved source, an agent's messages and a layer's declarations. It stands just below every module that calls it.validation/command.pystays in place and now stands above the render gate it runs.unanswered_mediamoves intorevision_artifact, whichvalidation.mdmakes the owner of a/media/file the page won't answer;text_media_errorsintoauthored_checks.admission, besidechecked_text, which runs it;incoming_registryintoregistry.validation.anchor_capturemoves belowauthored_checks, andrevisioningabove it, since activation runs the source check.Allowances go from 95 to 77.
What to check: the two allowances that still name these modules, in
.config/importlinter.ini. Both are new lines, and each replaces a crossing the other way on an existing cycle:authored_checks.source -> sample_content: a sample's history and the message gate check each other recursively.sample_contentadmits fixture events, so it stays above event admission (formerlysample_content -> validation.admissionand-> validation.markup).render_gate.handover_pass -> validation.command: replaces the threevalidation.command -> render_gate.*allowances. Movingcheck_pageintorender_gatewould remove it, after List the parts a thread can name in each visual inleaf page state#7109 lands.#7109 will hit a one-line import-block conflict in
tests/model/test_handover_pass.py;validation/command.pyitself auto-merges.Tests: 1,162 model tests covering validation, admission, revisioning, layers, delivery and the clerk, two process tests for
page checkandcheck_source,lint-imports, andpre-commiton the changed files all pass.