Skip to content

refactor(audit): share the flag-presence verdict and tighten the line classifier - #180

Open
brettdavies wants to merge 1 commit into
fix/help-flags-u10-install-allfrom
refactor/help-flags-shared-helpers
Open

brettdavies wants to merge 1 commit into
fix/help-flags-u10-install-allfrom
refactor/help-flags-shared-helpers

Conversation

@brettdavies

@brettdavies brettdavies commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

Summary

A cleanup pass over the stack below it (#163 to #179), with no change to any audit result.

Audits:

  • Seven audits ended in the same shape: pass when the help declares one of the names, otherwise warn with the message and the dash-rule note. flag_presence::pass_or_warn holds it once, for p6-color-flag, p2-raw-flag, p7-verbose, p2-json-aliases, p7-quiet, p8-install-all and p1-flag-existence.
  • p1-flag-existence and p1-non-interactive each kept a copy of the help-on-bare markers and of the sentence that says no non-interactive flag is declared. non_interactive.rs owns both.
  • The declared [p2] json_probe call, which p2-json-output and p2-schema-print both run, moves to declared_probe.rs. json_output.rs drops from 239 to 188 lines of non-test code.
  • subcommands_to_probe takes the help it always had, in place of an Option.

Flag model:

  • The classifier kept two fields that were never set together: the description column, and the indent of a definition still waiting for a description. They are one Description enum.
  • Lead had three variants and one question asked of it. It is a predicate, and the bracket check sits where it is used.
  • column_of moves to pieces.rs, so classify.rs and header.rs no longer import each other.
  • Piece kept two join flags that were only read together. They are one.
  • The tokenizer's TAB handling is removed: normalize expands TABs before any line reaches it.

Tests read help fixtures through one fixture() helper.

Changelog

No user-facing changes.

Type of Change

  • refactor: Code refactoring (no functional changes)

Related Issues/Stories

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing completed
  • All tests passing

Test Summary:

  • 1315 passing, the same tests as the base apart from one tokenizer table row (a TAB-separated description, which normalize owns) and one assertion on the removed None argument.
  • Snapshots: none change. Every one of the 71 fixture captures parses to the same definitions.
  • The full registry capture set (910 help texts) was rendered through the base and head parsers: the two renderings are identical, file for file.
  • Self-audit: cargo test --test dogfood passes.

Expected moves. Written before the corpus run.

None. Replaying the full registry capture set through the base (#179) and head builds moves no row.

Corpus before/after. Run after the table above was written. Base 8a8ae3ef2419, head 8134d09b7510. Image sha256:05db16cf226cd14a93a2682aea41b72d3e6b4d240cadba006f2881d3ffa996b3, network bridge. 98 tools selected, 95 scored under both builds, 1 rerun three times (mods).

Moved rows (0)

None.

Derived fields moved (0)

None.

No row and no derived field moved, as expected. mods p3-should-about-long-about, the one row on the A/A noise list, did not move. No row is unstable, no harness bug is flagged, and no tool failed to score under one build only. cursor, nvidia-smi and xai-grok-build are absent from the image and ran under neither build.

Files Modified

Modified:

  • src/audits/behavioral/: color_flag.rs, raw_flag.rs, verbose_flag.rs, json_aliases.rs, quiet.rs, install_all.rs, flag_existence.rs, non_interactive.rs, json_output.rs, schema_print.rs, force_yes.rs (test helper only), mod.rs
  • src/runner/help_probe/flags/: classify.rs, header.rs, pieces.rs, mod.rs (test helper only)
  • src/runner/help_probe/fixture_snapshots.rs, src/runner/help_probe/mod.rs: the shared fixture() reader

Created:

  • src/audits/behavioral/flag_presence.rs
  • src/audits/behavioral/declared_probe.rs

Renamed:

  • None.

Deleted:

  • None.

Breaking Changes

  • No breaking changes

Deployment Notes

  • No special deployment steps required

Checklist

  • Code follows project conventions and style guidelines
  • Commit messages follow Conventional Commits
  • Self-review of code completed
  • Tests added/updated and passing
  • No new warnings or errors introduced
  • Changes are backward compatible (or breaking changes documented)

… classifier

No audit result changes: every evidence string, every definition read from the 71 help fixtures, and every probe the audits send stay as they were.

Audits:

- Seven audits ended in the same pass-or-warn-with-the-dash-rule-note shape. `flag_presence::pass_or_warn` holds it once, for `p6-color-flag`, `p2-raw-flag`, `p7-verbose`, `p2-json-aliases`, `p7-quiet`, `p8-install-all` and `p1-flag-existence`.
- `p1-flag-existence` and `p1-non-interactive` each kept their own copy of the help-on-bare markers and of the sentence that says no non-interactive flag is declared. `non_interactive.rs` owns both now.
- The declared `[p2] json_probe` call, which `p2-json-output` and `p2-schema-print` both run, moves to `declared_probe.rs`. `json_output.rs` drops from 239 to 188 lines of non-test code.
- `subcommands_to_probe` takes the help it always had.

Flag model:

- The classifier's two exclusive fields, the description column and the indent of a definition still waiting for one, become one `Description` enum.
- `Lead` had three variants and one question asked of it. It is a predicate now, and the bracket check sits where it is used.
- `column_of` moves to `pieces.rs`, so `classify.rs` and `header.rs` no longer import each other.
- `Piece` kept two join flags that were only ever read together. They are one.
- The tokenizer's TAB handling is gone: `normalize` expands TABs before any line reaches it.

Tests read help fixtures through one `fixture()` helper.
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