Repository navigation
Port the doc and version checkers from Python to Flow - #959
Merged
Merged
Conversation
The stability manifest checker is now scripts/tools/stability_manifest/main.flow, run through scripts/check_stability_manifest.sh. The shim builds the Stage-A compiler from the checked-in bootstrap C with cc, so the check needs no Python. scripts/tools/lib holds the helpers the ported tools share: byte-string and path utilities, a string list and set, and a JSON reader. Parity: stdout, stderr and exit code match the Python checker on the real manifest and on 22 mutated manifests, with and without --require-complete. The one difference is a non-string kind list, where Python crashed with a TypeError and the Flow checker reports the unknown kind.
scripts/tools/sync_version/main.flow now owns version mirroring, run through scripts/sync_version.sh. The mirror patterns are expressed as literal text plus one character-class run, matched with Python re semantics (greedy runs with backtracking, MULTILINE anchors). The shim downloads and hashes the release tarball for --sha256-from-release, since Flow has no network access. Workflows, RELEASE-1.0.md, prepare_release.py and the version.py docstring now call the shim. build_tool.sh prefers clang, because flowc output relies on clang pragmas that GCC 14 would reject. Parity: 25 cases compared stdout, stderr, exit code and the resulting tree against the Python script: --check and write on the real tree, drifted mirrors, --set with prerelease and build tags, --release-date, --homebrew with --sha256, --sha256-from-release against v1.0.1, a missing mirror, a missing canonical assignment, extra driver lines, a non-breaking space, and argument errors (unknown, ambiguous prefix, missing value, bad semver, --check with --set). All identical once the program name in usage lines and the 'Fix with' hint are normalised to the shim.
scripts/tools/wiki_links/main.flow validates links in build/wiki, run through scripts/check_wiki_links.sh. The shim lists the built tree with find(1); the Flow program rebuilds Python 3.12's Path.rglob order from it, so broken links are reported, and truncated at 40, in the same order as before. scripts/tools/lib/unicode.flow adds the Unicode classes the ports need to match Python exactly: str.isalnum (re \w), str.isspace (re \s) and str.lower, as range tables generated from Unicode 15.0. The tables were checked against Python 3.12 for every code point. Parity: identical stdout, stderr and exit code on the freshly built wiki, on a wiki with 104 broken links across 70 pages (docs/ prefixes, repo-root links, example siblings, absolute paths, nested brackets, Unicode spaces, paths escaping the tree), on a single broken link, and with no build/wiki.
scripts/tools/doc_links/main.flow checks relative links and heading fragments in tracked markdown, run through scripts/check_doc_links.sh, which leaves git ls-files output in build/doc-links/. The port covers the link regex (lazy target, optional title), GitHub heading ids with Unicode \w and lower(), numbered repeats, id=/name= anchors, and the difflib closest-heading hint (SequenceMatcher ratio, ties to the larger string). Two debugging modes replace the Python imports the unit tests relied on: --slug TEXT prints a heading id and --anchors FILE lists a page's anchors. tests/unit/test_doc_anchors.py now drives the shim. Parity: identical output and exit code on the real tree, with --list-ok, and on 4 pages seeded with 26 broken links and anchors (titles, nested brackets, directory links, paths outside the repo, Unicode targets, newlines inside the parentheses), plus single-link cases. The anchor set of every tracked markdown file, and of a page of edge-case headings with invalid UTF-8, matches the Python anchors_in exactly (1393 files).
scripts/tools/doc_coverage/main.flow checks that every keyword, attribute, CLI command, stdlib module and backend has a documented home, run through scripts/check_doc_coverage.sh. The shim writes the git ls-files and find listings the program cannot make itself. --propose and --write-proposal are ported too, including json.dumps(indent=2, sort_keys=True) output. The attribute list is now read from the frozenset literals that KNOWN_ATTRIBUTES unions in src/flow/attributes.py, so the checker needs no Python import. tests/unit/test_doc_coverage.py drives the shim through new --inventory, --map, --mentions and --is-backend options instead of monkeypatching module internals. Parity: the inventory matches the Python one entry for entry. Output, exit code and the rewritten docs/coverage.json are identical across 23 cases run in a copy of the tree outside any dot-directory: the real map, --propose, --write-proposal (with and without an existing map), unmapped features, missing and silent pages, dropped features, blank and null exemptions, more than 60 problems, new keywords, attributes, CLI arms, backends and stdlib modules, Unicode word boundaries, and argument errors.
scripts/tools/roadmap_sync/main.flow extracts open ROADMAP.md items, matches them to [roadmap] issues and rewrites docs/project/issues-checklist.md. scripts/sync_roadmap.sh runs it in three phases around the gh calls Flow cannot make: check arguments, plan (report, or write the gh calls to build/roadmap-sync/plan.txt), then apply the checklist rewrite with the numbers of the issues gh created. The Makefile targets and CONTRIBUTING.md now point at the shim. Parity: a fake gh on PATH served the live list of 52 roadmap issues and logged every mutating call. Across 16 cases (dry run, verbose and quiet syncs that create, adopt and close issues, a failing gh issue list, extra roadmap rows covering tables, checkboxes, numbered items, en dashes, escaped pipes and non-ASCII titles, a completed item, a URL-form --repo, missing files and argument errors) stdout, stderr, exit code, the rewritten checklist and the exact gh calls, issue bodies included, matched the Python script.
godofecht
force-pushed
the
port/doc-checkers-to-flow
branch
from
September 27, 2026 20:50
fa7f645 to
b4ad09d
Compare
godofecht
added a commit
that referenced
this pull request
Sep 29, 2026
Dashes, curly quotes and emoji heading markers are gone. Item titles keep their words, so every roadmap slug is unchanged: a dry run of scripts/sync_roadmap.sh plans the same creates, adoptions and closes as before. The sync is named as scripts/sync_roadmap.sh, since the Python script was deleted in #959.
godofecht
added a commit
that referenced
this pull request
Sep 29, 2026
godofecht
added a commit
that referenced
this pull request
Sep 29, 2026
Dashes, curly quotes and emoji heading markers are gone. Item titles keep their words, so every roadmap slug is unchanged: a dry run of scripts/sync_roadmap.sh plans the same creates, adoptions and closes as before. The sync is named as scripts/sync_roadmap.sh, since the Python script was deleted in #959.
godofecht
added a commit
that referenced
this pull request
Sep 29, 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.
Ports the Python scripts CI runs for docs and versions to Flow. Each tool is a Flow program under
scripts/tools/<name>/main.flowwith a bash shimscripts/<name>.sh. The shim runs git, find or gh where Flow cannot, and leaves the results inbuild/for the program to read.No Python is needed.
scripts/tools/build_tool.shbuilds the Stage-A compiler fromcompiler/bootstrap/flowc_stage_a.cwith cc, then compiles the tool in bundle mode. Binaries are cached inbuild/flow-tools.Ported
check_stability_manifest.pytools/stability_manifestcheck_stability_manifest.shsync_version.pytools/sync_versionsync_version.shcheck_wiki_links.pytools/wiki_linkscheck_wiki_links.shcheck_doc_links.pytools/doc_linkscheck_doc_links.shcheck_doc_coverage.pytools/doc_coveragecheck_doc_coverage.shsync_roadmap.pytools/roadmap_syncsync_roadmap.shShared helpers are in
scripts/tools/lib:text.flow(strings, paths, lists, sets, maps),json.flow(reader and writer),unicode.flow(thestr.isalnum,str.isspaceandstr.lowertables, generated from Unicode 15.0 and checked against Python 3.12 for every code point) andmdtext.flow(UTF-8 decoding with errors ignored,splitlines,split).tests/unit/test_doc_anchors.pyandtests/unit/test_doc_coverage.pynow drive the shims. They use new options (--slug,--anchors,--inventory,--map,--mentions,--is-backend) instead of importing module internals.Parity
Each port was compared with the Python script on stdout, stderr, exit code and any files written.
--require-complete: all identical. One case differs on purpose: a non-stringkindlist crashed Python with a TypeError, and the Flow checker reports the unknown kind. The exit code is the same.--checkand write on the real tree, drifted mirrors,--setwith prerelease and build tags,--release-date,--homebrew --sha256,--sha256-from-releaseagainst v1.0.1, a missing mirror, a missing canonical assignment, and argument errors. All identical once the program name in usage lines and the "Fix with" hint are normalised.build/wiki. The report order matches Python 3.12'sPath.rgloborder, which the program rebuilds from find's per-directory order.--list-ok), and 4 pages seeded with 26 broken links and anchors, including the difflib closest-heading hints. The anchor set of all 1393 tracked markdown files, plus an edge-case page with invalid UTF-8, matches Python'sanchors_in.all_doc_pagesdrops every page when the checkout path has one. They cover the real map,--propose,--write-proposal, broken mappings, new compiler features, Unicode word boundaries and argument errors. All identical, including the rewrittencoverage.json.ghserved the live list of 52 roadmap issues and logged every call. In 16 cases, covering dry runs, syncs that create, adopt and close issues, a failinggh issue list, and extra roadmap rows, the output, the rewritten checklist and the exact gh calls (issue bodies included) all matched.Left in Python
scripts/wiki_nav.pyis a library imported byscripts/build_wiki.pyandtests/unit/test_wiki_nav.py. It is not an entry point, so it moves whenbuild_wiki.pydoes.ROADMAP.mdstill namesscripts/sync_roadmap.pyin two sentences. The house-rules commit hook scans whole staged files, and ROADMAP.md has 64 pre-existing findings. Rewording it would also change the text the roadmap sync parses. Those two references need a follow-up.Flow gaps found
string + stringcan compile to pointer addition. Workaround: unique local names.externprototypes clash with libc headers outside a fixed allowlist (for examplestrtoll), and the generated C relies on clang-only pragmas that GCC 14 turns into errors. Workarounds:strtol, andbuild_tool.shprefers clang.printof a non-literal string uses%d. The tools write throughwrite(2)instead.