Skip to content

fix(cli): emit parseable suppress tokens in every human footer section#1835

Merged
BartWaardenburg merged 1 commit into
mainfrom
fix/issue-1828-footer-suppress-tokens
Jul 13, 2026
Merged

fix(cli): emit parseable suppress tokens in every human footer section#1835
BartWaardenburg merged 1 commit into
mainfrom
fix/issue-1828-footer-suppress-tokens

Conversation

@BartWaardenburg

Copy link
Copy Markdown
Collaborator

The human footer's suppress hints came from a hand-maintained token list that had drifted from the suppression parser: eight sections printed tokens IssueKind::parse does not recognize (config keys or plurals with no registered alias), so following the printed hint suppressed nothing and then surfaced a stale-suppression finding on top.

The mapping is now derived from the issue registry: one section-title-to-IssueKind map remains hand-maintained, and the printed token plus the file-level hint form come from each kind's registry row, so the hint can never drift from what the parser accepts. Consequences beyond the eight broken tokens: the dependency sections print no hint anymore (their findings live in package.json, where inline comments cannot exist), circular-dependency and boundary-violation hints corrected from file-level to next-line and duplicate-export from next-line to file-level (all three registry-mandated and verified against the detectors), and alias-form tokens normalized to the canonical singular (existing user comments with the plural aliases keep parsing).

A roundtrip guard test now asserts every emittable token parses and uses the registry's file-level form, so this bug class cannot ship again.

Fixes #1828

Validated end-to-end with the built binary: the new hints suppress their findings with zero stale-suppression fallout; the old tokens reproduce the reported bug (nothing suppressed, two stale findings).

section_suppress_rule in the human report emitted hardcoded token strings that
fallow_types::suppress::parse_suppression_target did not recognize for eight
sections (unused-exports, unused-types, unused-dependencies, unused-enum-members,
unused-class-members, unresolved-imports, unlisted-dependencies, duplicate-exports):
the strings existed only as config keys or MCP names, never as IssueKind codes or
aliases. Following the printed hint produced a comment that suppressed nothing and
then surfaced a stale-suppression finding.

Derive each section's token from the issue registry instead. A section-title to
IssueKind map feeds issue_kind_to_kebab (the kind's suppress_token, falling back
to its code), so the emitted token always parses back to the same kind.
is_file_level_only is likewise derived from the registry's suppress_file_level
flag, fixing two drifts: duplicate-export (file-level-only per its detector) now
prints the file-level form, and circular-dependency / boundary-violation (which
honor next-line suppression) now print the next-line form. Dependency sections
whose findings live in package.json emit no hint rather than a token pointing at
an impossible inline comment.

A roundtrip guard test asserts every token section_suppress_rule can emit parses
via parse_suppression_target and uses the file-level form exactly when the
registry marks the kind file-level-only, so this surface stays locked down.

Fixes #1828
@BartWaardenburg BartWaardenburg merged commit ab61b40 into main Jul 13, 2026
18 checks passed
@BartWaardenburg BartWaardenburg deleted the fix/issue-1828-footer-suppress-tokens branch July 13, 2026 08:51
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.

Human footer suggests suppress tokens that IssueKind::parse does not recognize for eight sections

1 participant