Add Registry-wide unknown-flag probe (mix bash_fixtures.gen flags) - #104
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements #70 item 2 for the Registry-wide unknown-flag probe only: a generated
flags_matrixsuite in the same generate / record / test path asdate_matrix,printf_matrix,test_matrix, andvarop_matrix.This is not the item-3 filesystem-shape × command cube, Oils activation, or CI topology.
unknown_flags_test.exsfrom #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 flagswrites 184 cases (92Commands.Registrynames ×{--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 asend_of_options_test.exs.echo,test,true,:,false), GNU-Zacceptors (ls/cp/mkdir/mv/idSELinux,diff -Z,grep -Z,curl -Z,file -Z), loop/numeric builtins, and JustBash-onlymarkdown/mdare not omitted.ls -Zis recorded against an empty workdir so the listing is not the workspace.echo rc=$?so a wrong exit code is a stdout difference too.mix bash_fixtures.gen flags --dry-runreportsflags_matrix: 184 cases.mix bash_fixtures.gennow 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.shthe Docker task runs, under GNU bash 5.2.21 / Ubuntu 24.04 (uidubuntu, not root), then pretty-printed throughMix.Tasks.BashFixtures.write_json!/2:Host extras used for twins the Docker runner image does not ship:
tree2.1.1 andxxd(vim 9.1). To re-record through Docker when it is available (those two will becomecommand not foundunless the image grows them):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 onsort/head/tail/tr/uniq(both),cp/grep/ls(--jb-not-a-flagonly).Try --help,bash: line 1:, env 125 vs 1)exit/return/shift) not diagnosed the way bash doeslocal/declare/typesetparse flags outside a function-Zis SELinux context (ls/cp/mkdir/mv/id)-Zis a real flag (diff/grep/curl/file)break/continueomit bash's "only meaningful in a loop" warningmarkdown/mdare JustBash-only; bash reports command not found[without]still evaluates; bash exits 2readis quiet; bash writes usageyesrepeats the flag; GNU yes refuses unknown flagsJustBash.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
parse_argscommands onto FlagParser (Unknown flags are silently absorbed as operands, so sort -Q and uniq -Z return empty output at exit 0 #68)cat,rm,wc, …)unrecognized option,Try 'cmd --help')yesshould refuse unknown flags instead of repeating them[without]should exit 2Not 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-errorsmix format --check-formattedmix credo --strict(only the existing intentionalbanned_fixture_applyfinding)mix dialyzer(zero new errors; 13 skipped, same as main)mix test— 2 doctests, 62 properties, 6810 tests, 0 failuresmix test --only suite:flags_matrix— 184 tests, 0 failuresmix bash_fixtures.gen flags --dry-run—flags_matrix: 184 casesRelated Issues
Related to #70 (item 2, Registry-wide unknown-flag probe only; not closing the issue)
Type of Change
Testing
mix bash_fixtures.gen flags --dry-run, local runner.sh recording, JustBash vs oracle classification)Checklist
mix formatmix credoand addressed any issues