Skip to content

feat: add 6 validators (batch 2/5) - cpu_quota, htb_class_size, delegate, syscall_errno, address_families, pass_environ#447

Merged
SJrX merged 1 commit into
242.xfrom
issue-446
May 23, 2026
Merged

feat: add 6 validators (batch 2/5) - cpu_quota, htb_class_size, delegate, syscall_errno, address_families, pass_environ#447
SJrX merged 1 commit into
242.xfrom
issue-446

Conversation

@SJrX
Copy link
Copy Markdown
Owner

@SJrX SJrX commented May 23, 2026

Summary

Batch 2 of 5. Each grammar derived from systemd C parser:

Validator C source Usages Approach
config_parse_cpu_quota(0) load-fragment.c:3677 6 parse_permyriad_unbounded percent form (200% valid for 2 cores)
config_parse_htb_class_size(TCLASS_KIND_HTB) network/tc/htb.c:295 5 IEC byte size, same as tbf_size/fq_size
config_parse_delegate(0) load-fragment.c:3869 6 Boolean OR whitespace-separated cgroup controller names
config_parse_syscall_errno(0) load-fragment.c:3425parse_errno 5 "kill" OR errno name OR integer
config_parse_address_families(0) load-fragment.c:3464parse_address_families 5 "none" OR optional ~ invert + AF_* list
config_parse_pass_environ(0) load-fragment.c:2756 5 List of env var names (specifier-aware)

Resolves #446. Stacked on #445 (batch 1).

Results

  • OptionValueTest missing functions: 394 → 388 (−6)
  • Found keys: 1780 → 1812 (+32)
  • Failure-date estimate now ~2026-06-15 (vs ~2026-06-09 before)

Gotcha for future validators

When an Alternative contains 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 controller-list branch. Hit this on Delegate=cpu memory io during testing; fix was the trivial swap, but worth flagging.

Test plan

  • All 6 new test classes pass
  • OptionValueTest and SemanticDataRepositoryTest pass
  • Full suite passes
  • CI green

Notes

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-positive
  • config_parse_log_namespace(0) — STRING_FILENAME + unit_instance_is_valid + length + specifiers, too much overlap
  • config_parse_numa_mask(0) — forwards to config_parse_cpu_set (with the "all" shortcut); deferred until we have a CPU-set grammar

🤖 Generated with Claude Code

…_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>
@github-actions
Copy link
Copy Markdown

Test Results

1 048 tests  +12   1 048 ✅ +12   45s ⏱️ +3s
  263 suites + 6       0 💤 ± 0 
  263 files   + 6       0 ❌ ± 0 

Results for commit 3f843b6. ± Comparison against base commit fec6ab3.

@SJrX SJrX merged commit d2ad9cb into 242.x May 23, 2026
3 of 5 checks passed
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>
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.

Add validators for cpu_quota, htb_class_size, delegate, syscall_errno, address_families, pass_environ

1 participant