Skip to content

Commit 994dde6

Browse files
committed
docs: record the exception-edge slice + its clean cross-tool oracle result
The dispose-not-called-on-throw shape (disposed in `try`, not `finally`) is no longer deferred: the exception-edge model closes it, and the latest oracle run on the SystemEvents fixture lands it in Agree across all three tools, matching CodeQL's cs/dispose-not-called-on-throw. Updates the recall-gap paragraph, the fixture results table (now 4 leaks: 3 Dispose/RAII in Agree, subscription Own.NET-only, oracle-only empty), and the milestone-1 ROADMAP entry. Also notes the one-leak-one-finding dedup the slice surfaced and fixed.
1 parent f2d3706 commit 994dde6

2 files changed

Lines changed: 40 additions & 20 deletions

File tree

‎docs/ROADMAP.md‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,13 @@ architectural strictness, and the borrow-checker showcase):
9090
The cross-tool oracle confirms the differentiation: CodeQL *and* Infer# (the latter
9191
via a buildable fixture) cover the Dispose/RAII class and flag none of these
9292
subscription leaks — agreeing with Own.NET only on a Dispose leak, never a subscription.
93-
See [docs/notes/real-world-mining.md](notes/real-world-mining.md).
93+
The oracle also drove down the *other*-class recall gap (Dispose leaks Own.NET missed
94+
because the flow detector skipped methods with unmodelled constructs): `for` and `try`
95+
are now lowered — sequentially, then with an **exception-edge** model that injects a
96+
throw exit before each may-throw statement in a `try`. That closes the
97+
`dispose-not-called-on-throw` shape, which now lands in cross-tool **Agree** with
98+
CodeQL's dedicated query on the fixture. Deferred: `finally`-before-`return`,
99+
`switch`/`do`. See [docs/notes/real-world-mining.md](notes/real-world-mining.md).
94100
2. **Resource core** — generalise WPF subscriptions + `IDisposable` into one
95101
acquire/release/owner/release-region model (P-004 ∪ P-005), so WPF is a
96102
*profile*, not a one-off.

‎docs/notes/real-world-mining.md‎

Lines changed: 33 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -116,33 +116,47 @@ Their leak findings are **nearly disjoint** (file overlap: **1**):
116116
coverage, not type recognition**: the `--flow-locals` detector skips any method with
117117
an unmodelled construct (`for`/`try`/`switch`), and these disposables live in such
118118
methods (tell: the `StringReader`/`XmlReader` cases are a *recognised* disposable
119-
type, yet still missed). `for` **and** `try`/`finally` are now lowered (sequential
120-
`A; B`, catch-disposes bailed for soundness), so a plain undisposed local inside a
121-
try-method is caught — confirmed on the cross-tool fixture, where a `try`-method
122-
`FileStream` leak moved from *Oracle only* into **Agree** (Own.NET + Infer#). Still
123-
deferred: the true `dispose-not-called-on-throw` shape (disposed in `try`, not
124-
`finally`) needs per-statement exceptional exits, and `switch`/`do` are unmodelled.
119+
type, yet still missed). `for` **and** `try` are now lowered, in two slices: first
120+
sequential `A; B` (catch-disposes bailed for soundness), so a plain undisposed local
121+
inside a try-method is caught; then the **exception-edge** model — before each
122+
may-throw statement in a `try`, inject an exceptional exit (`if(*){ <finally>; return }`)
123+
— which catches the true `dispose-not-called-on-throw` shape (disposed in `try`, not
124+
`finally`: the throw skips the `Dispose`). Both confirmed on the cross-tool fixture:
125+
the plain `try`-method leak and the dispose-on-throw leak both land in **Agree** across
126+
all three tools (the latter matching CodeQL's `cs/dispose-not-called-on-throw`). Still
127+
deferred: `finally`-before-`return` threading (bailed today), and `switch`/`do`.
125128
- **Agree — 1** (`HttpHelper.cs`).
126129

127130
So the SystemEvents and VideoSource findings are **differentiated — confirmed by the
128131
oracle, not just argued**: the tools are complementary (Own.NET on subscription/
129132
lifetime, CodeQL on Dispose/RAII), overlapping on a single file.
130133

131134
**Infer#, via a buildable fixture.** ScreenToGif can't build on Linux, so to get the
132-
third tool in, a minimal `net8.0` console reproduces both leak classes
135+
third tool in, a minimal `net8.0` console reproduces the leak classes
133136
(`corpus/fixtures/systemevents-console/`, fed to the oracle via a `local:` target).
134-
All three tools run; the diff is a clean 2×2:
135-
136-
| `Program.cs` | leak | Own.NET | CodeQL | Infer# |
137-
|---|---|:-:|:-:|:-:|
138-
| `:41` | `new FileStream(…)` never disposed — Dispose/RAII | ✓ | ✓ | ✓ |
139-
| `:20` | `SystemEvents.DisplaySettingsChanged +=` never `-=` — subscription | ✓ | — | — |
140-
141-
The FileStream leak is **Agree** across all three — the control that proves CodeQL
142-
*and* Infer# actually run and detect resource leaks on this code. The SystemEvents
143-
subscription is **Own.NET only**: **Infer# misses it too.** Both mature oracles cover
144-
the Dispose/RAII class and neither has the subscription-leak class — the
145-
differentiation, nailed with all three tools.
137+
All three tools run; the diff (latest run) is:
138+
139+
| `Program.cs` | leak | class | Own.NET | CodeQL | Infer# |
140+
|---|---|---|:-:|:-:|:-:|
141+
| `:43` | `new FileStream(…)` never disposed | Dispose/RAII | ✓ | ✓ | ✓ |
142+
| `:54` | undisposed local inside a `try`-method | Dispose/RAII (try-lowering) | ✓ | ✓ | ✓ |
143+
| `:77` | `Dispose()` in `try` after a may-throw call — skipped on the throw path | dispose-on-throw (exception-edge) | ✓ | ✓ | ✓ |
144+
| `:20` | `SystemEvents.DisplaySettingsChanged +=` never `-=` | subscription | ✓ | — | — |
145+
146+
The three Dispose/RAII leaks are **Agree** across all three tools — the controls that
147+
prove CodeQL *and* Infer# actually run and detect resource leaks on this code — and the
148+
bottom two are the recall slices: the plain `try`-method leak (sequential lowering) and
149+
the dispose-on-throw leak (exception-edge), the latter matching CodeQL's dedicated
150+
`cs/dispose-not-called-on-throw` query. **Oracle-only is empty** — no Dispose/RAII leak
151+
on this fixture is missed. The `SystemEvents` subscription is **Own.NET only**: **Infer#
152+
misses it too.** Both mature oracles cover the Dispose/RAII class and neither has the
153+
subscription-leak class — the differentiation, nailed with all three tools.
154+
155+
> The exception-edge slice also surfaced a hygiene bug it then fixed: a local that
156+
> leaks on *both* the injected exceptional exit *and* the normal end produced two
157+
> identical OWN001s (every flow-local diagnostic remaps to the acquire line, so they
158+
> collapse). The bridge now drops byte-identical findings (`ownir.py`), pinned by
159+
> `tests/fixtures/ownir/flow_leak_two_exits.facts.json`. One leak, one finding.
146160
147161
> Getting a trustworthy diff took fixing two oracle bugs: the comparator dropped
148162
> multi-line / untagged own-check findings (`scripts/mine_report.py` parser drift —

0 commit comments

Comments
 (0)