Skip to content

Implement from=, so a page that inlines a program cannot drift from it - #582

Merged
godofecht merged 2 commits into
mainfrom
doc-from-tag
Aug 19, 2026
Merged

godofecht merged 2 commits into
mainfrom
doc-from-tag

Conversation

@godofecht

@godofecht godofecht commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Why

#581 hit this. examples/flow_way/README.md inlines the program from swappable_telemetry.flow and renamed a variable to test, which is a keyword:

SyntaxError: Unexpected token in expression: TokenType.TEST

The linked file kept the name that parses. CI caught it only because the copy stopped compiling — a rename that still compiled would have gone unnoticed, and the page would quietly describe a program nobody runs.

The measurement

42 blocks sit next to a link to a .flow file. 34 of them no longer appear in the file they link. Eight are still verbatim copies.

What this adds

from=path asserts the block still appears in the named file:

```flow from=examples/book/01_hello.flow

The eight verbatim copies are tagged, so they are now locked to their files:

Page File
docs/book/01-a-complete-program.md examples/book/01_hello.flow
docs/book/02-values-and-types.md examples/book/02_values.flow
docs/book/03-decisions-and-repetition.md examples/book/03_control.flow
docs/book/05-records-and-arrays.md examples/book/05_records_arrays.flow
docs/book/06-pipelines-and-results.md examples/book/06_pipeline_result.flow
docs/book/07-from-updates-to-flows.md examples/book/07_decay.flow
docs/effects-showcase.md (×2) examples/effects/showcase.flow

Those files are covered by tier-2, so the page is now covered transitively.

Verified by breaking it

Renaming main in examples/book/01_hello.flow:

1 example(s) do not compile and are not in the ledger:
    docs/book/01-a-complete-program.md:6 [from] block no longer appears in
    examples/book/01_hello.flow; the page and the file have drifted

A test that changed sides

from= was listed in docs_blocks as designed but not implemented, with a test asserting it must not parse while it does nothing:

# Designed but not implemented: must not parse while it does nothing.
"flow host=python",
"flow from=examples/book/01_hello.flow",

That test now asserts the opposite, which is what writing it that way was for. host= stays unimplemented and still rejected.

Not in scope

The other 34 blocks are a content job rather than a mechanism job: each needs a human to decide whether the page or the file is the wrong one. The mechanism is here for when that happens.

Verification

Check Result
pytest tests/ 1671 passed, 6 skipped
check_doc_examples.py --check-ledger no new unverified, 221
check_doc_links.py all links and fragments resolve

CONTRIBUTING.md documents from= alongside the other three info-string words, with the reason to reach for it.

godofecht and others added 2 commits August 19, 2026 18:10
PR #581 hit this: examples/flow_way/README.md inlined the program from
swappable_telemetry.flow and renamed a variable to `test`, which is a
keyword. The file kept the name that parses, the copy did not, and CI caught
it only because the copy stopped compiling. A rename that still compiled
would have gone unnoticed.

42 blocks sit next to a link to a .flow file. 34 of them no longer appear in
the file they link. Eight are still verbatim copies, and those are now tagged
`from=`, so the checker asserts the block appears in the named file and fails
with which page and which file disagree.

`from=` was listed in docs_blocks as designed but not implemented, alongside
a test asserting it must not parse while it does nothing. That test now
asserts the opposite, which is the point of having written it that way.

Verified by breaking it on purpose: renaming main in examples/book/01_hello.flow
fails the gate with "block no longer appears in examples/book/01_hello.flow".

The remaining 34 are a content job, not a mechanism job: each needs a human
to decide whether the page or the file is the wrong one.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@godofecht
godofecht merged commit 0032ef1 into main Aug 19, 2026
20 checks passed
@godofecht
godofecht deleted the doc-from-tag branch August 19, 2026 17:45
@godofecht godofecht mentioned this pull request Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant