Repository navigation
fix(domain): typed fail-closed analysis scope on Finding (#5531) - #9941
Conversation
Replace the free-text `analysis_scope: repo` evidence marker as the scope authority with a typed `Finding.analysis_scope` (Diff|Repo). Every Finding construction must state its scope; repo producers set it through `Finding::mark_repo_scoped`, which also derives the disclosed compatibility evidence line in one place. Consumers (TypeScript gap record, Python repair card) read `Finding::analysis_mode`, which fails closed when the typed scope and the legacy evidence line disagree. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EsjwSbvSPQdZfNsK689oNn
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Next included review available in 27 minutes. View limit details
Comment |
There was a problem hiding this comment.
Code Review
This pull request introduces an explicit AnalysisScope enum to track whether a Finding was produced under Diff or Repo mode, replacing the legacy approach of relying solely on free-text evidence lines. It updates Finding constructions across tests and adapters, implements safe resolution logic (analysis_mode) that fails closed on contradictions, and ensures backward-compatible serialization. The review feedback suggests importing REPO_SCOPE_EVIDENCE_LINE locally within mark_repo_scoped to clean up fully-qualified paths, and recommends using the REPO_SCOPE_EVIDENCE_LINE constant instead of hardcoded string literals in the newly added tests in typescript_packet_projection.rs and human.rs.
… and tests (#5531) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EsjwSbvSPQdZfNsK689oNn
|
Head 58120f8. Results:
Generated by Claude Code |
There was a problem hiding this comment.
Decision
- Needs reviewer attention before upstream: findings remain.
Confirmed findings
- Typed scope is centralized in Finding and derived repo evidence is idempotent, preventing producer-local duplicate scope logic.
- Both repair-card consumers use analysis_mode rather than independently interpreting the compatibility evidence marker.
Verification questions
- Confirm rust compilation and feature-gated consumer tests are the remaining proof dependency because the ripr sensor failed with exit code 2.
- Confirm a complete sibling inventory of capability-table consumers is not present in the supplied packet, so absence of additional bypasses outside the named pair is not independently established.
Refuted
- This source-UB packet indicates a newly introduced unsafe memory-lifetime issue.; refuted because: The patch changes typed metadata and capability gating; unsafe-review found no new or worsened gaps, and the inspected changed paths contain no new unsafe pointer or thread-lifetime contract.
- The typed-scope refactor exposes an ArrayBuffer/TypedArray resize, detach, transfer, or stale-length safety issue.; refuted because: The changed logic copies ProbeId, pushes owned strings, matches an enum, and scans immutable evidence. None of these operations reallocates, moves, detaches, transfers, or resizes an active-view backing store.
- Repo-mode scope marking could race with asynchronous mutation of Finding evidence and create duplicate compatibility lines.; refuted because: No changed route exposes concurrent or async access; mark_repo_scoped performs a synchronous mutation, and its single-threaded call path cannot interleave with another invocation.
- The typed scope addition could expose an unsafe or information-disclosure primitive.; refuted because: No unsafe/native operation or sensitive-data sink is introduced. The enum owns control-flow metadata, and unsafe-review reports zero new or worsened gaps.
- The PR changes public output by serializing the new enum for ordinary diff findings.; refuted because: AnalysisScope defaults to Diff and serde skip_serializing_if omits Diff; the new serialization test asserts omission and repo round-trip, consistent with the seeded byte-identical golden/render evidence.
Evidence gaps
- Model proof intent was rejected by deterministic validation.
- Execution evidence for the targeted tests is scheduled but not yet present in the supplied receipts.
…ort JSON (#5531) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EsjwSbvSPQdZfNsK689oNn
…5531) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EsjwSbvSPQdZfNsK689oNn
…ne added in #9941 The fact-index projection digests hash the findings' Debug rendering. #9941 added Finding.analysis_scope, which changed all three digests on main. Every Perl finding is diff-scoped, so dropping that one line renders the exact field set the pre-index implementation produced; the original #8896 digests match again, so the byte-level equivalence claim is kept rather than re-pinned. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ko9uTzfEN9vJcshsDpo2NB
…cope line (#10007) The fact-index projection digests hash the findings' Debug rendering. #9941 added Finding.analysis_scope, which changed all three digests on main. Every Perl finding is diff-scoped, so dropping that one line renders the exact field set the pre-index implementation produced; the original #8896 digests match again, so the byte-level equivalence claim is kept rather than re-pinned. Claude-Session: https://claude.ai/code/session_01Ko9uTzfEN9vJcshsDpo2NB Co-authored-by: Claude <noreply@anthropic.com>
Summary
analysis_scope: repoevidence marker as the scope authority with a typed, requiredFinding.analysis_scope(Diff | Repo), so a repo-mode producer cannot omit its scope and consumers fail closed.Swarm / Source Boundary
ripr-swarmSource-of-Truth Links
Proposal: n/a
Spec: n/a (capability registry, #5531)
ADR: n/a
Plan item: #5531
Governing issue or accepted claim: #5531 (typed, fail-closed analysis scope replacing the evidence-line marker for repo-mode TS/JS #9896 and Python #9923)
Acceptance delta (one sentence): A repo-mode finding's scope is a typed domain field set by construction (not an optional evidence string), and the TypeScript gap-record and Python repair-card consumers read it and fail closed when scope is repo or contradictory.
Candidate Relationships
Candidate branch: claude/typed-analysis-scope
Stack parent or prerequisite PR (if any): none
Proposed replacement of PR (if any; not yet accepted): none
Acceptance retained from a replaced candidate (if any): n/a
Accepted winner and losing candidate disposition (when decided): n/a
Scope
AnalysisScopeenum, requiredFinding.analysis_scope,Finding::mark_repo_scoped,Finding::analysis_mode.mark_repo_scoped.typescript_gap_record_for,python_repair_cardreadanalysis_mode().analysis_scope: Diffadded at the 51 existing Finding literals.Scope Classification
Production delta:
analysis_scope: repo(disclosed in docs/LANGUAGE_ADAPTER_PREVIEW.md) is now derived from it in one place and kept infindings[].evidence.Finding::analysis_mode()returnsNone(no card/packet) when typed scope is Diff but the legacy line says repo.default+skip_serializing_if = diff, so serialized diff Findings are byte-identical. No JSON schema field added. The typed field is not in the hand-rendered check report JSON; scope round-trips through that report via the evidence line, and a contradiction fails closed (documented in docs/LANGUAGE_ADAPTER_PREVIEW.md).Findingis public and the new field is required, so externalripr::Finding { .. }struct literals stop compiling until they addanalysis_scope. That is the price of having no silentDiffdefault; it is what makes an unscoped repo finding impossible to construct. (AnalysisScopeis re-exported at the crate root; policy/public_api.txt is updated.)Evidence/support delta:
mark_repo_scopedidempotent; serialization omits/roundtrips scope.analysis_scope == Repo, and the diff-mode control hasDiff(producer_sets_typed_analysis_scope_*).Single acceptance criterion:
Non-goals:
Support-tier Impact
Claim/proof notes:
Policy Impact
AnalysisScopelines)Proof
Result, failures, or skipped proof:
cargo xtask precommit: exit 1 only on thecovered_byinstrument timeout (SIGKILL after 300s under cargo lock contention); no source/policy gate failed. Hosted CI covers the remainder.Claim Boundary
May claim: scope is typed and consumers fail closed. Must not claim: any change to repo-mode repair support (still not_proven) or to public output.
Rollback
Revert the squash commit; no schema or persisted-format change.
Spec-Test-Code Traceability
Static Language Check
killed,survived,untested,proven, andadequate.CI Economics
n/a
Engineering Check
panic,unwrap,expect,todo, orunimplementedin production code.panic,unwrap,expect,todo, orunimplementedin tests.🤖 Generated with Claude Code
https://claude.ai/code/session_01EsjwSbvSPQdZfNsK689oNn