Skip to content

cli: option-surface audit — spellable --engine auto, uniform usage exit codes (sweep S3) - #171

Closed
chaploud wants to merge 1 commit into
mainfrom
develop/s3-cli-surface
Closed

cli: option-surface audit — spellable --engine auto, uniform usage exit codes (sweep S3)#171
chaploud wants to merge 1 commit into
mainfrom
develop/s3-cli-surface

Conversation

@chaploud

Copy link
Copy Markdown
Contributor

What

The sweep's S3 axis: the runtime/CLI option surface, audited against the あるべき論 bar.

  • --engine auto is now spellable: the help text has always described auto as the default, but the value itself was rejected. It now parses as the explicit spelling of the default (JIT-preferring with interp fallback, last-flag-wins); usage strings and the error message name all three values.
  • Usage errors exit 2 uniformly: compile usage errors previously exited 1 (lumped with build/IO failures) while run and the dispatcher used 2. compile usage now prints a usage line and exits 2; 1 stays for genuine build/IO failures. The exit-code table in docs/reference/cli.md drops its asymmetry footnote.
  • Env-var inventory audited: ZWASM_DEBUG / ZWASM_DIAG are the only real runtime env vars and both were already documented; ZWASM_ENGINE_* / ZWASM_TRAP_* are C-header macros (not env vars); ZWASM_TEST_SENTINEL_KEY is test-internal. All 13 parsed CLI flags are documented — no hidden surface.
  • Drops p2_sockets.zig's unused test-section skip import (same one-line deletion as refactor: three-way split of component_wasi_p2.zig (D-444, ADR-0207) — sweep S1 #169/build: -D option surface audit — retire -Dgc + run-repro, loud sanitize rejection, document the table (sweep S2) #170 — identical hunks merge cleanly).

Verification

--engine auto runs with trap exit 1 on both engines · bogus engine value exits 2 · compile with no args exits 2 + usage line · unit tests 3049 pass / 12 skip · lint No issues · pre-commit gate all green.

…e exit 2, reference doc aligned

- --engine accepts 'auto' as the explicit spelling of the default
  (JIT-preferring with interp fallback, last-flag-wins); the help/usage
  strings and the error message name all three values.
- compile usage errors now exit 2 with a usage line, matching run and
  the dispatch layer — exit 1 stays for build/IO failures.
- docs/reference/cli.md updated to match; env-var inventory audited
  (ZWASM_DEBUG / ZWASM_DIAG real + documented; ZWASM_ENGINE_* /
  ZWASM_TRAP_* are C-header macros; no undocumented flags).
- drops p2_sockets' unused test-section skip import (same one-line
  deletion as #169/#170; merges cleanly).
@chaploud

Copy link
Copy Markdown
Contributor Author

Consolidated into #175 (all six sweep axes as one merge unit; this branch's commits are included there verbatim).

@chaploud chaploud closed this Aug 11, 2026
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