docs(i18n): drop the stale per-update count log from the gate comment - #180
Merged
Conversation
`src/i18n_pack.rs`'s positive-control comment block described "本次更新" with the numbers of the release that wrote it (the sharing 本月新增 card: 783 -> 786 keys, 531 -> 535 call sites, 426 -> 429 distinct) while the six constants directly beneath it read 785 / 785 / 330 / 305 / 537 / 430. C2015 wrote that narrative and C2019 moved the constants to 785/537/430 without touching it, so the comment has contradicted its own code for two commits. Why it survived: only the comment was wrong. The constants are internally consistent, so `cargo test` stayed green throughout — there is no assertion on prose. Fix: delete the per-update narrative and keep only the orientation-independent rule (calibrate against the extractor's real output, never hand-compute), which cannot rot. Each cycle's delta belongs to the commit history (`git log -p src/i18n_pack.rs`), not to a copy maintained in the file. The replacement block deliberately contains no "old -> new" notation: in this position that notation reads as an assertion about the current value, and the constants below are the only authority for that. (Writing the clean-up this way first re-created the confusion it removes — the checker flagged the fix itself.) Also records which set T_LITERAL_COUNT counts: it is the T() call-site total, neither the key count nor the distinct count (three different sets). Comment-only change: src/i18n_pack.rs is a #[cfg(test)]-only module, so no production behaviour changes and no constants move. 165 tests pass. Co-authored-by: argszero <argszero@argszerodeMac-mini.local>
10 tasks
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
Fix a doc comment that contradicts the constants directly beneath it.
src/i18n_pack.rskeeps six positive-control constants for the language-pack gate. The comment block above them described "本次更新" — the update that wrote it — with that release's numbers:but the constants eleven lines below read:
C2015 wrote that narrative while setting 786/538/431; C2019 moved the constants to 785/537/430 and did not touch the prose. So for two commits the file has asserted two different "current" key counts, one line apart.
Why it survived: only the comment was wrong. The constants are internally consistent (the gate's own asserts pass), so
cargo teststayed green — nothing asserts on prose. The stale half is the half a reader trusts when deciding what number to write next.Changes
ZH_KEY_COUNTcomment block.git log -p src/i18n_pack.rs, instead of a copy maintained in the file.T_LITERAL_COUNTcounts (theT()call-site total — neither the key count nor the distinct count; three different sets, pitfall 99).src/i18n_pack.rsis a#[cfg(test)]-only module, so no production behaviour changes and no constant moves.The replacement block deliberately contains no "old → new" notation. In this position that notation reads as an assertion about the current value, and the constants below are the only authority for that — the first attempt at this cleanup re-created exactly the confusion it removes, which the checker below caught.
Related Issue
No issue exists for this — found by sweeping Rust doc comments for checkable claims. Left empty rather than fabricating a reference.
Tests
cargo test— 165 passed / 0 failedcargo fmt --check— cleancargo clippy --all-targets -- -D warnings— clean, 0 warningsThe checker extracts every
N -> Mprogression from the comment block above the constants and asks whether the right-hand side matches any constant. It is discriminating, not merely green:--source HEAD(before)--self-test--self-testmatters here: after the fix the real corpus is empty, so "0 mismatches" would otherwise be vacuously green (an always-passing check carries no information). The self-test injects a synthetic claim and asserts it is detected, proving the checker can still fail.No unit test added: this is a comment-only fix with no behaviour to assert, and the repo deliberately carries no doc-linting toolchain (same call as #178 and #179).
Checklist
docs/)docs(i18n):— scope is the module changed)