Skip to content

Add Registry-wide unknown-flag probe (mix bash_fixtures.gen flags) - #104

Merged
davydog187 merged 1 commit into
mainfrom
cursor/unknown-flag-probe-3ce2
Aug 23, 2026
Merged

Add Registry-wide unknown-flag probe (mix bash_fixtures.gen flags)#104
davydog187 merged 1 commit into
mainfrom
cursor/unknown-flag-probe-3ce2

Conversation

@davydog187

@davydog187 davydog187 commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

Implements #70 item 2 for the Registry-wide unknown-flag probe only: a generated flags_matrix suite in the same generate / record / test path as date_matrix, printf_matrix, test_matrix, and varop_matrix.

This is not the item-3 filesystem-shape × command cube, Oils activation, or CI topology.

unknown_flags_test.exs from #68 keeps the FlagParser unit tests (exact GNU wording, clusters, --help). The registry-wide classification table moves here so there is one source of truth.

What was enumerated

mix bash_fixtures.gen flags writes 184 cases (92 Commands.Registry names × {--jb-not-a-flag, -Z}). A new Registry command fails generation and the gen test until it is classified with a reason — the same completeness rule as end_of_options_test.exs.

  • Every name is generated. Operand commands (echo, test, true, :, false), GNU -Z acceptors (ls/cp/mkdir/mv/id SELinux, diff -Z, grep -Z, curl -Z, file -Z), loop/numeric builtins, and JustBash-only markdown/md are not omitted.
  • ls -Z is recorded against an empty workdir so the listing is not the workspace.
  • Scripts end in echo rc=$? so a wrong exit code is a stdout difference too.

mix bash_fixtures.gen flags --dry-run reports flags_matrix: 184 cases. mix bash_fixtures.gen now generates date, printf, test, varop, and flags.

Recording

Docker was not available on the agent VM. Oracle output was recorded with the same test/fixtures/runner.sh the Docker task runs, under GNU bash 5.2.21 / Ubuntu 24.04 (uid ubuntu, not root), then pretty-printed through Mix.Tasks.BashFixtures.write_json!/2:

mix bash_fixtures.gen flags
bash test/fixtures/runner.sh < test/fixtures/bash_cases/flags_matrix.json > /tmp/flags_matrix_raw.json
# then Jason-pretty-print + Fixtures.validate, as `mix bash_fixtures` does

Host extras used for twins the Docker runner image does not ship: tree 2.1.1 and xxd (vim 9.1). To re-record through Docker when it is available (those two will become command not found unless the image grows them):

mix bash_fixtures flags_matrix

Known gaps (161 of 184)

No cell was omitted. Divergences are opts.known_gap (excluded from the digest). The fixture runner still executes them with the assertion inverted.

23 cells match bash unmarked: :, echo, false, test, true (both flags); FlagParser exact GNU wording on sort/head/tail/tr/uniq (both), cp/grep/ls (--jb-not-a-flag only).

Count Reason
48 Misblamed as a filename or other operand; bash names the option
40 Both refuse; wording or exit code differs (Try --help, bash: line 1:, env 125 vs 1)
38 Absorbed as operand/format at exit 0; bash refuses
6 Non-numeric status/count (exit/return/shift) not diagnosed the way bash does
6 local/declare/typeset parse flags outside a function
5 GNU -Z is SELinux context (ls/cp/mkdir/mv/id)
4 GNU -Z is a real flag (diff/grep/curl/file)
4 break/continue omit bash's "only meaningful in a loop" warning
4 markdown/md are JustBash-only; bash reports command not found
2 [ without ] still evaluates; bash exits 2
2 read is quiet; bash writes usage
2 yes repeats the flag; GNU yes refuses unknown flags

JustBash.exec/2 did not raise on any cell. No remaining unknown-flag implementation bugs were fixed in this PR — it is the enumeration + harness.

Cheap follow-ups the matrix now makes un-skippable

Not in this PR: the item-3 FS-shape × command cube, Oils activation, CI topology changes.

Tests

All local quality gates passed:

  • mix compile --warnings-as-errors
  • mix format --check-formatted
  • mix credo --strict (only the existing intentional banned_fixture_apply finding)
  • mix dialyzer (zero new errors; 13 skipped, same as main)
  • mix test — 2 doctests, 62 properties, 6810 tests, 0 failures
  • mix test --only suite:flags_matrix — 184 tests, 0 failures
  • mix bash_fixtures.gen flags --dry-runflags_matrix: 184 cases

Related Issues

Related to #70 (item 2, Registry-wide unknown-flag probe only; not closing the issue)

Type of Change

  • New feature (non-breaking change which adds functionality)

Testing

  • Added new tests
  • All existing tests pass
  • Tested manually (mix bash_fixtures.gen flags --dry-run, local runner.sh recording, JustBash vs oracle classification)

Checklist

  • My code follows the style guidelines of this project
  • I have run mix format
  • I have run mix credo and addressed any issues
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing tests pass locally with my changes
  • I have updated the documentation accordingly
  • I have updated the CHANGELOG.md (for non-trivial changes)
Open in Web Open in Cursor 

Enumerate cmd --jb-not-a-flag and cmd -Z for every Commands.Registry
name as flags_matrix, recorded against real bash/coreutils. Operand
commands, GNU -Z acceptors, and JustBash-only names are classified
with a reason rather than omitted. unknown_flags_test.exs keeps the
FlagParser unit tests from #68 instead of a second registry table.

Co-authored-by: Dave Lucia <davelucianyc@gmail.com>
@davydog187
davydog187 marked this pull request as ready for review August 23, 2026 15:42
@davydog187
davydog187 merged commit ea24e2a into main Aug 23, 2026
4 checks passed
@davydog187
davydog187 deleted the cursor/unknown-flag-probe-3ce2 branch August 23, 2026 16:18
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.

2 participants