docs/env.md: every VICTORY_* switch, generated by cargo xtask env; warn on unknown ones #83

Open
github-bot wants to merge 2 commits from github-bot/gh-83 into main AGit
Owner

@⁠lcg007xd-c on GitHub · 2026-11-25 22:08 UTC · original
lcg007xd-c:docs/victory-env-registry → main · +505 −1 · 7 files · 2 commits · open

What

The code reads 256 VICTORY_* environment switches. The README, the other docs and victory.example.toml describe 54 of them (issue #1 points at the undocumented ones). There was no list, so nothing tells a user that a switch is spelled wrong or has been renamed. It just does nothing.

  • cargo xtask env writes docs/env.md. It lists every VICTORY_* name that appears as a whole string literal in the Rust source, the files that read it, and whether the hand-written docs describe it. The table doesn't try to describe each switch. It shows where to look, and which ones still need writing up.
  • A test watches the table. When the table is stale, env_table_is_current prints a warning naming the command that fixes it, and passes. With VICTORY_STRICT_TESTS=1 (the switch the shader test skips use) it fails. cargo xtask env --check always fails on a stale table.
  • victory-core reads the table back. At logging setup, every binary now warns about a set VICTORY_* variable that isn't in the table, for example: warning: VICTORY_RELAYS is set but is no known switch (docs/env.md): a typo?.

Friction

A PR that adds a switch without rerunning cargo xtask env only gets a test warning. No one's PR goes red over it. Until the table is regenerated, the startup warning also names that new switch, and its wording ("a typo?") allows for that.

Tests

  • env_table_is_current, plus only_whole_literals_count: "VICTORY_X" counts, but a message that starts with the prefix doesn't.
  • the_table_lists_the_log_filter and unknown_names_with_the_prefix_are_reported in victory-core.
  • I checked the table against a plain git grep of quoted VICTORY_ names: the two lists are identical. A CRLF checkout of the table still passes. With one row removed, the test warns by default and fails when strict.
  • The portable CI commands and Windows-target clippy (--target x86_64-pc-windows-msvc) pass locally.

Not tested: the warning when running the real binary on Windows. It's one eprintln! in logging::init, which every binary calls.

🤖 Generated with Claude Code

**@⁠lcg007xd-c** on GitHub · 2026-11-25 22:08 UTC · [original](https://github.com/uiliannn/VItoriaBr/pull/83) `lcg007xd-c:docs/victory-env-registry` → `main` · +505 −1 · 7 files · 2 commits · open ## What The code reads 256 `VICTORY_*` environment switches. The README, the other docs and `victory.example.toml` describe 54 of them (issue #1 points at the undocumented ones). There was no list, so nothing tells a user that a switch is spelled wrong or has been renamed. It just does nothing. - **`cargo xtask env` writes `docs/env.md`.** It lists every `VICTORY_*` name that appears as a whole string literal in the Rust source, the files that read it, and whether the hand-written docs describe it. The table doesn't try to describe each switch. It shows where to look, and which ones still need writing up. - **A test watches the table.** When the table is stale, `env_table_is_current` prints a warning naming the command that fixes it, and passes. With `VICTORY_STRICT_TESTS=1` (the switch the shader test skips use) it fails. `cargo xtask env --check` always fails on a stale table. - **victory-core reads the table back.** At logging setup, every binary now warns about a set `VICTORY_*` variable that isn't in the table, for example: `warning: VICTORY_RELAYS is set but is no known switch (docs/env.md): a typo?`. ## Friction A PR that adds a switch without rerunning `cargo xtask env` only gets a test warning. No one's PR goes red over it. Until the table is regenerated, the startup warning also names that new switch, and its wording ("a typo?") allows for that. ## Tests - `env_table_is_current`, plus `only_whole_literals_count`: `"VICTORY_X"` counts, but a message that starts with the prefix doesn't. - `the_table_lists_the_log_filter` and `unknown_names_with_the_prefix_are_reported` in victory-core. - I checked the table against a plain `git grep` of quoted `VICTORY_` names: the two lists are identical. A CRLF checkout of the table still passes. With one row removed, the test warns by default and fails when strict. - The portable CI commands and Windows-target clippy (`--target x86_64-pc-windows-msvc`) pass locally. Not tested: the warning when running the real binary on Windows. It's one `eprintln!` in `logging::init`, which every binary calls. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
`cargo xtask env` writes docs/env.md: each VICTORY_* variable named in a
string literal of the Rust source (256 today), the files that read it,
and whether the README, the other docs or victory.example.toml describe
it (54 do). A test fails when the table is out of date, naming the
command that regenerates it; `cargo xtask env --check` does the same.

victory-core reads the table back: at logging setup every binary prints
a warning for a set VICTORY_* variable that nothing reads, which is
usually a typo or a switch that has since been renamed and otherwise
does nothing, silently.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A PR that adds a switch would otherwise fail its tests until it reruns
`cargo xtask env`. The test now prints a warning and passes, and fails
with VICTORY_STRICT_TESTS=1 (as the shader tests' skips do);
`cargo xtask env --check` still fails on a stale table.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:43:31 +00:00
This pull request has changes conflicting with the target branch.
  • xtask/src/main.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/83/head:github-bot/gh-83'
git switch 'github-bot/gh-83'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-83'
git switch 'github-bot/gh-83'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-83'
git switch 'github-bot/gh-83'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-83'
git switch 'main'
git merge --squash 'github-bot/gh-83'
git switch 'main'
git merge --ff-only 'github-bot/gh-83'
git switch 'main'
git merge 'github-bot/gh-83'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.