Skip to content

progress_dashboard: --svg draws the panels as one picture for the README - #4124

Open
leozinhoszg wants to merge 4 commits into
ItsNotRexed:mainfrom
leozinhoszg:progress-svg
Open

leozinhoszg wants to merge 4 commits into
ItsNotRexed:mainfrom
leozinhoszg:progress-svg

Conversation

@leozinhoszg

Copy link
Copy Markdown
Contributor

Claimed in the coordination issue as: #4084 (comment)

What and why

--svg <file> writes the dashboard's panels as one SVG for the README: one treemap per panel (squarified groups, one cell per unit coloured by status; the corpus as areas by count), the panel's first ratio in its title, a legend, and the commit and date in the footer. It holds panel titles, group names and counts only, never a unit's name or detail, so it is the one output allowed inside the repository. CI on main is left out: five cells that change with every run.

Runs of one status in a row are one <rect> and a pattern draws the cell edges, so the file is about 30 KB. docs/progress.svg is one run on this branch's parent (Windows 11, unit tests run, corpus counts from my own work folder); the README shows it under the status table. It is not in assets/: that folder's .gitignore keeps everything but the logo out.

Tested

Windows 11, Python 3.13, no GPU needed:

  • python -I tests/test_progress_dashboard.py: 28 tests OK. Two are new: the SVG is well-formed XML with the ratio in the panel title and no unit name or detail (a sentinel name is checked), and it is deterministic with one rectangle per status run.
  • test_docs_links, test_docs_repo_paths, test_docs_list_items, test_docs_cli_flags, test_docs_table_rows, test_docs_design_rows, test_docs_python_deps, test_text_write_line_endings, test_tool_stdout_encoding, test_tool_startup and test_csv_line_endings pass; scripts/check_no_game_data.py passes; compileall is clean.

AI-assisted (Claude Code).

Checklist

  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. The SVG carries counts and group names only.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (Not applicable: no translator change.)

--svg <file> writes the same panels as one static SVG: one treemap per panel,
groups laid out as on the page (squarified), one cell per unit coloured by
status, the corpus panel as areas by count, the panel's first ratio in its
title, a legend, and the commit and date in the footer. Runs of one status in a
row are one rectangle and a pattern draws the cell edges, so the file stays
about 30 KB. It holds panel titles, group names and counts only (never a unit's
name or detail), so it is the one output allowed inside the repository. CI on
main is left out: five cells that change with every run.

docs/progress.svg is one run on this commit's parent (Windows 11, tests run,
corpus counts from the author's own work folder) and the README shows it
under the status table. assets/ is not used: its .gitignore keeps everything
but the logo out.

@Kam471 Kam471 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran this at a6ea60b4 on Windows 11: python -I tests/test_progress_dashboard.py -> 28 tests, OK; compileall and git diff --check clean.

The new SVG renderer uses only panel titles, group names, counts/ratios and status colours; component names are used for ordering only and never emitted, and the footer carries the commit/date. All text passes through the XML escaper, the layout is deterministic for a snapshot, and the existing dashboard tests still pass. No blocking issue.

@tupacfan04

Copy link
Copy Markdown
Contributor

Tested at the head (a6ea60b4) on Windows 11 / Python 3.13.0: 28/28 tests (2 new), compileall, docs links/repo paths/CLI flags and check_no_game_data pass, merge clean. Negative control: main's tool errors with no attribute 'render_svg'.

The SVG is produced from the same snapshot as the page (render_svg(snap)), empty panels give a valid 665-byte SVG, writes go through the atomic save_text (tmp + os.replace), an injected render_svg failure leaves the old file intact, and the committed docs/progress.svg parses (820x1289) with no user paths.

Notes:

  • --svg bypasses the inside() guard (progress_dashboard.py:1119), so it will overwrite any file it is pointed at.
  • snap["generated_at"] raises KeyError if absent (:1062).
  • The GPU-log group labels (:487) can leak machine details despite the "nothing from the machine" comment (:907).
  • No empty-data test.

Approve with those. AI-assisted review, no game files, no GPU.

@Proudnoob4

Copy link
Copy Markdown
Contributor

Game-copy check of a6ea60b4: pass. Windows 10 22H2, Python 3.13.0, CPU only, with my own 1.0.2.1 work folder. This adds a real --work run to Kam471's and tupacfan04's checks.

  • Runs on another work folder. python -I tools/progress_dashboard.py --out <temp> --work <work> --svg <temp>/progress.svg, without --run-tests or --github, exits 0 with 223 units. The SVG is well-formed and about 8 KB, with the three panels this run has: contract 104/194, imports 8/8, corpus 26,503/26,503. The first two are the same as in your docs/progress.svg.
  • No names or paths. I searched our SVG, progress.html, the snapshot JSON, history.json and the committed docs/progress.svg for every one of the 26,503 carved shader names in my index.json, for their 8-hex ids, and for fragments of my work-folder and game-folder paths. Every file has 0 hits.
  • Same package. The committed SVG's corpus denominator is 26,503, the same as mine (ps 12,101, ms 9,282, cs 2,689, vs 2,236, gs 195). The numerator depends on each person's translation run (yours 26,501, mine 26,503), as the panel title says.
  • Deterministic. Rendering the saved snapshot twice with render_svg gives identical text, and it is identical to the SVG the run wrote.

Counts only; nothing from the game leaves my machine.

AI-assisted.

… files

Review notes from tupacfan04 on a6ea60b:

- --svg may point inside the repository, so a mistyped path could overwrite a
  script or a document. It now takes only a name ending in .svg, refuses a
  folder, and replaces an existing file only when that file is already an SVG
  (exit 2 before anything is collected).
- The footer no longer needs generated_at: a snapshot without it still draws.
- The comment and docs/progress_dashboard.md said nothing from the machine
  reaches the picture; group names come from the data, and for the GPU panel
  that is the --gpu-log label (or the log's file name). Both now say so.
- New tests: an empty snapshot (no panels, or a panel with no units) is a valid
  SVG; the target check refuses a .py file, a non-SVG .svg and a folder, and the
  command line leaves a refused file untouched.
@lunarminus

Copy link
Copy Markdown

Tested 6bf40046 on CachyOS Linux, Python 3.14, with my own 1.0.2.1 work folder (make_game.py --stages check,shaders at aa2988cc): pass.

  • python -I tests/test_progress_dashboard.py: OK.
  • progress_dashboard.py --out <scratch> --work <work> --gpu-log <run_gpu_tests log>=... --svg <scratch>/progress.svg: exit 0, 225 units and 4 metrics. The SVG parses as XML (122 elements, 8.3 KB). It's smaller than your 30 KB because I ran without --run-tests and --github.
  • No names leak: none of the 26,503 shader names in my carve appears in the SVG, and none appears in progress.html either.
  • The new commit's refusals work:
    • --svg x.txt exits 2: "the file name must end in .svg".
    • An existing .svg that is not an SVG exits 2: "exists and is not an SVG; refusing to overwrite it". The file is left untouched.

AI-assisted (Claude Code).

@Proudnoob4

Copy link
Copy Markdown
Contributor

Rechecked 6bf40046 on Windows 10: all 30 dashboard tests pass. One gap in the new overwrite guard (tools/progress_dashboard.py:1003): svg_target_problem accepts a generic XML document with a non-SVG root if it has an XML declaration and an .svg filename. I checked the predicate on disposable files, without running the output writer: genuine SVG accepted, plain text rejected, non-SVG XML accepted. Since the intent is to replace only existing SVGs, could the guard check the XML root element and add a non-SVG XML regression test?

@leozinhoszg

Copy link
Copy Markdown
Contributor Author

@tupacfan04 thanks for the check and the notes. All four are addressed in 6bf4004:

  • --svg and inside(): it still may point inside the repository (that is where docs/progress.svg lives), but it now takes only a name ending in .svg, refuses a folder, and replaces an existing file only when that file is already an SVG. A refused target exits 2 before anything is collected.
  • generated_at: the footer no longer needs it; a snapshot without it still draws.
  • GPU labels: right, group names come from the data, and for the GPU panel that is the --gpu-log label (or the log's file name). The comment and docs/progress_dashboard.md now say so instead of "nothing from the machine".
  • Empty data: new tests check that an empty snapshot (no panels, or a panel with no units) is a valid SVG, and that the target check refuses a .py file, a non-SVG .svg and a folder, with the command line leaving a refused file untouched.

tests/test_progress_dashboard.py now runs 30 tests, all passing; dropping the target check from the command line fails the new test.

…is <svg>

The guard took any file that opened with <?xml, so an XML document with another root and a .svg name could be
overwritten. It now skips the prolog (XML declaration, processing instructions, comments, a DOCTYPE with or
without an internal subset, a UTF-8 BOM) and needs the first element to be svg, with or without a namespace
prefix. A table test covers SVGs that must pass and XML/HTML/empty files that must be refused.
@leozinhoszg

Copy link
Copy Markdown
Contributor Author

@Proudnoob4 good catch, fixed in 2f15723.

svg_target_problem now skips the prolog (UTF-8 BOM, XML declaration and other processing instructions, comments, a DOCTYPE with or without an internal subset) and requires the first element to be svg, with or without a namespace prefix. It reads the first 4 KiB instead of 256 bytes, so a long comment or DOCTYPE before the root still works.

New test test_svg_target_checks_the_root_element: accepted cases are a plain SVG, one with a declaration, with a BOM, with comment + DOCTYPE, with an internal subset, and <svg:svg>. Refused cases are XML with another root, HTML, <svgfont>, a declaration with no element, and an empty file. With the old guard the same test fails 5 of its cases (3 non-SVG files accepted, and BOM / internal-subset SVGs refused).

Tested on Windows 11, Python 3.14: python -I tests/test_progress_dashboard.py gives 31 OK, plus compileall and git diff --check.

@lunarminus

Copy link
Copy Markdown

Re-checked 2f15723d with my own 1.0.2.1 work folder, CachyOS Linux, Python 3.14: pass.

  • python -I tests/test_progress_dashboard.py: OK.
  • Real run: progress_dashboard.py --out <scratch> --work <work> --svg <scratch>/progress.svg exits 0 (225 units, 4 metrics). The SVG parses, its root element is svg, and its corpus panel reads "Shader corpus (your own run; counts only): 99.69% (26,422/26,503)".
  • The new root-element rule:
    • Re-running onto the SVG written above replaces it (exit 0).
    • A .svg file holding an HTML document is refused (exit 2) and left untouched.
    • A truncated file starting <svg that isn't well-formed is refused (exit 2).

AI-assisted (Claude Code).

@sovljanskii

sovljanskii commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Checked 2f15723d (merged onto main 3faac557, clean) on macOS, Apple M4, with Python 3.15.2 and 3.12.16: pass. lunarminus already covered the real run and the root-element rule at this head. What's new here is a mutation pass, and a check that the SVG's numbers match the snapshot the page is drawn from.

Tests: tests/test_progress_dashboard.py passes 31 OK on both Python versions.

Mutations of render_svg / svg_target_problem: the tests catch 7 of 8.

  • Caught:
    • the ratio dropped from the panel title;
    • one <rect> per cell instead of per status run;
    • a unit name leaking into a group label;
    • an existing non-SVG file accepted;
    • a group count off by one;
    • numerator and denominator swapped;
    • the prolog skip removed (an XML declaration before <svg> gets refused).
  • Not caught: sorting a group's cells by name only, dropping SVG_ORDER[c["status"]] from the key (tools/progress_dashboard.py:1038). The colours then interleave, and the run-merging that keeps the file small (each run still gets its own <rect>) stops paying off, but every test still passes. Non-blocking; a test asserting that a group's statuses are non-decreasing in SVG_ORDER would pin it.

Real run on my own 1.0.2.1 work folder: --out <scratch> --work <work> --svg <scratch>/progress.svg exits 0 with 240 units, 4 metrics and writes an 8,303-byte SVG.

  • xml.etree parses it, and the root is svg.
  • Titles: each of the 3 drawn panel titles matches the snapshot's first metric for that panel exactly, value and numerator/denominator. The corpus panel reads 26,118/26,503. I recounted that pair straight from shaders/dxbc/index.json and shaders/spirv/index.json, and it matches.
  • Skipped panels: the 3 panels that aren't drawn have no units in this run (no test or GPU log passed), so skipping them is right.
  • Group labels: 9 of the 15 group labels carry a count, and every one equals the snapshot's group size. The other 6 are truncated to fit their cell, so they show no count.
  • No leaks: no unit name or detail string from the snapshot appears in the SVG. The footer holds only the tool name, the date and the commit.
  • Weights: weight or 1 matches the page (progress_dashboard.html:258), and weights are only set when positive (progress_dashboard.py:660-666), so the areas agree with the HTML.

AI-assisted.

@Jadiac5

Jadiac5 commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Tested 2f15723 on Windows 11, AMD Radeon RX 9070 XT (RDNA4), driver 32.0.32029.2010 (CPU only, Python 3.12.10, with my own built work folder): pass

  • python -I tests/test_progress_dashboard.py: 31 tests OK. compileall clean.
  • Same command line on the head and on the merge base aa2988c: python -I tools/progress_dashboard.py --out <scratch> --work <my work folder>. Both exit 0 in 9 s and print "223 units, 4 metrics". Components, metrics and panels in the two snapshot JSON files are equal (the generated timestamp left out). progress.html is 680,512 bytes in both.
  • The same line plus --svg <scratch>/progress.svg: exit 0 in 10 s. The file is 8,074 bytes, parses as XML, has viewBox 820x537 and 71 rects. The HTML is again 680,512 bytes. The corpus panel reads 26,503 of 26,503 on my folder, against 26,501 of 26,503 in the committed docs/progress.svg, as expected for a different work folder.
  • Overwrite guard, each with --svg: an existing file holding <html><svg></svg></html> exits 2 "exists and is not an SVG"; an XML file with a <note/> root exits 2, same message; a.txt exits 2 "must end in .svg"; a folder named dir.svg exits 2 "is a folder"; new/sub/p.svg exits 0 and creates the folders. The refused files are unchanged.
  • Found, minor: 12 text labels in the committed docs/progress.svg end in an ellipsis (the cut is _fit_label, tools/progress_dashboard.py:974), and the file has no per-cell tooltip (one <title>, the root). In the README picture the cut text cannot be read.
  • Not done: other platforms (lunarminus on Linux and sovljanskii on macOS already ran this head), --github, --gpu-* options.
  • Head rechecked at the end: 2f15723, unchanged.

AI-assisted (Claude Code).

# Conflicts:
#	tests/test_progress_dashboard.py
#	tools/progress_dashboard.py
@leozinhoszg

Copy link
Copy Markdown
Contributor Author

Merged origin/main in 15cb9be to clear the conflict with the dashboard PRs that landed since (#4515, #4492, #4442 and others):

  • main(): the --svg target check and main's --run-tests / --tests selection check are both kept. The SVG check comes first, so a refused --svg still exits 2 before anything is collected.
  • tests/test_progress_dashboard.py: both new imports kept (unittest.mock from main, xml.etree.ElementTree from this branch).

On Windows 11, Python 3.14: python -I tests/test_progress_dashboard.py gives 43 OK (this branch's 31 plus main's new ones). compileall, git diff --check, test_docs_links, test_docs_cli_flags and test_check_no_game_data all pass. A --out <scratch> --svg <scratch>/p.svg run exits 0 and writes a well-formed SVG.

@Jadiac5 thanks for the check at 2f15723. The only change since is this merge.

@Proudnoob4

Copy link
Copy Markdown
Contributor

Re-checked the merge 15cb9be6 with my own 1.0.2.1 work folder: pass. Windows 10, Python 3.13.0.

  • Tests. python -I tests/test_progress_dashboard.py: 43 OK.
  • Real run. --out <temp> --work <work> --svg <temp>/progress.svg exits 0 with 256 units. The SVG is well-formed. Rendering the saved snapshot twice gives identical text, identical to the file the run wrote.
  • No names or paths. I checked the SVG, progress.html, the snapshot JSON, history.json and the committed docs/progress.svg. None contains any of my 26,503 carved shader names, their 8-hex ids, or a fragment of my work-folder or game-folder paths.
  • Before merging, maybe: the committed docs/progress.svg is still the aa2988cc run, and its contract panel says 104/194. The same panel at 15cb9be6 says 111/227, since docs/design.md has grown, so the README picture now lags the code. Regenerating it would bring it up to date.

AI-assisted; counts only.

@leozinhoszg

Copy link
Copy Markdown
Contributor Author

@Proudnoob4 thanks for re-checking the merge with your work folder, and for the names/paths sweep across all the outputs.

On docs/progress.svg: right, it's the aa2988cc run. The picture is a dated snapshot, and its footer carries the commit and date it was drawn from, so it falls behind main as docs/design.md grows. That's expected, not a mismatch in the code. Regenerating it properly needs a run with a work folder, otherwise the corpus and imports panels drop out. Without one, only the contract panel would update. That refresh can be its own small change and doesn't need to hold this PR, whose point is the --svg renderer and its overwrite guard.

@kapitche

Copy link
Copy Markdown
Contributor

Tested 15cb9be merged with main 561b65a on Linux (WSL2), CPython 3.12.16, CPU only: pass.

  • tests/test_progress_dashboard.py: 43/43. progress_dashboard.py --out <tmp> --svg <tmp>/x.svg runs and writes an SVG (7 KB for my checkout; the committed docs/progress.svg is 29 KB).
  • Negative control: with main's tools/progress_dashboard.py the new test file gives errors=15.
  • Notes: the committed SVG is a snapshot (its PR panel says 2,428/3,597 merged), so it goes stale by design. Its only names (import-library names in the runtime-imports group) already appear in docs/ on main.

@TheAirborneCoder

Copy link
Copy Markdown
Contributor

Tested 15cb9be on Windows 11, Python 3.14, with my own 1.0.2.1 copy (all 108 files match game/xbox-1.0.2.1.json in size and SHA-256): pass. test_progress_dashboard 43 OK plus 11 companion tests. A real run against my work folder with --svg gives 256 units and a well-formed SVG; the committed docs/progress.svg parses and holds only counts and group names. CPU only. AI-assisted (Claude Code).

benthomashull-commits added a commit to benthomashull-commits/Leonida that referenced this pull request Nov 23, 2026
… one picture for the README

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

9 participants