Repository navigation
docs: resolve imports when checking examples, and mark the aspirational ones - #548
Merged
Merged
Conversation
The checker called parse_flow_code directly, so an example that imported a module was type-checked with none of that module's symbols in scope. Every one of lib/stdlib/audio/README.md's fourteen programs failed with "Undefined function 'bass'", and bass, clock_house, clock_medium, euclidean_pattern and progression_pop all exist. The documentation was right; the tool was wrong. This is the same class of mistake as bypassing the DSL expanders: reporting correct documentation as broken pushes an author to rewrite something that already works, which is worse than missing a real failure. Blocks with imports now go through module_resolver.resolve_modules, the same entry point the transpiler uses. Costs about 47ms each and only for blocks that import, so the whole run stays near seven seconds. The vacuity and no-op checks stay on the block's own declarations. The resolved unit carries every imported declaration too, and counting those would let a bare `import` line make an empty block look substantial. Recovered 15 examples that were correct all along, and the audio README now fails with real diagnostics instead: wrong argument types for pattern_4 and euclidean_pattern, and an undeclared `clock`. Those are genuine doc bugs. Verified 392 to 407; unverified 315 to 300. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
44 blocks that cannot compile because they were never meant to, each now carrying a written reason rather than sitting in the ledger as anonymous debt. VISION.md is a vision document, and all 30 of its Flow blocks describe syntax the language does not have yet. The reasons distinguish what is actually blocking each one: proposed vocabulary that is not implemented (represent koopman, analyze, control, guarantee, deploy, task, numeric, every tick, when x > y, RingBuffer<N>), dimensioned flow members where flow state is f32/f64 today, fragments of a flow body shown on their own, and proposed temporal syntax. One block sits under the line "This fails to compile" and illustrates a units mismatch. docs/language/syntax.md is a grammar reference, and its 14 failing blocks are notation: a catalogue of literal forms, declaration templates with metasyntactic Type and ReturnType, control-flow shapes with elided bodies, pipe desugaring shown as equivalences, field and index notation. Names like n, point, signal and Stats are undefined on purpose, because the page is teaching shapes. Forcing them into compilable programs would bury what each one is showing. I checked every block individually rather than tagging by file. The reasons are specific so a later reader can tell which are waiting on the language and which are notation that will never compile. Unverified 300 to 256 by count of untagged blocks; ignored 0 to 44. Unit 1496 passed. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
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.
Two commits, separable on review.
1. The checker was wrong about imports
check_doc_examples.pycalledparse_flow_codedirectly, so an example that imported a module was type-checked with none of that module's symbols in scope. All fourteen programs inlib/stdlib/audio/README.mdfailed withUndefined function 'bass':bass,clock_house,clock_medium,euclidean_patternandprogression_popall exist. The documentation was right and the tool was wrong.This is the same class of mistake as bypassing the DSL expanders, which the earlier work already fixed. Reporting correct documentation as broken is worse than missing a real failure, because it pushes an author to rewrite something that already works.
Blocks with imports now go through
module_resolver.resolve_modules, the entry point the transpiler uses. About 47ms each and only for importing blocks, so the run stays near seven seconds.The vacuity and no-op checks deliberately stay on the block's own declarations. The resolved unit carries every imported declaration, and counting those would let a bare
importline make an empty block look substantial.Recovered 15 examples that were correct all along. The audio README now fails with real diagnostics instead: wrong argument types for
pattern_4andeuclidean_pattern, and an undeclaredclock. Those are genuine doc bugs, and the ratchet grandfathers them for a later pass.Verified 392 → 407. Unverified 315 → 300.
2. 44 blocks that were never meant to compile
Each now carries a written reason instead of sitting in the ledger as anonymous debt.
VISION.mdis a vision document, and all 30 of its Flow blocks describe syntax the language does not have. The reasons distinguish what actually blocks each one:represent koopman,analyze,control,guarantee,deploy,task,numeric,every tick,when x > y,RingBuffer<N>state angle : Angle,input voltage : Voltage, … (flow state is f32/f64 today)angle evolves as velocity,counter becomes counter + 1,always { … }continuous / every 1 ms / after 50 us,after disturbance / within 200 mslength + voltage, which sits directly under the line "This fails to compile:"docs/language/syntax.mdis a grammar reference, and its 14 failing blocks are notation: a catalogue of literal forms, declaration templates with metasyntacticTypeandReturnType, control-flow shapes with elided bodies, pipe desugaring shown as equivalences (x |> f # f(x)), field and index notation. Names liken,point,signalandStatsare undefined on purpose, because the page teaches shapes. Forcing them into compilable programs would bury what each one shows.I read every block individually rather than tagging by file, and the reasons are specific enough that a later reader can tell which are waiting on the language and which are notation that will never compile.
Where that leaves the count
The remaining 300 are real: wrong types, undeclared names, statements without a main, and a handful of compiler backend bugs. The ratchet holds them so they can come down page by page.
Validation
--check-ledgerclean, ledger refreshedruff check srcclean