Repository navigation
Count repository statistics in Flow, published to the README by CI - #200
Merged
Merged
Conversation
The README carried hand-maintained figures that had drifted badly: it claimed ~38,000 lines against an actual 169,242. Replace them with a block regenerated from tracked files, plus shields badges that read the emitted JSON so they refresh without touching markup. The counter of record is scripts/tools/repo_stats/main.flow. Flow cannot spawn processes yet, so update_repo_stats.sh runs git and leaves the output for it to read. Nothing would otherwise prove the Flow port agrees with scripts/update_repo_stats.py, so the shim diffs the two on every run and fails loudly on divergence rather than publishing wrong numbers. Casting between a byte pointer and string is now accepted by the type checker. They share a representation in the C backend, and FFI code needs the conversion; without it this program only compiled under --lenient, which suppressed real type errors along with the spurious ones. Co-authored-by: Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
The Flow counter and the Python reference have to agree byte for byte, and they once did not: Flow truncated where Python rounds, so a badge read 72.5k against a README saying 72.6k. Nothing caught it, because neither implementation had tests over its formatting. Cover the rounding boundaries, the whole-component matching in `under` that keeps src/flowers out of src/flow, and the README marker contract that every refresh depends on. Co-authored-by: Cursor <[email protected]>
Recount against current main so the PR stays mergeable and the README numbers match the tree being merged. Co-authored-by: Cursor <[email protected]>
godofecht
force-pushed
the
feat/repo-stats
branch
from
August 5, 2026 19:04
29ee185 to
c19bfc7
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.
Summary
The README carried hand-maintained figures that had drifted badly: it claimed ~38,000 lines against an actual 171,889 across 1,868 tracked files. This replaces them with a block regenerated from tracked files by CI, plus shields badges that read the emitted JSON so they refresh without anyone touching markup.
The counter of record is
scripts/tools/repo_stats/main.flow. Flow cannot spawn processes yet, soscripts/update_repo_stats.shruns git and leaves the output for the Flow program to read; everything after that (parsing, counting, JSON and Markdown emission) happens in Flow.Nothing would otherwise prove the Flow port agrees with
scripts/update_repo_stats.py, so the shim diffs the two on every run and fails loudly on divergence rather than publishing wrong numbers.Defects fixed along the way
--lenient, which suppressed genuine type errors alongside the spurious pointer-cast ones. Casting between a byte pointer andstringis now accepted by the type checker: they share a representation in the C backend, and FFI code needs the conversion.HEAD^, which fails on the shallow cloneactions/checkoutproduces by default. The workflow now usesfetch-depth: 0and the walk is bounded.SIGALRM, which a process blocked in a syscall can ignore indefinitely. It now usestimeout -kwith a pollingSIGKILLfallback, so a stuck binary cannot hang CI.Test plan
scripts/update_repo_stats.pyoutput verified byte-identical against the previous implementation (JSON and Markdown)scripts/update_repo_stats.py --checkpasses, confirming deterministic outputscripts/tools/repo_stats/main.flowtranspiles under the strict type checker and compiles with clangtests/unit/test_pointer_string_casts.py(4 new tests, including the negative case)test_units.py,test_strict_lambda_types.py,test_rt_safety.py— 63 passedMade with Cursor