Repository navigation
Commit 4ce410a
committed
fix(p1a): pin the ADO factory match to an ADO receiver, not just the return type
The ADO branch matched on method name + the RETURN type's System.Data interface
only, so a non-ADO helper exposing an `ExecuteReader`/`CreateCommand`/
`BeginTransaction` that returns a borrowed/cached IDataReader/IDbCommand/
IDbTransaction would be minted as an owned acquire -> a false OWN001 when the
caller correctly does not dispose the borrowed object. (Codex P2.)
Pin BOTH ends, like every other factory branch verifies its declaring type: the
RECEIVER (containing type) must implement the matching System.Data interface too
-- IDbCommand for ExecuteReader, IDbConnection for CreateCommand/BeginTransaction
-- in addition to the return-type interface. Still provider-agnostic (DbCommand /
SqlCommand / NpgsqlCommand all implement IDbCommand).
The corpus fixture is unaffected (DbCommand implements IDbCommand): case.own ->
OWN001 still holds (corpus 21/21), full suite green, mypy --strict, ruff. C#
branch verified by CI (golden C# / leak extractor / corpus benchmark).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019846YSZ35c7CdkWQ1qX5gm1 parent 963af37 commit 4ce410a
2 files changed
Lines changed: 26 additions & 15 deletions
File tree
- corpus/real-world/ado-executereader-leak
- frontend/roslyn/OwnSharp.Extractor
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
| 13 | + | |
13 | 14 | | |
14 | | - | |
15 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2300 | 2300 | | |
2301 | 2301 | | |
2302 | 2302 | | |
2303 | | - | |
2304 | | - | |
2305 | | - | |
2306 | | - | |
2307 | | - | |
2308 | | - | |
2309 | | - | |
2310 | | - | |
2311 | | - | |
| 2303 | + | |
| 2304 | + | |
| 2305 | + | |
| 2306 | + | |
| 2307 | + | |
| 2308 | + | |
| 2309 | + | |
| 2310 | + | |
| 2311 | + | |
| 2312 | + | |
| 2313 | + | |
2312 | 2314 | | |
2313 | 2315 | | |
2314 | 2316 | | |
2315 | | - | |
2316 | | - | |
2317 | | - | |
| 2317 | + | |
| 2318 | + | |
| 2319 | + | |
| 2320 | + | |
| 2321 | + | |
| 2322 | + | |
| 2323 | + | |
| 2324 | + | |
| 2325 | + | |
2318 | 2326 | | |
2319 | 2327 | | |
2320 | 2328 | | |
| |||
0 commit comments