Skip to content

docs: cover the direct wasm32 target, and let CI run on docs-only PRs - #539

Merged
godofecht merged 3 commits into
mainfrom
docs/direct-wasm32-target
Aug 18, 2026
Merged

godofecht merged 3 commits into
mainfrom
docs/direct-wasm32-target

Conversation

@godofecht

@godofecht godofecht commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

The MLIR to wasm32 path landed across #529–#535 and touched no docs. docs/language/wasm.md still listed it as deferred:

| Direct WASM emission (skip C) | No IR→WASM backend planned near-term |

Docs

New section: Direct wasm32 (no Emscripten). The page previously described one route to a .wasm — ./flow wasm through Emscripten. There are now two, for different jobs, so the intro says which is which and the new section documents the second: the pipeline, every python -m flow.wasm_compiler flag, export validation against the symbols defined in the IR, reading and writing arguments through exported linear memory, the env.malloc import and the bump allocator in runtime/wasm/flow_runtime.mjs, and a table of what each CI step actually executes rather than just builds.

Toolchain note. The clang on PATH needs the WebAssembly target compiled in. Apple's system clang does not have it and fails with No available targets are compatible with triple "wasm32-unknown-unknown" — I hit this running the tool locally, so the section names FLOW_WASM_CLANG and LLVM_PATH as the way out. It also explains the -Woverride-module warning: the MLIR step emits wasm32-unknown-emscripten and the linker step overrides it.

Stale rows corrected. The deferred row now names libc, which is what is genuinely still missing under a -nostdlib target. The status matrix, the "what works today" list, and the ROADMAP row all name the second route. The ROADMAP cell also had an unescaped | inside it that split the table; escaped.

DEVELOPMENT.md. The pipeline diagram stopped at MLIR (experimental) and never mentioned LLVM IR or wasm32. Added both, plus a component entry for wasm_compiler.py.

Nav. docs/language/wasm.md and docs/language/wasm-crossings.md were being built but were unreachable from the mkdocs nav. Added both.

Generated file refresh. docs/library/stdlib-api.md is regenerated by scripts/build_wiki.py; the checked-in copy was six modules behind (bigint, checked_arith, dsp, keys, rf, units_si), 105 → 111.

The CI fix

The first push of this branch got three checks, and the link checker was not among them. version and doc-links carry this comment:

Deliberately ungated — the drift-prone files (README.md, CITATION.cff, flow.toml, docs/LANGUAGE_SPEC.md) sit outside every paths-filter above.

The workflow-level on.*.paths defeated that intent. No docs path was listed, so a docs-only change never started ci.yml at all, and the two jobs written specifically to catch markdown drift could never run on the PRs most likely to cause it.

Added docs/**, mkdocs.yml, CITATION.cff and **.md to both triggers. Every expensive job stays gated on the changes filter and the ci-ok aggregator already treats unmatched jobs as not-required, so a docs-only run is still just changes, version, doc-links and the aggregator.

Validation

  • scripts/check_doc_links.py — 1410 relative links across 1346 files, all resolve
  • scripts/build_wiki.py then scripts/check_wiki_links.py — both clean
  • mkdocs build — 171 warnings, identical to the count on main, all pre-existing
  • scripts/sync_version.py --check — in sync
  • ci.yml parses as YAML

Everything documented here is read from the source and the workflow. I could not run the wasm build end to end locally, since the toolchain limitation above is the reason the toolchain section exists; the behaviour claims come from src/flow/wasm_compiler.py and the assertions in .github/workflows/wasm32.yml.

Independent of #538, which is code.

@godofecht godofecht changed the title docs: cover the direct wasm32 target docs: cover the direct wasm32 target, and let CI run on docs-only PRs Aug 18, 2026
godofecht added a commit that referenced this pull request Aug 18, 2026
The feature list is read out of the compiler rather than hand-maintained,
so it cannot fall behind the implementation: keywords from Lexer.keyword_map,
attributes from KNOWN_ATTRIBUTES, subcommands from the flow driver's dispatch
table, modules from lib/stdlib, backends from the *_generator / *_codegen /
*_compiler modules. That is 248 features today.

docs/coverage.json maps each one to the page that documents it. A mapping
only counts when the page exists and actually mentions the feature, so an
entry cannot be a promise nobody kept, and a mapping for something the
compiler has since dropped is reported as stale.

Bootstrapping it found 16 features no page mentions at all. Twelve are
compatibility aliases for `flow demo ...` and two are spelling aliases, all
now exempt with reasons. One is the direct wasm32 backend, which PR #539
documents. The last was real: `flow check` has existed since #415 and was
documented nowhere, so this adds it to DEVELOPMENT.md with what it reads
from flow.toml, what it skips, and what it exits.

Coverage now: attribute 20/20, backend 8/9, cli 52/66, keyword 44/44,
stdlib 109/109, with 15 exemptions each carrying a written reason and
nothing uncovered.

Two extraction details worth knowing. Subcommands come from the dispatch
`case` arms rather than show_help, so a command that exists but was never
added to the help text still counts; the first attempt read every `case` in
the driver and picked up architecture and profile arms, which the tests now
pin against. And `mentions` is deliberately literal per category: `@gpu`
matches the attribute while the bare word "gpu" does not, so a passing
mention cannot masquerade as documentation.

Reporting only, no CI gate yet.

Unit 1428 passed, ruff clean.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
godofecht and others added 3 commits August 18, 2026 11:10
The MLIR to wasm32 path landed across #529 through #535 with no docs, and
docs/language/wasm.md still listed "Direct WASM emission (skip C)" as
deferred with no backend planned.

- New "Direct wasm32 (no Emscripten)" section covering the pipeline, the
  `python -m flow.wasm_compiler` flags, export validation, linear-memory
  marshalling, the `env.malloc` import and the bump allocator in
  runtime/wasm/flow_runtime.mjs, the toolchain requirement, and what
  .github/workflows/wasm32.yml actually executes.
- Replaced the stale deferred row. libc is the thing still missing under
  the freestanding target, so that is what the row now says.
- Status matrix, "what works today" list, and the ROADMAP row name the
  second route. The ROADMAP cell also had an unescaped pipe splitting the
  table; escaped it.
- DEVELOPMENT.md: the pipeline diagram stopped at "MLIR (experimental)"
  and never mentioned LLVM IR or wasm32. Added both plus a component entry
  for wasm_compiler.py.
- docs/language/wasm.md and wasm-crossings.md were built but unreachable
  from the mkdocs nav. Added both.
- Refreshed docs/library/stdlib-api.md, which build_wiki.py regenerates:
  six modules added since the last commit of it (bigint, checked_arith,
  dsp, keys, rf, units_si), 105 to 111.

check_doc_links, check_wiki_links, build_wiki all pass; mkdocs warning
count unchanged at 171.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The version and doc-links jobs carry a comment saying they are
deliberately ungated at the job level, because the drift-prone files
(README.md, CITATION.cff, flow.toml, docs/LANGUAGE_SPEC.md) sit outside
every paths-filter. The workflow-level paths defeated that: no docs path
was listed, so a docs-only PR never started the workflow and neither job
ran. The docs PR this rides on got three checks, none of them the link
checker.

Added docs/**, mkdocs.yml, CITATION.cff and **.md to both triggers. Every
expensive job stays gated on the changes filter, so a docs-only run is
still just changes, version, doc-links and the aggregator.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
check_doc_coverage.py exempted backend:wasm_compiler with a reason naming
this branch. The page exists here, so the exemption becomes a real mapping.

Backends: 9/9 covered, nothing exempt.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@godofecht
godofecht force-pushed the docs/direct-wasm32-target branch from 80aaea0 to ab46e0f Compare August 18, 2026 10:10
@godofecht
godofecht merged commit c725360 into main Aug 18, 2026
19 checks passed
@godofecht
godofecht deleted the docs/direct-wasm32-target branch August 18, 2026 10:24
godofecht added a commit that referenced this pull request Aug 18, 2026
Two jobs, and a ratchet so the example one can be turned on today rather
than after 359 fixes.

doc-coverage runs check_doc_coverage.py and is deliberately ungated. A new
keyword, attribute or subcommand added under src/ must not land undocumented
just because the pull request touched no markdown, and the feature list is
read from the compiler, so the job knows.

doc-examples compiles every ```flow block. The examples that do not build
today are recorded in docs/generated/example-status.json and grandfathered.
Rows are keyed by a hash of the block's own text, so editing one produces a
key the ledger has never seen and the new text has to compile. Existing debt
is inherited; new and edited content is not.

Debt that has since been paid off is reported, not failed. Failing an
unrelated pull request because someone else fixed a doc example would teach
people to regenerate the ledger without reading it, which is exactly how a
ratchet stops meaning anything.

Verified end to end rather than by inspection: a new broken block fails and
names the file, line, stage and diagnostic; the same block tagged
expect-error passes; and editing a block the ledger grandfathers makes it
fail again. That last one is the property the whole scheme rests on, and it
has its own test.

Also fixed a bug in the failure path itself: the missing-ledger message
called relative_to(ROOT), which raises when the ledger is anywhere else.

Both jobs join the ci-ok aggregator. Ledger refreshed for the block #539
added: 751 examples, 359 unverified.

Unit 1496 passed, ruff clean on src.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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