Skip to content

fix(research): keep decimals intact when splitting citation claims - #278

Open
vishnujayvel wants to merge 1 commit into
KnockOutEZ:mainfrom
vishnujayvel:fix/274-citation-decimal-split
Open

fix(research): keep decimals intact when splitting citation claims#278
vishnujayvel wants to merge 1 commit into
KnockOutEZ:mainfrom
vishnujayvel:fix/274-citation-decimal-split

Conversation

@vishnujayvel

@vishnujayvel vishnujayvel commented Aug 7, 2026

Copy link
Copy Markdown

What & why

buildCitationGraph splits synthesis text into claims with a regex that treats every . as a sentence boundary. Decimal amounts in the report ($62.3 billion, 27.7 percent) were therefore cut mid-number, so citation_graph[].claim started after the decimal ("3 billion...", "7 percent...") while the report body itself stayed correct.

Fixes #274.

Credit: @oQAQo1 for the repro and root-cause analysis (sentence split at digit.digit in src/research/citation-graph.ts).

Changes

  • A digit-flanked . is no longer treated as a sentence boundary, so decimal numbers stay inside the claim.
  • Regression tests cover a single decimal, multiple decimals in one sentence, and correct multi-sentence splitting.
  • Abbreviations (e.g., U.S.) remain a known limitation of this splitter (out of scope for this fix).

Testing

  • npx vitest run tests/unit/research/citation-graph.test.ts passes (14 tests)
  • npx tsc --noEmit passes
  • Added/updated tests for the new behavior
  • Revert-proof: with the src change stashed, the new tests fail with claim text starting mid-number ("3 billion in Q4 FY2026..."), matching the issue symptom

Checklist

  • Follows Conventional Commits
  • Focused change (no unrelated refactoring)
  • I have read CONTRIBUTING.md and agree to its contribution terms

Summary by CodeRabbit

  • Bug Fixes

    • Improved sentence splitting to preserve decimal values, preventing periods in numbers from being treated as sentence breaks.
    • Maintained accurate citation mapping and confidence information across sentences containing multiple decimal values.
  • Tests

    • Added regression coverage for decimal numbers in citation claims and multi-sentence content.

The citation-graph sentence splitter treated '.' inside numbers like
$62.3 as a boundary, so claim text started mid-number. Skip '.' only
when flanked by digits; abbreviations remain a known limitation.
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 88db79c2-0bf7-4ee6-9204-4c2da2408814

📥 Commits

Reviewing files that changed from the base of the PR and between b3ccf92 and db9df57.

📒 Files selected for processing (2)
  • src/research/citation-graph.ts
  • tests/unit/research/citation-graph.test.ts

📝 Walkthrough

Walkthrough

The citation graph sentence splitter now preserves decimal values. Regression tests verify complete claims, correct sentence boundaries, source-index mappings, and confidence levels for decimal-containing research synthesis text.

Changes

Citation decimal handling

Layer / File(s) Summary
Decimal-safe sentence splitting and regression coverage
src/research/citation-graph.ts, tests/unit/research/citation-graph.test.ts
The sentence matcher no longer splits on periods between digits. Tests verify single and multiple decimal values, sentence separation, source indices, and confidence levels.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes preserving decimal values during citation-claim sentence splitting.
Linked Issues check ✅ Passed The implementation and regression tests address issue #274 by preserving decimals and maintaining sentence splitting, source mapping, and confidence behavior.
Out of Scope Changes check ✅ Passed All changes support the linked issue and PR objective; the abbreviation note and focused regression tests are directly relevant.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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.

research: citation_graph claim text truncated at decimal numbers

1 participant