Skip to content

feat: warn on deprecated grammar values (kernel-removed AF families) (#467)#484

Open
SJrX wants to merge 1 commit into
issue-345-14from
issue-345-15
Open

feat: warn on deprecated grammar values (kernel-removed AF families) (#467)#484
SJrX wants to merge 1 commit into
issue-345-14from
issue-345-15

Conversation

@SJrX

@SJrX SJrX commented Jun 21, 2026

Copy link
Copy Markdown
Owner

What

A reusable valid-but-deprecated value mechanism, with RestrictAddressFamilies= as the first user: typing a kernel-removed address family like AF_DECnet now gets a weak warning explaining it's obsolete — even though it's still a valid family name. Behind the experimental flag.

Stacked on #483 (issue-345-14). This is the deprecation-annotator follow-up we'd flagged in #467.

How (generic, declarative)

  • TerminalCombinator.deprecationFor(token) — default null; a terminal can report that a value it matched is accepted but obsolete.
  • FlexibleLiteralChoiceTerminal.deprecating(map) — declare choice -> reason fluently.
  • Combinator.deprecatedTokens(value) — from the first fully-valid parse, the tokens whose terminal reports a deprecation (with spans). It requires a valid parse, so a deprecation never stacks on top of an InvalidValue error.
  • ConfigParseAddressFamiliesOptionValue marks AF_DECnet / AF_IRDA / AF_ECONET / AF_WANPIPE deprecated — still resolved by af_from_name (the libc macro exists), but the kernel removed the protocol; reasons per address_families(7).
  • DeprecatedGrammarValueAnnotator — flag-gated; a WEAK_WARNING on each deprecated token's exact span.

Because it's declarative on the terminal, any future enumerated option can mark choices deprecated and get the same treatment for free.

Tests

  • DeprecationsTest (unit): exact span + message for AF_DECnet; nothing for current families; nothing for an invalid value (AF_DECnet AF_BOGUS).
  • DeprecatedGrammarValueAnnotatorTest (e2e): weak warning on AF_DECnet; none on current families; none when the flag is off.

Full suite green.

Refs #467

🤖 Generated with Claude Code

…467)

A reusable valid-but-deprecated mechanism, with RestrictAddressFamilies= as the first
user. Behind the experimental flag.

- TerminalCombinator.deprecationFor(token): default null; a terminal can report that a
  value it matched is accepted but obsolete.
- FlexibleLiteralChoiceTerminal.deprecating(map): declare choice -> reason.
- Combinator.deprecatedTokens(value): from the first fully-valid parse, the tokens whose
  terminal reports a deprecation (with spans). Only fires when the value is otherwise
  valid, so it doesn't stack on an InvalidValue error.
- ConfigParseAddressFamiliesOptionValue: marks AF_DECnet/AF_IRDA/AF_ECONET/AF_WANPIPE
  deprecated (still resolved by af_from_name, but the kernel removed the protocol;
  reasons per address_families(7)).
- DeprecatedGrammarValueAnnotator: flag-gated WEAK_WARNING on each deprecated token.

Tests: span/message and not-on-current-or-invalid (unit); end-to-end weak warning on
AF_DECnet, none for current families or when the flag is off.

Refs #467

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Test Results

1 148 tests  +6   1 148 ✅ +6   47s ⏱️ +2s
  305 suites +2       0 💤 ±0 
  305 files   +2       0 ❌ ±0 

Results for commit 4f8ac0f. ± Comparison against base commit 99723b8.

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.

1 participant