Skip to content

oracle: exclude doc/snippet trees + field-notes pattern log (repo requirement)#110

Merged
PhysShell merged 10 commits into
mainfrom
claude/agenda-2rufsj
Jun 26, 2026
Merged

oracle: exclude doc/snippet trees + field-notes pattern log (repo requirement)#110
PhysShell merged 10 commits into
mainfrom
claude/agenda-2rufsj

Conversation

@PhysShell

@PhysShell PhysShell commented Jun 26, 2026

Copy link
Copy Markdown
Owner

What

Two things, both born from running the cross-tool oracle against real OSS repos
(Dapper, then a blind run on App-vNext/Polly):

1. Harness fix — exclude doc/snippet trees from the product diff

scripts/oracle_compare.py _is_test_path now treats doc/docs/snippet*
path segments as non-product, alongside test/benchmark/sample/example.

Polly's src/Snippets/Docs/* is illustrative documentation code that
intentionally never disposes ~20 HttpResponseMessage/HttpClient/rate-limiter
examples. Counting those as product leaks inflated the oracle-only recall gap
with code that was never meant to dispose. Confirmed live on Polly:

metric before after
Own.NET / Infer# / CodeQL (leak) 0 / 12 / 26 0 / 12 / 4
oracle-only 38 16
own-only 0 0
out-of-scope context noise 203 61

The remaining 16 oracle-only is now a fully-explained set — 12 Infer#
TimedLock struct-using over-reports + 3 triaged product findings (2 CodeQL FPs
on ownership-transfer / deferred-dispose + 1 by-design exceptional-path) — i.e.
zero genuine recall gap, precision held (own-only 0) on a third repo. Selftest
extended to cover the doc/snippet exclusion; 24/24 green.

2. Field-notes pattern log + a repo requirement to maintain it

New docs/notes/field-notes-patterns.md: a curated, source-pinned collection of
real C# resource/lifetime idioms found in the wild — ownership transfer via
factory return, deferred disposal via lifecycle callback, pooled rent/return
disposables, struct-using scoped locks, the two-semaphore bulkhead,
dispose-forwarding wrappers. Each entry pins the source file and the analyzer
angle
(why naive leak detectors over-report and why a transfer/escape-aware
checker correctly stays silent), so the doc doubles as a C# learning resource and
a map of Own.NET's precision frontier.

Codified as a standing convention (normative, in three cross-linked places —
README callout, oracle.md § Maintenance requirement, the notebook's own header):
every oracle run must triage oracle-only and record any FP/by-design idiom in
the notebook. A run that surfaces a new idiom and doesn't append it is an
incomplete run.
oracle.md also gains a second worked example (Polly) decomposing
the oracle-only 38 honestly.

Files

  • scripts/oracle_compare.py_is_test_path widened + selftest (24/24).
  • docs/notes/field-notes-patterns.md — new pattern notebook.
  • docs/notes/oracle.md — Polly worked example + Maintenance-requirement section + field-notes cross-link.
  • README.md — convention callout next to the oracle description.

Not included

The dev-loop scaffolding used to run the oracle (push-trigger repoint + target
sentinel bumps — the automation token can't workflow_dispatch) was reverted to
main; it isn't meant to land. Pure additive value only.

🤖 Generated with Claude Code


Generated by Claude Code

Summary by CodeRabbit

  • Documentation
    • Added a new “convention” section requiring mandatory triage after each oracle run, with tracking of oracle false positives and by-design skips.
    • Introduced “Field notes” documenting recurring resource and lifetime ownership idioms, including analyzer-angle guidance.
    • Expanded the oracle guide with a deeper Polly walkthrough and clearer breakdown of oracle noise vs. actual recall gaps.
  • Bug Fixes
    • Improved oracle comparison filtering to correctly treat doc/docs and snippet/snippets paths as non-product, without mistakenly excluding similarly named product directories.

claude added 8 commits June 26, 2026 04:07
Dispatch via API is blocked for the automation token (403), so use the
documented push fallback: run the cross-tool oracle by bumping the
sentinel corpus/oracle-target.txt on the active dev branch. Repoint the
push trigger from the stale branch to claude/agenda-2rufsj and add a
re-run note so the three-way diff (Own.NET vs Infer# vs CodeQL) runs on
the systemevents-console fixture — the Linux-buildable target where all
three tools, Infer# included, fire.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fmwk5ruExKy5fQ77CJ2NtF
Re-run the documented Dapper worked example on a live clone after the
P-014 Tier A/B work to confirm the full cross-tool pipeline (clone ->
build -> own-check + CodeQL + Infer#) still holds on external code.
Expected baseline: agree 0, own-only 0 (no false positives), oracle-only
~5 (Infer# ownership-transfer over-reports + CodeQL dispose-on-throw).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fmwk5ruExKy5fQ77CJ2NtF
Exploratory cross-tool run on a fresh external target with no documented
baseline, to see if Own.NET surfaces own-only (candidate FPs) or
oracle-only (recall gaps) on code it was not tuned against. Polly v8
targets net8/net6/netstandard2.0 only, so it builds on the dotnet-8
runner and all three tools should fire.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fmwk5ruExKy5fQ77CJ2NtF
…rked example

Two findings from the blind Polly oracle run (own-only 0, oracle-only 38):

1. _is_test_path now treats doc/docs/snippet* path segments as
   non-product, alongside test/benchmark/sample/example. Polly's
   src/Snippets/Docs/* is illustrative code that intentionally never
   disposes ~20 HttpResponseMessage/HttpClient/rate-limiter examples;
   counting them as product leaks inflated the oracle-only recall gap
   with code that was never meant to dispose. Selftest extended to cover
   the doc/snippet exclusion; 24/24 green.

2. docs/notes/oracle.md gains a second worked example (Polly), recording
   the ownership-transfer precision win: BulkheadSemaphoreFactory returns
   two SemaphoreSlim that BulkheadPolicy owns and disposes in Dispose() —
   CodeQL's cs/local-not-disposed flags the factory (a false positive it
   can't trace through tuple-return ownership), and Own.NET is correctly
   silent. Second live ownership-transfer win after Dapper's
   DbWrappedReader. The note decomposes the full oracle-only 38 (Infer#
   struct-using over-reports + doc snippets + 2 CodeQL FPs + 1 by-design
   exceptional-path skip) so the headline number is read honestly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fmwk5ruExKy5fQ77CJ2NtF
Bump the sentinel to re-trigger the oracle on Polly after fd6294e. The
~20 src/Snippets/Docs/* CodeQL findings should now drop as non-product:
oracle-only 38 -> ~18, own-only still 0.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fmwk5ruExKy5fQ77CJ2NtF
…runs

A running notebook of real resource/lifetime idioms spotted while
running the cross-tool oracle at open-source repos (Polly, Dapper):
ownership transfer via factory return, deferred disposal via lifecycle
callback, pooled rent/return disposables, struct-using scoped locks, the
two-semaphore bulkhead, and dispose-forwarding wrappers. Each entry pins
the source file and the analyzer angle (why naive leak detectors
over-report and a transfer/escape-aware checker correctly stays silent) —
so the collection doubles as a learning resource and a map of Own.NET's
precision frontier. Cross-linked from oracle.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fmwk5ruExKy5fQ77CJ2NtF
Codify the pattern-logging convention normatively in three places so it
binds future runs (and contributors/agents), not just lives as a soft
note at the bottom of the notebook:

- README.md: a 'Требование (convention)' callout next to the oracle
  description — every oracle run obliges triaging oracle-only and
  recording any FP/by-design idiom in field-notes-patterns.md.
- oracle.md: a '## Maintenance requirement (not optional)' section in the
  run procedure — a run that surfaces a new FP/by-design idiom and
  doesn't append it is an incomplete run.
- field-notes-patterns.md: the closing note rewritten as a normative
  '## Maintaining this notebook (a repo requirement)', with the
  source-pinned + honest-confidence discipline spelled out.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fmwk5ruExKy5fQ77CJ2NtF
Revert .github/workflows/oracle.yml and corpus/oracle-target.txt to
main: the push-trigger repoint and target bumps were dev-loop scaffolding
used to run the oracle (the automation token can't workflow_dispatch),
not changes meant for main — the workflow's own comment says the
push-trigger block is dev-branch-only. The PR keeps just the substantive
work: the _is_test_path doc/snippet exclusion fix and the field-notes /
oracle.md / README documentation.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fmwk5ruExKy5fQ77CJ2NtF
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d1a7fda6-d71f-4b0e-ba7e-6efbf35f934e

📥 Commits

Reviewing files that changed from the base of the PR and between 6b5b10b and 1fad359.

📒 Files selected for processing (1)
  • docs/notes/oracle.md
✅ Files skipped from review due to trivial changes (1)
  • docs/notes/oracle.md

📝 Walkthrough

Walkthrough

This PR broadens oracle path filtering and adds documentation for triaging oracle-only findings into a maintained field-notes notebook.

Changes

Oracle triage maintenance

Layer / File(s) Summary
Comparator path classification
scripts/oracle_compare.py
_is_test_path now treats doc/docs and snippet/snippets path segments as non-product, and the selftest covers those paths.
Field notes notebook
docs/notes/field-notes-patterns.md
The notebook adds a curated collection of C# ownership and lifetime idioms with source references, code sketches, analyzer-angle notes, and upkeep guidance.
Oracle bookkeeping workflow
README.md, docs/notes/oracle.md
The docs add a required post-oracle triage step for oracle-only findings and a worked Polly example that classifies findings as false positives, by-design skips, or product issues.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • PhysShell/Own.NET#21: The oracle documentation here discusses the same oracle-only doc/snippet-tree exclusion behavior that this PR reflects in scripts/oracle_compare.py.
  • PhysShell/Own.NET#26: Also adjusts scripts/oracle_compare.py path-scoping and --exclude-tests behavior.

Poem

I hopped through oracle grass at dawn, 🐇
and tucked the false positives into a notebook drawn.
Docs and snippets now know their place,
while field notes keep the rabbit pace.
I twitched my nose; the patterns stayed.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main changes: doc/snippet tree exclusion and the new field-notes pattern log requirement.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/agenda-2rufsj

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5b5bc1c592

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/oracle_compare.py Outdated
for seg in path.lower().split("/"):
if seg in ("test", "tests") or seg.startswith(("benchmark", "sample", "example")):
if (seg in ("test", "tests", "doc", "docs")
or seg.startswith(("benchmark", "sample", "example", "snippet"))):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Don't drop product paths that start with snippet

Because the oracle workflow adds --exclude-tests by default unless include_tests is true, this predicate now removes every finding under any product directory whose segment merely starts with snippet (for example src/SnippetEngine/Foo.cs or src/SnippetService/...). Polly's src/Snippets/Docs/* case is already covered by the exact docs segment, so the new broad prefix can silently suppress real product leaks from the report and JSON totals; restrict this to exact snippet/snippets or require an accompanying docs segment.

Useful? React with 👍 / 👎.

startswith('snippet') would drop real product dirs like SnippetEngine/
SnippetService. Make snippet/snippets exact-match (Polly's
src/Snippets/Docs/* stays covered by the exact snippets+docs segments);
keep prefix match only for the long unambiguous benchmark/sample/example.
Selftest now asserts src/SnippetEngine and src/Documentation are NOT
treated as non-product.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fmwk5ruExKy5fQ77CJ2NtF

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/notes/oracle.md`:
- Around line 157-208: The Polly bucket totals in the worked example do not
reconcile cleanly with the stated oracle-only total, so update the summary in
the documentation to make the counts consistent. Check the breakdown in the
Polly section around the Infer#, CodeQL, and genuinely-product findings, then
either correct the individual bucket counts so they sum to the stated
oracle-only 38 or explicitly mark the per-bucket numbers as approximate. Keep
the wording aligned with the existing Polly narrative and the cited symbols like
TimedLock, BulkheadSemaphoreFactory, ConfigureBuilderContextExtensions, and
TimeoutResilienceStrategy.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 19f20ce6-dfa6-46f2-bd82-bdfbc04e2a85

📥 Commits

Reviewing files that changed from the base of the PR and between b5c3966 and 5b5bc1c.

📒 Files selected for processing (4)
  • README.md
  • docs/notes/field-notes-patterns.md
  • docs/notes/oracle.md
  • scripts/oracle_compare.py

Comment thread docs/notes/oracle.md
The sub-buckets now sum exactly to oracle-only 38 = 12 Infer# TimedLock
over-reports + 22 CodeQL src/Snippets/Docs findings + 4 product CodeQL
(3 FPs across BulkheadSemaphoreFactory:8/:11 + ConfigureBuilderContext:40,
plus 1 by-design TimeoutResilienceStrategy:67). Were '~20' + 'a handful'.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Fmwk5ruExKy5fQ77CJ2NtF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants