Repository navigation
Commit 08c11e4
committed
fix(extractor): bind the EventSource-counter exemption to genuine counter fields (Codex P2 + CodeRabbit)
Two review findings on the over-broad first cut, both the over-suppression class:
- Codex P2 — require the field's DECLARED type to derive from DiagnosticCounter
before skipping. A field declared as a plain IDisposable that is merely assigned
a counter once (`IDisposable _mixed = new MemoryStream(); _mixed = new
EventCounter(..., this);`) would otherwise have its OTHER resource (the
MemoryStream) silently suppressed by the name-only skip. The declared-type guard
binds the exemption to actual counter fields (Npgsql declares them as
`IncrementingPollingCounter?` etc.), so the non-counter leak still fires.
- CodeRabbit (major) — populate the exemption set with ThisFieldName, not
FieldName: the latter also matches `other._counter`, which could exempt this
class's same-named field from another instance's assignment. Tightening a
suppression to THIS instance's field (`_f` / `this._f`) is strictly safer.
Regression: EventSourceCountersSample gains `_mixed` — declared IDisposable,
initialized `new MemoryStream()` and later assigned `new EventCounter(..., this)`
— which must STILL raise OWN001 on the MemoryStream. The four genuine counter
fields stay SILENT; `_scratch` (non-counter) and `_mixed` (non-counter-declared)
both warn. CI asserts all three.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rg8kSk1YT14x7A1vo5zgED1 parent 72b6927 commit 08c11e4
3 files changed
Lines changed: 27 additions & 4 deletions
File tree
- .github/workflows
- frontend/roslyn
- OwnSharp.Extractor
- samples
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
343 | 343 | | |
344 | 344 | | |
345 | 345 | | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
346 | 352 | | |
347 | 353 | | |
348 | 354 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2198 | 2198 | | |
2199 | 2199 | | |
2200 | 2200 | | |
2201 | | - | |
| 2201 | + | |
2202 | 2202 | | |
2203 | 2203 | | |
2204 | 2204 | | |
| |||
2219 | 2219 | | |
2220 | 2220 | | |
2221 | 2221 | | |
2222 | | - | |
2223 | | - | |
2224 | | - | |
| 2222 | + | |
| 2223 | + | |
| 2224 | + | |
| 2225 | + | |
| 2226 | + | |
| 2227 | + | |
| 2228 | + | |
| 2229 | + | |
2225 | 2230 | | |
2226 | 2231 | | |
2227 | 2232 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
35 | 42 | | |
36 | 43 | | |
37 | 44 | | |
| |||
59 | 66 | | |
60 | 67 | | |
61 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
62 | 74 | | |
63 | 75 | | |
64 | 76 | | |
| |||
0 commit comments