Repository navigation
bench+web: mirror the test-code trees, measure on WSL, and unbreak the docs - #13
Merged
MotherOfProgrammers merged 1 commit intoOct 21, 2026
Conversation
…e docs The Lithon test-code tree was reorganised into category folders (Classes, DataTypes, Functions, Loops, NewTypes, Pointers, Structs), but the Python side was only half-migrated and the website still pointed at the old flat paths. This commit finishes the migration, makes the benchmark measure where the measurement is honest, and brings the docs back in line with the engine. test_codes_python now mirrors test_codes_lithon folder for folder: every .lio program has a .py twin in the same category. The twins keep the shape of the program where CPython has no equivalent (raw pointers, packed structs, width annotations) and say so in their docstring. The three programs that are deliberately pinned failures on the Lithon side (check_strings, pointer_error, class_basics) are left alone -- they are the record of what is missing, not bugs. bench_vid_maker: * Resolve the engine for the platform it will actually run on. A Windows .venv/Scripts/lithon.exe used to be picked up from inside WSL and then failed with a baffling "native runner not found at C:\...". A binary that cannot run here is now skipped, and the repo's cli.py is the last resort so a cloned-but-not-installed repo still works. * Re-execute the whole run inside WSL from Windows (--wsl / --no-wsl). The native tier is an x86-64 binary, CPython's loop speed differs under WSL, and CPU affinity only works on the Linux side -- so the only honest place to measure is a Linux kernel with both engines native. * Fix a truncated-frame bug in the recorder: a ~35 MB frame written through a BufferedWriter could reach ffmpeg short, and ffmpeg then aborted the encode with "Invalid buffer size". The pipe is now unbuffered, every write is checked for a short count, and ffmpeg's stderr is surfaced instead of a bare exit code. * Four new configs (fib_30, find_e, fsum_1b_simd, multi_ops_1b) and a README that explains the WSL flow and the new tree layout. web: * verify:docs wrote its examples as .py, which the frontend now refuses (LITHON-E0114: Lithon source files use the .lio extension), and 24 sourceRef/expectedRef paths still named .py files that are now .lio. Both fixed: 29 pages, 97 examples, 62 repo refs now verify against the real toolchain. * Regenerate the IR map (31 -> 48 blobs) and teach the JS IR interpreter the IR the engine emits today: print_bare/print_nl instead of print, band/bor/bxor instead of and/or/xor, fieldstore/fieldload, the guardnonzero trap, and tryenter/tryleave/trycatch. 44/44 documented outputs now match. * Document what the engine actually does: try/except over the built-in traps (the catchable set, the three refused shapes, and the tier-3 mapping), enumerate/zip, the string and list methods, and the full error-code table instead of three ranges. * Fix the broken bits: /contributors 404'd from the search palette and the sitemap; the sitemap and robots.txt disagreed with the app about the canonical origin; the PWA manifest was Create-TanStack-App boilerplate naming two icons that do not exist; static assets were fetched from the site root, which 404s under the GitHub Pages sub-path; the two Discord invite links disagreed. * Add the missing cross-links between doc pages. uv.lock / lithon.egg-info are regenerated build metadata.
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 Lithon test-code tree was reorganised into category folders, but the Python side was only half-migrated and the website still pointed at the old flat paths. This finishes the migration, makes the benchmark measure where the measurement is honest, and brings the docs back in line with the engine.
Three independent problems, one PR:
test_codes_lithon/had category subfolders,test_codes_python/had only two of them, and every config and website reference still used the old flat paths.lithon.exefrom inside WSL, then died with a baffling "native runner not found atC:\...".verify:docsfailed with 58 errors, the IR map was 5 commits out of date, and the docs documented atry/exceptthat had landed in the engine but was never written down.test_codes_python mirrors test_codes_lithon
Folder for folder, all seven categories:
Every
.lioprogram now has a.pytwin one folder away. Where CPython has no equivalent — raw pointers, packed structs, width annotations — the twin keeps the shape of the program and says so in its docstring. The three programs that are deliberately pinned failures on the Lithon side (DataTypes/check_strings.lio,Pointers/pointer_error.lio,Classes/class_basics.lio) are left exactly as they are: they are the record of what is missing, not bugs to be fixed.bench_vid_maker
Resolve the engine for the platform it will actually run on. A Windows
.venv/Scripts/lithon.exeused to be picked up from inside WSL and then failed with "native runner not found atC:\...". A binary that cannot run here is now skipped, and the repo'scli.pyis the last resort, so a cloned-but-not-installed repo still works.Re-execute the whole run inside WSL from Windows (
--wsl/--no-wsl, orBENCH_VID_MAKER_NO_WSL=1). The native tier is an x86-64 binary, CPython's loop speed differs under WSL, and CPU affinity only works on the Linux side — so the only honest place to measure is a Linux kernel with both engines native. This is not a convenience wrapper: the whole tool re-executes, so every number the UI reports is produced by a Linux process.Fix a truncated-frame bug in the recorder. A ~35 MB frame written through a
BufferedWritercould reach ffmpeg short, and ffmpeg then aborted the encode withInvalid buffer size, packet size N < expected frame_size M. The pipe is now unbuffered, every write is checked for a short count, and ffmpeg's stderr is surfaced instead of a bare exit code.Four new configs (
fib_30,find_e,fsum_1b_simd,multi_ops_1b) and a README that explains the WSL flow, the engine-resolution order, and the new tree layout.web
Verification works again.
verify:docswrote its examples as.py, which the frontend now refuses (LITHON-E0114: Lithon source files use the .lio extension), and 24sourceRef/expectedRefpaths still named.pyfiles that are now.lio. Both fixed.The IR map is current and the interpreter understands it. Regenerated (31 → 48 blobs), and the JS IR interpreter was taught the IR the engine emits today:
print_bare/print_nlinstead ofprint,band/bor/bxorinstead ofand/or/xor,fieldstore/fieldload, theguardnonzerotrap, andtryenter/tryleave/trycatch.The docs describe the engine that exists. Added
try/exceptover the built-in traps (the catchable set, the three deliberately-refused shapes, and the tier-3 trap→exception mapping),enumerate/zip, the string and list methods, and the full error-code table instead of three ranges. Every one of these was checked against the real engine first — in both tiers, not from the source.The broken bits are fixed:
/contributors404'd from the search palette and the sitemapSITEMAP_HOST, shared byseo.tsandgen-seo.tspublic/manifest.jsonwas Create-TanStack-App boilerplate naming two icons that do not existassetUrl()prefixes the deployment base pathAlso: the
.py→.liorename applied to every stale program path in prose and shell snippets, the duplicated search tags fixed, and the missing cross-links between doc pages added.Verification
All run from
web/:And in WSL, the benchmark runs both engines natively with identical output on both sides.
Notes for review
try/exceptsemantics documented here were verified by running the engine in both tiers (--interpand native), including the three shapes it refuses and the fact that a trap raised in a callee is not catchable by the caller.tools/typecheck.pyis a mirror of the older scalar-only static checks and does not know the container type language ortryyet; the examples that use them are markedtypecheck: falsewith a comment explaining why, exactly as the existing container examples are.uv.lockandlithon.egg-info/are regenerated build metadata, included because they were stale in the tree.