Skip to content

feat: add 6 validators (batch 3/5) - private_users, managed_oom_rules, restrict_network_interfaces, bind_network_interface, working_directory, unit_env_file#449

Merged
SJrX merged 1 commit into
issue-446from
issue-448
May 23, 2026
Merged

feat: add 6 validators (batch 3/5) - private_users, managed_oom_rules, restrict_network_interfaces, bind_network_interface, working_directory, unit_env_file#449
SJrX merged 1 commit into
issue-446from
issue-448

Conversation

@SJrX
Copy link
Copy Markdown
Owner

@SJrX SJrX commented May 23, 2026

Summary

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

Validator C source Usages Approach
config_parse_private_users(0) nspawn/nspawn-settings.c:660 6 boolean OR "pick"/"identity" OR uid(:range)?
config_parse_managed_oom_rules(1) load-fragment.c:4093 6 List of filename-safe rule names
config_parse_restrict_network_interfaces(0) load-fragment.c:5908 6 Optional ~ + list of ALTERNATIVE-length ifnames
config_parse_bind_network_interface(0) load-fragment.c:6036 6 Single ALTERNATIVE-length ifname (specifier-aware)
config_parse_working_directory(0) load-fragment.c:2576 5 Optional - + (~ OR absolute path)
config_parse_unit_env_file(0) load-fragment.c:2637 5 Optional - + absolute path

Resolves #448. Stacked on #447 (batch 2).

Results

  • OptionValueTest missing functions: 388 → 382 (−6)
  • Found keys: 1812 → 1846 (+34)
  • Failure-date estimate now ~2026-06-21

Notes

  • The ALTERNATIVE-length (ALTIFNAMSIZ, 128 chars) regex differs from the existing config_parse_ifname validator's IFNAMSIZ (16-char) limit, which is correct since RestrictNetworkInterfaces/BindNetworkInterface use ifname_valid_full(IFNAME_VALID_ALTERNATIVE).
  • private_users alternative ordering: BOOLEAN goes LAST because its FlexibleLiteralChoice syntactic regex would otherwise eat the first few characters of pick / identity and short-circuit. Same pattern documented in feat: add 6 validators (batch 2/5) - cpu_quota, htb_class_size, delegate, syscall_errno, address_families, pass_environ #447.
  • One catch during testing: ManagedOOMRules is actually keyed as OOMRules= in the gperf, not ManagedOOMRulesets=. Fixed test fixture; validator class name keeps the C-function spelling.

Skipped from candidates:

  • config_parse_log_filter_patterns(0) — PCRE2 regex, can't validate meaningfully without compiling
  • config_parse_io_device_weight/latency(0) — path + weight/latency, deferred
  • config_parse_path_spec(0), config_parse_cgroup_nft_set — non-trivial syntax variants

Test plan

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

🤖 Generated with Claude Code

…etwork_interfaces, bind_network_interface, working_directory, unit_env_file (Resolves #448)

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: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

Test Results

1 060 tests   1 060 ✅  46s ⏱️
  269 suites      0 💤
  269 files        0 ❌

Results for commit f499f0b.

@SJrX SJrX merged commit 470ba27 into issue-446 May 23, 2026
4 checks passed
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