feat: add 6 validators (batch 2/5) - cpu_quota, htb_class_size, delegate, syscall_errno, address_families, pass_environ#447
Merged
Conversation
…_errno, address_families, pass_environ (Resolves #446) Batch 2/5 of the burn-down extension. Each grammar mirrors the systemd C parser: - config_parse_cpu_quota: parse_permyriad_unbounded, percent form unbounded (200% valid) - config_parse_htb_class_size (TCLASS_KIND_HTB): IEC byte size, same shape as tbf_size/fq_size - config_parse_delegate: boolean OR whitespace-separated cgroup controller names - config_parse_syscall_errno: "kill" OR errno name (E*) OR integer - config_parse_address_families: "none" OR optional ~ + list of AF_* names - config_parse_pass_environ: list of env var names (specifier-aware) Note for future validators: when an Alternative contains both a FlexibleLiteralChoiceTerminal (like BOOLEAN) and a more specific structured branch, put the structured branch first. FlexibleLiteralChoice's syntactic phase accepts any short alphanumeric token in its character class, so a single-token input like "cpu" would syntactically pass BOOLEAN and AlternativeCombinator would short-circuit before reaching the structured branch. OptionValueTest missing-function count drops 394 -> 388; found-key count rises 1780 -> 1812. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4 tasks
SJrX
added a commit
that referenced
this pull request
May 23, 2026
…etwork_interfaces, bind_network_interface, working_directory, unit_env_file (Resolves #448) (#449) Batch 3/5 of the burn-down extension. Each grammar mirrors the systemd C parser: - config_parse_private_users (.nspawn): boolean | "pick" | "identity" | uid[:range] - config_parse_managed_oom_rules: list of filename-safe rule names (string_is_safe STRING_FILENAME) - config_parse_restrict_network_interfaces: optional ~ + list of ALTERNATIVE-length ifnames - config_parse_bind_network_interface: single ALTERNATIVE-length ifname (specifier-aware) - config_parse_working_directory: optional - + (~ | absolute path) - config_parse_unit_env_file: optional - + absolute path Alternative-order gotcha (from #447): for private_users, BOOLEAN is placed LAST so its FlexibleLiteralChoice syntactic regex doesn't greedily match prefixes of "pick"/"identity" and short-circuit the AlternativeCombinator. OptionValueTest missing-function count drops 388 -> 382; found-key count rises 1812 -> 1846. Co-authored-by: Steve Ramage <gitcommits@sjrx.net> Co-authored-by: Claude Opus 4.7 (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.
Summary
Batch 2 of 5. Each grammar derived from systemd C parser:
config_parse_cpu_quota(0)load-fragment.c:3677parse_permyriad_unboundedpercent form (200% valid for 2 cores)config_parse_htb_class_size(TCLASS_KIND_HTB)network/tc/htb.c:295tbf_size/fq_sizeconfig_parse_delegate(0)load-fragment.c:3869config_parse_syscall_errno(0)load-fragment.c:3425→parse_errno"kill"OR errno name OR integerconfig_parse_address_families(0)load-fragment.c:3464→parse_address_families"none"OR optional~invert +AF_*listconfig_parse_pass_environ(0)load-fragment.c:2756Resolves #446. Stacked on #445 (batch 1).
Results
OptionValueTestmissing functions: 394 → 388 (−6)Gotcha for future validators
When an Alternative contains a
FlexibleLiteralChoiceTerminal(likeBOOLEAN) and a more specific structured branch, put the structured branch first.FlexibleLiteralChoice's syntactic phase accepts any short alphanumeric token in its character class — so a single-token input likecpuwould syntactically passBOOLEANandAlternativeCombinatorwould short-circuit before reaching the controller-list branch. Hit this onDelegate=cpu memory ioduring testing; fix was the trivial swap, but worth flagging.Test plan
OptionValueTestandSemanticDataRepositoryTestpassNotes
Skipped from candidate list:
config_parse_environ(0),config_parse_unset_environ(0)— values can contain almost any character with quoting/escaping, tight grammar would false-positiveconfig_parse_log_namespace(0)— STRING_FILENAME + unit_instance_is_valid + length + specifiers, too much overlapconfig_parse_numa_mask(0)— forwards toconfig_parse_cpu_set(with the"all"shortcut); deferred until we have a CPU-set grammar🤖 Generated with Claude Code