Repository navigation
fix: validate top module first - #12
Merged
Merged
Conversation
…ding No behaviour changes. The structure checks (required concepts, functional specs, implementation reqs) and the tree building (exports, acceptance tests, linked resources, concepts) become separate functions so a caller can run them at different points.
Check the top module's structure before the requires walk, record required modules during the walk, then validate them top-down after the top module. This is the order codeplain reports errors in, so a broken chain now gives the same first error from `plain-parser check` and from codeplain's `--dry-run`. Each module is still read once.
bananaplain
force-pushed
the
fix/validate-top-module-first
branch
from
October 12, 2026 14:45
8feefa4 to
f23dd77
Compare
bananaplain
force-pushed
the
fix/validate-top-module-first
branch
from
October 12, 2026 14:57
f23dd77 to
4855684
Compare
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.
When more than one module of a
requireschain had an error,plain-parser checkandcodeplain --dry-runreported different first errors. Giventoprequiringmiddle,middlerequiringbase, and an undefined concept in bothmiddleandbase, plain-parser reportedbase's and codeplainmiddle's.plain-parser validated each required module as the requires walk reached it, deepest first, and checked the top module's structure after the walk. On the other hand, codeplain checks the top module's structure before the walk and runs its remaining checks after it. It then validates each required module in a fresh parse, top-down, in listed order.
Change
validate_and_marshall_moduleis replaced by two functions, with no behaviour change:validate_module_structure: required concepts defined, functional specs present and non-empty, implementation reqs present.validate_and_build_module_tree: exported definitions merged, acceptance tests, linked resources, code variables, concept validation, marshalled tree.RequiredModule: parse result, the exports each receives, its own exports, code variables. Circular, fixed-order and parse errors are raised during the walk, as before.parse_module_chainare unchanged. Each file is still read once.tests/test_requires.pypin each ordering rule with two broken modules, an accepted chain listing one module twice (requires: [base, base]), a required module without functional specs, a top-module concept error reported before a required module's missing functional specs, and that each module's tree is built once, top module first.origin/mainon 10,000 random requires graphs: no differences in verdict, first error or tree. Before this change, 329 first errors differed.Release
requires/circular_requires_subhas missing implementation reqs and a circular require, and now reports the missing implementation reqs first, as codeplain does.plain-forgeusers needuv tool upgrade plain-parser;plain-forge updatedoes not upgrade it.