Repository navigation
Conversation
…eaks before they reach --help (#75) The allowlist-style branding lint from #67 accepts ALL `///` lines via the broad `rustdoc-comment mention (///)` rule — too many legitimate project-name mentions in rustdoc to enumerate. The trade-off: NEW user-visible `RTK` phrasings in clap doc comments silently slip through unless their exact phrasing already lives in FORBIDDEN_TOKENS. That's how `RTK savings`, `RTK adoption`, `RTK equivalent`, `RTK artifacts`, `RTK and native` (v0.1.7 round-3 sweep) all reached production before being caught. New test: `branding_lint_clap_doc_comments_fail_on_rtk`. Two-pass: 1. Pre-compute body line ranges of top-level structs/enums whose declaration carries a clap-derive (`Parser`/`Subcommand`/`Args`/ `ValueEnum`). Brace-depth-tracked. 2. For each `///` line containing `\brtk\b`, flag it if any of: a. Inside a clap-derived body (field-doc leak) b. Doc block precedes a `#[derive(...clap...)]` (struct-level help leak) c. Doc block precedes `#[arg|command|clap(...)]` (field-attr leak) Coherence with the existing allowlist: structural categories (PATH_NEEDLES, RTK_ENVISH_RE, ATTRIBUTION_NEEDLES, HOOK_PROTOCOL_NEEDLES, DOC_EXAMPLE_NEEDLES) still exempt — paths and env-var names are intentional cross-cutting concerns even when they appear in clap docs. The broad `///` blanket rule is explicitly NOT honored — that would defeat the whole test. Per-line `// branding-lint: allow legacy` escape hatch retained. 5 synthetic leak-simulation fixtures self-test the detector logic so a future weakening reopens the v0.1.8 regression class loudly. Current src/ violations: 0 (the only candidate at src/main.rs:670 was a `.rtk/filters.toml` path reference and exempts via PATH_NEEDLES coherence rule). cargo test --workspace: 2177 passed. Closes #75. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This was referenced May 26, 2026
Owner
Author
|
Closing as obsolete — the rtk/contextzip rebrand shipped (0.3.0 branding purge + 0.4.0 lib pivot). Branding-lint debt is no longer tracked. |
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.
Closes #75.
Summary
Adds
branding_lint_clap_doc_comments_fail_on_rtk— a 5th test intests/branding_lint.rsthat closes the known weakness of the broadrustdoc-comment mention (///)allowlist rule from #67.The existing allowlist accepts ALL
///lines. That trade-off (hundreds of legitimate project-name mentions vs. the cost of per-line markers) meant NEWRTKphrasings in clap doc-comments (which become--helpoutput) silently slipped through unless their exact wording already lived inFORBIDDEN_TOKENS. The v0.1.8 cycle paid for that with 3 hotfix rounds —RTK savings,RTK adoption,RTK equivalent,RTK artifacts,RTK and native.Approach
Two-pass detector:
.rsfile finding top-level struct/enum spans whose declaration carries#[derive(... Parser|Subcommand|Args|ValueEnum ...)]. Brace-depth tracked.///-line scan — for each///line containing\brtk\b:#[derive(...clap...)](struct top-level help leak)#[arg(...)],#[command(...)], or#[clap(...)](field-attr leak — catches fields whose enclosing struct is across module boundaries)Coherence with the existing allowlist
Structural categories that already justify
rtkreferences —PATH_NEEDLES(e.g..rtk/filters.toml),RTK_ENVISH_RE(e.g.RTK_DB_PATH),ATTRIBUTION_NEEDLES,HOOK_PROTOCOL_NEEDLES,DOC_EXAMPLE_NEEDLES— also exempt here. The broad///blanket rule is explicitly not honored (would defeat the test).The per-line
// branding-lint: allow legacyescape hatch works.Self-test
5 synthetic leak-simulation fixtures embedded in the test exercise the detector logic — 3 must-flag (clap-derive top-level docstring, field-attr precede, in-clap-body field) and 2 must-not-flag (doc above
pub fn, doc above non-clap struct). Catches the case where someone weakens the heuristic and silently reopens the v0.1.8 regression class.Current state
0 violations in
src/(the only candidate atsrc/main.rs:670is a.rtk/filters.tomlpath reference and exempts via PATH_NEEDLES coherence).Test plan
cargo test --test branding_lint— 5 passedcargo test --workspace— 2177 passed, 6 ignored🤖 Generated with Claude Code