Skip to content

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

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

leozinhoszg wants to merge 2 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.

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.

5 participants