Skip to content

feat: add a local-known summary and safer defaults to claim review#68

Draft
enlorik wants to merge 2 commits into
mainfrom
feature/claim-review-local-known-summary
Draft

feat: add a local-known summary and safer defaults to claim review#68
enlorik wants to merge 2 commits into
mainfrom
feature/claim-review-local-known-summary

Conversation

@enlorik

@enlorik enlorik commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Add a local-known summary and safer defaults to the claim review panel

The claim review panel treated every group the same way, so a question with a lot of already-known claims could bury the actually useful new/better-source claims below a wall of stuff you already have. Turned "Already in notes" into its own compact, collapsible section (collapses by default past 3 items) and added the matched local note title/id under each already-known claim so you can see what it's matching against instead of just trusting the classification. Also added a short line under "Better sources" explaining why a claim you already know about is still worth a look (it may have a better or missing source). Nothing about selection defaults or saveability changed -- already-known claims were never selected or saveable, this just makes that clearer. Went from 495 to 503 tests, new file claim_review_groups_panel_test.dart covers the collapse behavior, matched-evidence display/fallback, and that already-known items stay unselected/disabled even if selection state somehow includes one. flutter analyze is clean.

@enlorik

enlorik commented Jul 9, 2026

Copy link
Copy Markdown
Owner Author

@codex review

3 similar comments
@enlorik

enlorik commented Jul 9, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@enlorik

enlorik commented Jul 9, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@enlorik

enlorik commented Jul 9, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: a107b570ad

ℹ️ 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".

@enlorik
enlorik changed the base branch from main to feature/claim-review-source-display July 9, 2026 13:36
@enlorik
enlorik force-pushed the feature/claim-review-source-display branch from 6fa35aa to 161ef4b Compare July 9, 2026 13:38
@enlorik
enlorik force-pushed the feature/claim-review-local-known-summary branch from 1ea2915 to 39c2823 Compare July 9, 2026 13:39
@enlorik
enlorik force-pushed the feature/claim-review-source-display branch from 72c2965 to c21d2bb Compare July 20, 2026 20:03
- ClaimReviewItem gains matchedLocalEvidenceTitles (index-aligned with IDs)
- ClaimReviewMapper populates titles alongside IDs from the same evidence sequence
- ClaimReviewGroupsPanel: already-known group is now collapsible (threshold ≤ 3
  items starts expanded, >3 starts collapsed); keyed so a new review result that
  crosses the threshold recreates the ExpansionTile with the correct
  initiallyExpanded; already-known tiles are always unchecked/disabled regardless
  of selectedIds; matched note titles (or ID fallback) displayed below each claim;
  better-source groups show a helper explanation line
- 27 new tests covering expansion defaults (1/2/3 expanded, 4/5 collapsed),
  expand/collapse interaction, threshold-crossing regressions, disabled tile
  safety, matched-evidence display, ID fallback, missing-title safety,
  better-source helper text, and ordinary group rendering

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@enlorik
enlorik force-pushed the feature/claim-review-local-known-summary branch from 747b4d9 to e248658 Compare July 20, 2026 23:14
@enlorik
enlorik changed the base branch from feature/claim-review-source-display to main July 20, 2026 23:14
@enlorik

enlorik commented Jul 20, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@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: e248658c08

ℹ️ 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".

),
);
}
if (item.matchedLocalEvidenceIds.isNotEmpty) {

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 Restrict matched-note text to real matches

When local evidence exists, low-similarity newClaim results can still carry a bestMatch (TextSimilarityClaimDeduplicationService returns it even with reason "No sufficiently similar content found"), but this new condition renders any non-empty evidence list as Matches your notes. In that scenario a genuinely new claim is shown as matching an existing note, which is misleading and contradicts the classification/reason; the display should be limited to classifications where the evidence is actually a high-confidence local match or use less definitive wording.

Useful? React with 👍 / 👎.

// the previous session leaking into the new one.
final collapsedByDefault = group.items.length > _alreadyKnownCollapseThreshold;
return _AlreadyKnownGroupSection(
key: ValueKey(collapsedByDefault),

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 Reset expansion state for each review result

Keying the already-known section only by collapsedByDefault means two consecutive reviews on the same side of the threshold reuse the same ExpansionTile state. If a user expands one long already-known result and then asks another question that also has more than 3 known claims, the new result stays expanded and ignores initiallyExpanded: false, so the intended default collapse does not apply to common large→large review sessions.

Useful? React with 👍 / 👎.

P2-1: matched-note line was shown for newClaim items when matchedLocalEvidenceIds
is non-empty — misleading because the dedup service returns a low-similarity
bestMatch even for genuinely new claims. Now guarded to alreadyKnown and
betterSource only, where the match is a confirmed high-confidence hit.

P2-2: ValueKey(bool) meant two consecutive large reviews (both >3 items) shared
the same key, so the second review reused stale expansion state and never
applied initiallyExpanded: false. Now keyed on Object.hashAll of the bool plus
all item IDs, so any change in the item set forces widget recreation.

Tests: +2 (newClaim suppression regression, large→large expansion reset)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@enlorik

enlorik commented Jul 20, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 4c17d498d0

ℹ️ 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".

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.

1 participant