Repository navigation
Add @Confined correctness contract for call- and frame-confined types - #12997
gh-worker-dd-mergequeue-cf854d[bot] merged 3 commits into
Conversation
🟢 Java Benchmark SLOs — All performance SLOs passed
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
b017ada to
4c42be5
Compare
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4c42be57f2
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
bric3
left a comment
There was a problem hiding this comment.
LGTM, left a couple comments over the codex findings,
bric3
left a comment
There was a problem hiding this comment.
added a few polish comments
There was a problem hiding this comment.
More details
The stream refactor preserves stable-entry materialization while exposing Stream, consistent with declared-type confinement. The contract explicitly permits producer-owned cursors, addressing the earlier iterator concern.
🤖 Bits Code Review · Commit 31ab8d0
@CorrectnessContract marks annotations that state a MUST: breaking one is a bug, so unlike a perf contract there is no suppression. @Confined, the first, says where an instance of a type stays valid: CALL (the call it was passed into) or FRAME (the frame that obtained it). EntryReader is the first user. A store may answer with a flyweight it reuses, so a kept reader can later report another tag; @Confined(FRAME) lets review catch one stored in a field or collection. Entry implements EntryReader and is the keepable form, so the rule follows the declared type. AGENTS.md points reviewers at the checker contracts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
TagMap's iterator keeps its look-ahead reader in a field, which the every-extent rule forbade: the rule binds consumers, and the code that produces and recycles an instance may hold the one it is handing out. stream() yields stable Entry objects, so it is now typed Stream<Entry>; under the declared-type rule, Stream<EntryReader> made collecting it a violation. Also define CALL as a borrowed argument and FRAME as local use, and link RFC 2119. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
31ab8d0 to
74dbb1a
Compare
There was a problem hiding this comment.
More details
The stream refactor preserves stable Entry materialization, so collecting a stream does not retain reusable readers. The confinement contract also explicitly permits producers to hold the instances they recycle.
🤖 Bits Code Review · Commit 74dbb1a
LLM ValidationLLM Validation Gate — java-agent-instructions✅ PASS
6 case(s) · quality 81.4 → 81.2 (-0.1) · win-rate 50% [50%–50%] Details — analysis and per-case resultsAnalysisChanged instruction file(s): No safety or blocking-case regressions across 6 case(s). Overall pairwise win-rate 50% [50%–50%], quality -0.1 — see the verdict above for whether that clears the noise band. Results
Cases
Per-dimension scores, token usage, latency, and estimated cost are in the CI job logs. |
The Javadoc promises extents run from narrowest to widest, so a new one must go in its place, not at the end. Nothing executed the enum before, which failed internal-api's coverage check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
/merge |
|
View all feedbacks in Devflow UI.
It will be processed automatically as soon as GitHub reports it as mergeable. View in MergeQueue UI.
The expected merge time in
|
What Does This Do
Adds a second contract family next to the perf contracts:
@CorrectnessContract: a meta-annotation for rules code must follow, in the RFC 2119 sense. A violation is a bug, not a tradeoff. Unlike@PerfContractthere is no suppression: code that needs to break the rule shows the contract is wrong for that type, so the annotation changes instead of the use being exempted. (@SuppressPerfContractnaming one is already invalid, since itsvaluemust be perf contracts.)@Confined(Extent), the first correctness contract: where an instance stays valid.CALL: only during the call it was passed into.FRAME: only in the frame that obtained it, and completed on every path before that frame exits. For anAutoCloseabletype, that means a try-with-resources (the same shape Error Prone's@MustBeClosedchecks), unless the obtaining method returns it and hands the obligation to its caller.Both imply the instance never crosses threads. The rule follows the declared type: a subtype that doesn't carry the annotation is unconfined when declared as that subtype.
First user:
TagMap.EntryReader→@Confined(FRAME). A store may answer with a flyweight it reuses for the next read or write, so a reader kept in a field or collection can later report another tag's value.EntryimplementsEntryReaderand is the keepable form, which is why the rule goes by declared type.AGENTS.mdgets one review rule: when a change uses a type carrying a correctness contract, check it against that contract's Checker contract. Like the perf contracts, this is documentation plus a machine-readable checker contract for AI review; no static checker enforces it yet. The checker contract applies to production source sets: tests and benchmarks that misuse a type on purpose, to verify its behavior, are outside the rule.Motivation
EntryReader's Javadoc says a reader MUST NOT be kept past the call that produced it, but nothing checks it. A review of #13004 (the dense id store, whose readers are reused flyweights) asked for a guard before dense tags go on by default.@NoEscapeis close, but it is a SHOULD: retaining a@NoEscapevalue costs performance and can be exempted with a reason. Keeping a reader corrupts data.Additional Notes
THREAD(outlives the frame, never crosses threads) was considered and left out until a real type needs it; the enum can grow.@Confinedtargets types only.Reservation(FRAME) and retry lease (CALL). Those annotations follow once Add WorkQueue<T> with MPSC and MPMC array backings (perf toolbox) #12313 lands, so this PR no longer waits on it.🤖 Generated with Claude Code