Skip to content

claims: a draft joins a claim of its sentence by the claim's active quote (#211) - #214

Merged
ojungo69 merged 1 commit into
mainfrom
fix/keyed-active
Sep 28, 2026
Merged

ojungo69 merged 1 commit into
mainfrom
fix/keyed-active

Conversation

@ojungo69

@ojungo69 ojungo69 commented Sep 28, 2026 •

Copy link
Copy Markdown
Owner

Closes #211. From the Codex review of #210 (round 2), moved to an issue under that PR's stop rule.

What

curate::keyed gives a draft the claim_at of the claim its quote overlaps in the same sentence. It looked at every derivation of that kind in the sentence, active or not. A claim first quoted with its whole sentence and later narrowed kept its old wide quote in the lookup. A later draft anywhere in the sentence then overlapped it and took the same uid, so one of two current claims was hidden.

The lookup now reads each uid's active derivation only (claims joined to derivations). A draft joins a claim by the range the claim quotes now.

Test

an_old_wide_quote_joins_no_claim_to_a_narrowed_one: a claim quoted with the whole sentence, then narrowed, then a recuration that gives the narrow claim and one apart from it. The narrow claim keeps its uid, and the other gets its own. Matching against every derivation turns it red.

Review stop rule (declared before the first round)

A finding is fixed here only if a plain environment reaches it and it hides a current claim or changes the uid of a claim written before this change. Everything else goes to an issue. After two rounds in a row whose findings all go to issues, or a 👍, this PR is merged with no further commit once check and CodeQL are green.

🤖 Generated with Claude Code

https://claude.ai/code/session_012wbKzQZyG5Aq6poybwciHt

Summary by Sourcery

Match draft claims against active quotes so narrowed claims no longer hide distinct claims in the same sentence.

Bug Fixes:

  • Ensure drafts join only the currently active derivation of a claim, preventing an older wider quote from incorrectly absorbing a separate current claim.

Tests:

  • Add regression coverage for preserving claim identity when a sentence-wide quote is narrowed and a separate claim is later recurat​ed.

…ive derivations quote them, so an old wide quote joins no two claims (#211)

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

@sourcery-ai sourcery-ai 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.

Sorry @ojungo69, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 2 hours and 1 minute by commenting @sourcery-ai review. Upgrade to get a review now.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@coderabbitai

coderabbitai Bot commented Sep 28, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 130affcd-c9b7-4472-8380-dbf6be21c7cd


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-28T09:56:53.550449Z cb12ab7 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@sourcery-ai

sourcery-ai Bot commented Sep 28, 2026

Copy link
Copy Markdown

Reviewer's Guide

Updates claim keying to match drafts against only the active quote for each existing claim, eliminating false UID reuse from obsolete wide quotes, and adds a regression test covering narrowing followed by a separate adjacent claim.

Sequence diagram for active-quote claim keying

sequenceDiagram
    participant Draft as Draft
    participant Keyed as curate::keyed
    participant DB as ClaimsAndDerivations
    participant UID as ClaimUIDs

    Draft->>Keyed: keyed
    Keyed->>DB: SELECT active claim quote via claims JOIN derivations
    DB-->>Keyed: active quote range
    Keyed->>Keyed: match draft quote overlap
    alt overlaps active quote
        Keyed->>UID: reuse claim_at
    else no overlap
        Keyed->>UID: assign independent claim_at
    end
Loading

Flow diagram for narrowed-quote UID preservation

flowchart LR
    Wide["Initial whole-sentence quote"] --> Narrow["Same claim narrowed to active quote"]
    Narrow --> Recurate["Recuration with narrow claim and adjacent claim"]
    Recurate --> Same["Narrow claim keeps its UID"]
    Recurate --> Separate["Adjacent claim receives its own UID"]
Loading

File-Level Changes

Change Details Files
Restrict claim-overlap lookup to each claim’s active derivation, preventing superseded wide quotes from matching new drafts.
  • Join claims to derivations using the derivation operation identity.
  • Continue matching only same-kind claims and evidence in the same sentence, but use the active quote range.
  • Document that narrowed claims no longer retain historical wide-quote matches.
src/curate.rs
Add regression coverage for recuration after narrowing a previously sentence-wide quote.
  • Verify the narrowed claim preserves its UID across recuration.
  • Verify an adjacent claim receives a distinct UID and both remain active.
src/curate.rs

Assessment against linked issues

Issue Objective Addressed Explanation
#211 Prevent stale, wider derivations from causing separate current claims in the same sentence to inherit the same claim UID. ✅
#211 Make curate::keyed match drafts against each claim's active derivation, preserving the narrowed claim's UID while assigning a distinct UID to a separate claim. ✅
#211 Add an acceptance test covering a claim narrowed after an old whole-sentence quote and a later separate claim in the same sentence. ✅

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sonarqubecloud

Copy link
Copy Markdown

@ojungo69
ojungo69 merged commit 0467c9d into main Sep 28, 2026
16 of 17 checks passed
@ojungo69
ojungo69 deleted the fix/keyed-active branch September 28, 2026 10:02
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

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.

claims: an old broad quote can give two claims of one sentence one uid (from #210)

1 participant