Repository navigation
Commit d471253
committed
feat(own-cli): the production Rust OwnIR executable (#261 H.2)
`own-cli ownir <facts> [--format F] [--severity S] [--verbosity V]` — the one
core invocation the product seam makes today, as a native binary behind the
unchanged launcher. It reproduces the reference byte for byte over all 80
frozen cases: argument handling, the display policy, the stream split, the
four formats and every exit code.
The two halves have different oracles, and the boundary is the surface (C-1).
The top-level shell follows the public `owen` convention — a parity surface of
its own, with no Python byte oracle, written once and shared with the fixture
manifest. Everything after `ownir` is the reference as measured, including
the parts that surprise: a positional-count error prints the whole module
docstring to STDOUT with exit 2, and an unknown flag is a positional rather
than an error. `ownir --help` is the one case declared a defect and not
ported.
What it reuses and what it owns:
* `own_bridge::check_facts` is the analysis and `render_finding` /
`build_sarif` are the renders — already byte-pinned by BR-V9, never
re-derived here;
* the CLI owns the display policy, because it is CLI logic. It is a pure
function of the findings and the three options, so the traps are unit tests
rather than process invocations: the exit is `1 if leaks else 0` and no
option moves it, `quiet` hides advisories and nothing else, the `ok` line
fires on `not shown` so an all-suppressed document prints ok AND a tally,
and the verbose breakdown counts every finding;
* the CLI owns the SARIF SERIALIZATION, because `cmd_ownir` writes the same
document `json.dumps(indent=2)` does — pure ASCII with `\uXXXX` escapes and
a surrogate pair above the BMP — while the BR-V9 goldens are
`ensure_ascii=False`. Two byte shapes, one builder; the builder is untouched.
The process contract, under `panic = "unwind"`: a hook suppresses the default
panic output and records the payload, and a top-level `catch_unwind` turns the
unwind into one actionable stderr diagnostic and exit 70, never 101. The hook
alone would only observe the panic. Under OWNLANG_DEBUG the payload and a
captured backtrace print and the exit is still 70 — the asymmetry `run()`
keeps, because exit 1 reads as findings. An off-by-default `fault-injection`
feature gates the two dev-only hooks that force each failure mode, so both are
measured rather than asserted.
The DAG gains exactly two edges, `own-cli -> own-ir` and `own-cli ->
own-bridge`, registered in `dag.rs` where an unregistered member fails the
whole `cargo test`. No `own-codegen`, no `own-shadow`, no `sha2`.
The `panic`-per-binary note above `[profile.release]` is corrected in place as
a design note: Cargo cannot set `panic` per package — a profile applies to
every target of a build — so `abort for own-cli` was never a plan Cargo could
execute. Nothing about the built artifacts moves.
Refs #261, #345, #262, #250
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DTGMj7edRtjhyeXzkeiSWv1 parent 2900f60 commit d471253
10 files changed
Lines changed: 1365 additions & 3 deletions
File tree
- rust
- crates
- own-cli
- src
- own-diagnostics/tests
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
56 | 68 | | |
57 | 69 | | |
58 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
0 commit comments