|
| 1 | +# Owen diagnostics: the model already exists (OX-01, P8) |
| 2 | + |
| 3 | +**Question.** Is the renderer so tied to CLI strings that the extension substrate needs a new |
| 4 | +internal diagnostic model before `msbuild`, `github`, `sarif`, a future Visual Studio host or a |
| 5 | +future LSP can be served? |
| 6 | + |
| 7 | +**Answer: no.** The model exists, it is the authoritative core's, and every surface is |
| 8 | +already one function of it. OX-01 adds **no** diagnostic layer. It consumes the existing one. |
| 9 | + |
| 10 | +## The model |
| 11 | + |
| 12 | +`own_bridge::verdict::Finding` (Rust, authoritative since the P-022 Stage 3 cutover; the Python |
| 13 | +reference mirrors it field for field): |
| 14 | + |
| 15 | +| field | the brief's concept | |
| 16 | +|---|---| |
| 17 | +| `code` | code (`OWN001` …) | |
| 18 | +| `severity` (+ `advisory`) | severity. The host's `--severity` changes only how a finding is **shown**, never the verdict | |
| 19 | +| `message` | message | |
| 20 | +| `file`, `line`, `column` (optional) | file, start line, start column | |
| 21 | +| `related: Vec<Step>`, `flow: Vec<Step>` | related locations and the witness path | |
| 22 | +| `kind` (`[resource: …]`), `component`, `event`, `handler` | the resource the finding is about | |
| 23 | +| `ignore_reason` | suppression (`// own:ignore` …) | |
| 24 | + |
| 25 | +**Renderers,** each a pure function of a `Finding`: |
| 26 | + |
| 27 | +| function | output | |
| 28 | +|---|---| |
| 29 | +| `own_bridge::render_finding(f, "human" \| "github" \| "msbuild", severity)` | one line per surface | |
| 30 | +| `own_bridge::build_sarif` | a SARIF 2.1.0 log | |
| 31 | + |
| 32 | +`own-cli ownir --format {human,github,msbuild,sarif}` exposes all four. `BR-V9` pins the |
| 33 | +bytes, and the CLI ledgers pin both engines. |
| 34 | + |
| 35 | +## How OX-01 uses it |
| 36 | + |
| 37 | +The build host (`owen build-check`) asks the core for `--format msbuild` and passes the lines |
| 38 | +through. It changes exactly one thing: it makes the **origin path** absolute against the project |
| 39 | +directory, so Visual Studio's Error List never has to guess a base. No message, code or |
| 40 | +severity is re-rendered by the host. |
| 41 | + |
| 42 | +The host's own conditions are the `OWENB` codes (spec/OwenExtension.md §4): |
| 43 | +- a descriptor rejected; |
| 44 | +- no engine for the platform; |
| 45 | +- a refusal. |
| 46 | + |
| 47 | +They are rendered by the host in the same canonical MSBuild shape. They are host |
| 48 | +diagnostics, not analysis findings, and they never reuse an `OWN` code. |
| 49 | + |
| 50 | +## Gaps, recorded and not changed here |
| 51 | + |
| 52 | +- **No column on the `msbuild` line.** `render_msbuild` prints `file(line)` although `Finding` carries an optional `column`. |
| 53 | + - **Effect:** the Error List navigates to the line, not the column. |
| 54 | + - **Why not here:** changing the line is a change to the core's pinned bytes (BR-V9, the CLI ledgers), which is foundation work. |
| 55 | +- **The line and the wording of state-protocol findings.** A stale state token is reported at the region entry, and in the generic resource wording ("IDisposable local … disposed"). This is issue **#393**, unchanged here. |
| 56 | +- **For a future IDE host or LSP:** both consume the same `Finding`. `--format sarif` already carries everything they need: code, level, message, region, related locations, code flows. A future `Owen.VisualStudio` or language server should read SARIF, or a structured JSON of the same `Finding`, from the one core, and never re-derive a finding. |
0 commit comments