Skip to content

feat: add 6 validators - unit_string_printf + 5 calibrated others (Resolves #463)#464

Merged
SJrX merged 1 commit into
242.xfrom
issue-463
Jun 20, 2026
Merged

feat: add 6 validators - unit_string_printf + 5 calibrated others (Resolves #463)#464
SJrX merged 1 commit into
242.xfrom
issue-463

Conversation

@SJrX

@SJrX SJrX commented Jun 20, 2026

Copy link
Copy Markdown
Owner

Resolves #463. Six validators, each calibrated against the systemd C parser (local source), implemented in the SimpleGrammarOptionValues framework with valid + invalid tests.

Validator Keys Calibrated to C as
config_parse_unit_string_printf 35 any string; % must be %% or a valid unit specifier
config_parse_ip_filter_bpf_progs 12 absolute path (PATH_CHECK_ABSOLUTE); leading specifier allowed
config_parse_user_group_compat 12 valid_user_group_name(RELAX): no : / ctrl / edge whitespace; numeric OK
config_parse_io_device_weight 6 <path> <int 1-10000> (cg_weight_parse)
config_parse_io_device_latency 6 <path> <timespan> (parse_sec)
config_parse_delegate_subgroup 6 cgroup name, !cg_needs_escape

Design notes

  • Flagship unit_string_printf does real specifier validation (set extracted from unit-printf.c + the COMMON_* macros in specifier.h) — %e is flagged, %i/%H/%%/non-ASCII pass. Not an accept-everything validator.
  • Grammars are biased toward false-negatives over false-positives. The rarer C checks that can't be modeled without risking false positives are intentionally left unenforced and documented per-validator in the KDoc (path validators allow % loosely; io_device_* don't force absolute paths since the C uses flags 0; user_group_compat skips the purely-numeric/-N/./.. RELAX cases; delegate_subgroup skips the <controller>. rule).

Impact

  • OptionValueTest burn-down: 372 → 366 missing functions (797 → 720 missing key-instances).
  • Each validator ships valid + invalid tests; the full test suite passes with no regressions.

🤖 Generated with Claude Code

…r_group_compat, io_device_weight, io_device_latency, delegate_subgroup (Resolves #463)

Each grammar is calibrated against the systemd C parser, biased toward
false-negatives over false-positives (rarer C checks that can't be
modeled safely are left unenforced and documented in each KDoc):

- config_parse_unit_string_printf (35 keys): any string, but '%' must be
  '%%' or a valid unit specifier (unit_full_printf table + COMMON_SYSTEM/
  CREDS/TMP specifiers). Real specifier validation, not accept-everything.
- config_parse_ip_filter_bpf_progs (12): absolute path (PATH_CHECK_ABSOLUTE),
  leading specifier allowed.
- config_parse_user_group_compat (12): valid_user_group_name(RELAX) - no
  ':' '/' control chars or edge whitespace; numeric IDs allowed.
- config_parse_io_device_weight (6): <path> <int 1-10000> (cg_weight_parse).
- config_parse_io_device_latency (6): <path> <timespan> (parse_sec).
- config_parse_delegate_subgroup (6): cgroup name, !cg_needs_escape.

OptionValueTest burn-down: 372 -> 366 missing functions (797 -> 720
missing key-instances). Each validator ships valid + invalid tests; full
suite passes.

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

Copy link
Copy Markdown

Test Results

1 096 tests   1 096 ✅  53s ⏱️
  287 suites      0 💤
  287 files        0 ❌

Results for commit 68c10c7.

@SJrX SJrX merged commit 067a60b into 242.x Jun 20, 2026
3 checks passed
SJrX pushed a commit that referenced this pull request Jun 20, 2026
…ce, log_extra_fields, exec_selinux_context, exec_smack_process_label, unset_environ (Resolves #465)

Each grammar is calibrated against the systemd C parser, biased toward
false-negatives over false-positives (documented per-validator in KDoc):

- config_parse_set_credential (ltypes 0,1): <id>:<data>; id is
  credential_name_valid (no '/' ':' control, not "."/".."), data arbitrary.
- config_parse_load_credential (ltypes 0,1): <id>[:<source>]; id is
  credential_name_valid, source loosely constrained.
- config_parse_log_namespace: log_namespace_name_valid (filename-safe,
  no '/', not "."/"..").
- config_parse_log_extra_fields: list of FIELD=value, FIELD a journal
  field name [A-Z][A-Z0-9_]{0,63}.
- config_parse_exec_selinux_context / config_parse_exec_smack_process_label:
  optional leading '-' then a specifier-validated string.
- config_parse_unset_environ: list of env names or NAME=value assignments.

Because the credential parsers cover ltypes 0 and 1, this clears 9 burn-down
entries: OptionValueTest 366 -> 357 missing functions (1979 -> 2024 found).
Each validator ships valid + invalid tests; full suite passes.

Stacked on #464 (both touch AiGenerated.kt); merge #464 first.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
SJrX pushed a commit that referenced this pull request Jun 20, 2026
…ce, log_extra_fields, exec_selinux_context, exec_smack_process_label, unset_environ (Resolves #465)

Each grammar is calibrated against the systemd C parser, biased toward
false-negatives over false-positives (documented per-validator in KDoc):

- config_parse_set_credential (ltypes 0,1): <id>:<data>; id is
  credential_name_valid (no '/' ':' control, not "."/".."), data arbitrary.
- config_parse_load_credential (ltypes 0,1): <id>[:<source>]; id is
  credential_name_valid, source loosely constrained.
- config_parse_log_namespace: log_namespace_name_valid (filename-safe,
  no '/', not "."/"..").
- config_parse_log_extra_fields: list of FIELD=value, FIELD a journal
  field name [A-Z][A-Z0-9_]{0,63}.
- config_parse_exec_selinux_context / config_parse_exec_smack_process_label:
  optional leading '-' then a specifier-validated string.
- config_parse_unset_environ: list of env names or NAME=value assignments.

Because the credential parsers cover ltypes 0 and 1, this clears 9 burn-down
entries: OptionValueTest 366 -> 357 missing functions (1979 -> 2024 found).
Each validator ships valid + invalid tests; full suite passes.

Stacked on #464 (both touch AiGenerated.kt); merge #464 first.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
SJrX added a commit that referenced this pull request Jun 20, 2026
…ce, log_extra_fields, exec_selinux_context, exec_smack_process_label, unset_environ (Resolves #465) (#466)

Each grammar is calibrated against the systemd C parser, biased toward
false-negatives over false-positives (documented per-validator in KDoc):

- config_parse_set_credential (ltypes 0,1): <id>:<data>; id is
  credential_name_valid (no '/' ':' control, not "."/".."), data arbitrary.
- config_parse_load_credential (ltypes 0,1): <id>[:<source>]; id is
  credential_name_valid, source loosely constrained.
- config_parse_log_namespace: log_namespace_name_valid (filename-safe,
  no '/', not "."/"..").
- config_parse_log_extra_fields: list of FIELD=value, FIELD a journal
  field name [A-Z][A-Z0-9_]{0,63}.
- config_parse_exec_selinux_context / config_parse_exec_smack_process_label:
  optional leading '-' then a specifier-validated string.
- config_parse_unset_environ: list of env names or NAME=value assignments.

Because the credential parsers cover ltypes 0 and 1, this clears 9 burn-down
entries: OptionValueTest 366 -> 357 missing functions (1979 -> 2024 found).
Each validator ships valid + invalid tests; full suite passes.

Stacked on #464 (both touch AiGenerated.kt); merge #464 first.

Co-authored-by: Steve Ramage <gitcommits@sjrx.net>
Co-authored-by: Claude Opus 4.8 (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 6 validators - unit_string_printf, ip_filter_bpf_progs, user_group_compat, io_device_weight, io_device_latency, delegate_subgroup

1 participant