feat: warn on deprecated grammar values (kernel-removed AF families) (#467)#484
Open
SJrX wants to merge 1 commit into
Open
feat: warn on deprecated grammar values (kernel-removed AF families) (#467)#484SJrX wants to merge 1 commit into
SJrX wants to merge 1 commit into
Conversation
…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>
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.
What
A reusable valid-but-deprecated value mechanism, with
RestrictAddressFamilies=as the first user: typing a kernel-removed address family likeAF_DECnetnow gets a weak warning explaining it's obsolete — even though it's still a valid family name. Behind the experimental flag.How (generic, declarative)
TerminalCombinator.deprecationFor(token)— defaultnull; a terminal can report that a value it matched is accepted but obsolete.FlexibleLiteralChoiceTerminal.deprecating(map)— declarechoice -> reasonfluently.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 anInvalidValueerror.ConfigParseAddressFamiliesOptionValuemarksAF_DECnet/AF_IRDA/AF_ECONET/AF_WANPIPEdeprecated — still resolved byaf_from_name(the libc macro exists), but the kernel removed the protocol; reasons peraddress_families(7).DeprecatedGrammarValueAnnotator— flag-gated; aWEAK_WARNINGon 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 forAF_DECnet; nothing for current families; nothing for an invalid value (AF_DECnet AF_BOGUS).DeprecatedGrammarValueAnnotatorTest(e2e): weak warning onAF_DECnet; none on current families; none when the flag is off.Full suite green.
Refs #467
🤖 Generated with Claude Code