Skip to content

fix: fall back to claim-level citation titles in the generated Sources section#67

Merged
enlorik merged 1 commit into
mainfrom
feature/claim-review-source-display
Jul 20, 2026
Merged

fix: fall back to claim-level citation titles in the generated Sources section#67
enlorik merged 1 commit into
mainfrom
feature/claim-review-source-display

Conversation

@enlorik

@enlorik enlorik commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Improve source display in claim review and markdown drafts

Went digging into the claim review source display work and most of it was already solid - multi-URL display and titles in the review panel, and URL dedup in the generated Sources section were already there from earlier passes. SelectedClaimsDraftBuilder only resolved Sources titles from the provider's top-level citation list, so it was relying on every claim's citationTitles always being a subset of that list. That happens to hold today since both are built from the same answer.citations, but it's an implicit assumption rather than an enforced one, so I made the builder fall back to a claim's own citationTitles when a URL isn't in the provider list, instead of silently dropping to the bare URL. Added two tests (saved note keeps source title, appended note keeps source title) covering that fallback directly. Went from 489 to 491 tests, flutter analyze is clean. Didn't touch the Brave provider, didn't add any network calls, and didn't redesign the review UI beyond this.

@enlorik

enlorik commented Jul 9, 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: 3cdeb4cedc

ℹ️ 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 lib/screens/search_screen.dart
@enlorik

enlorik commented Jul 9, 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: d95887fa55

ℹ️ 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 lib/screens/search_screen.dart
@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. Keep it up!

Reviewed commit: cb8897928a

ℹ️ 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-loading-error-states July 9, 2026 13:36
@enlorik
enlorik force-pushed the feature/claim-review-loading-error-states branch from 2a7bf4a to 15fe643 Compare July 9, 2026 13:38
@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-loading-error-states branch from 4237854 to 091e9a0 Compare July 20, 2026 19:14
…s section

When a selected claim references a URL not present in the provider's top-level
citations list, use the matching entry from the claim's own citationTitles
instead of falling back to the bare URL.

- titleByUrl built from provider citations (non-empty titles only)
- putIfAbsent walk over each selected item's citationUrls/citationTitles pair
  adds claim-level titles for URLs the provider list doesn't cover
- Safe bounds check: citationTitles shorter than citationUrls never throws
- Provider-level title always wins over a conflicting claim-level title
- Sources deduplication, deterministic order, and sourceCount are unchanged

Tests:
- _item() helper accepts citationTitles parameter
- 6 focused unit tests covering all fallback/precedence/edge-case scenarios
- 1 save-persistence test: saved draft retains claim-level source title
- 1 append-persistence test: appended draft retains claim-level source title

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@enlorik
enlorik force-pushed the feature/claim-review-source-display branch from 72c2965 to c21d2bb Compare July 20, 2026 20:03
@enlorik
enlorik changed the base branch from feature/claim-review-loading-error-states to main July 20, 2026 20:03
@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. What shall we delve into next?

Reviewed commit: c21d2bbdfe

ℹ️ 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 marked this pull request as ready for review July 20, 2026 21:25
@enlorik
enlorik merged commit 59bff55 into main Jul 20, 2026
1 check passed
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