Skip to content

fixed reassemble and query format module#96

Merged
wpak-ai merged 5 commits into
cppalliance:mainfrom
jonathanMLDev:bugfix/reassemble-deprecation-warn
May 19, 2026
Merged

fixed reassemble and query format module#96
wpak-ai merged 5 commits into
cppalliance:mainfrom
jonathanMLDev:bugfix/reassemble-deprecation-warn

Conversation

@jonathanMLDev
Copy link
Copy Markdown
Collaborator

@jonathanMLDev jonathanMLDev commented May 18, 2026

Pull Request

Reassemble skip signal

  • src/server/reassemble-documents.ts: Count hits whose document key is empty; after the grouping loop, if skippedHits > 0, call warn once with total count and up to 3 sample vector ids ( when id is blank). Message explains missing document_number, url, doc_id, or non-empty vector id.
  • src/server/reassemble-documents.test.ts: vi.spyOn on ../logger.js warn in beforeEach/afterEach; tests for no warn when all keys valid, single skip, two skips one warn, mixed valid/invalid, and sample-id cap (using document_number: '' so keys stay empty while ids differ).

Deprecation WARN latch

src/server/format-query-result.ts: Deprecation warn runs on the first formatSearchResultAsRow call in the process (still once per session via the latch), not only when document_id !== null. QueryResultRow.paper_number JSDoc updated to match.

  • New src/server/format-query-result.test.ts: Reset latch + mock warn; asserts warn on first row with document_id null, no second warn, and a single warn for formatQueryResultRows with two hits.

Summary by CodeRabbit

  • Bug Fixes

    • Deprecation warning for paper number now logs exactly once per session
    • Added a single aggregated warning when search hits lack document keys, including a sampled list of hit IDs
  • Tests

    • Added tests verifying deprecation warning behavior across calls
    • Added tests validating aggregated skip warnings and sampled ID reporting

Review Change Stack

@jonathanMLDev jonathanMLDev self-assigned this May 18, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 18, 2026

Warning

Rate limit exceeded

@jonathanMLDev has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 53 minutes and 3 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8e8fc97f-4121-4752-bc95-7f816e6368ca

📥 Commits

Reviewing files that changed from the base of the PR and between e5b0718 and 77f40d9.

📒 Files selected for processing (2)
  • src/server/reassemble-documents.test.ts
  • src/server/reassemble-documents.ts
📝 Walkthrough

Walkthrough

This PR adds deprecation and warning logging for two scenarios: paper_number now emits a once-per-session deprecation WARN regardless of document ID presence, and reassembleByDocument aggregates and logs a single warning for hits missing valid document keys, including sampled vector IDs. Both behaviors include tests asserting single-fire semantics and message contents.

Changes

Deprecation and Skip-Hit Warning Behavior

Layer / File(s) Summary
paper_number deprecation warning
src/server/format-query-result.ts, src/server/format-query-result.test.ts
Updated JSDoc and changed the gating in formatSearchResultAsRow to emit the paper_number deprecation WARN once per session regardless of document_id. Tests reset the latch, spy on logger.warn, and assert a single warning on first use and no repeats across subsequent formatSearchResultAsRow or formatQueryResultRows calls; message content is validated.
Skipped hits warning and tracking
src/server/reassemble-documents.ts, src/server/reassemble-documents.test.ts
Imported warn as logWarn, added constants for chunk metadata and sample-cap, updated getDocumentKey to treat only non-empty trimmed metadata or hit.id as valid, counted and sampled skipped hits during grouping, and emitted one aggregated logWarn with count and sample IDs after processing. Tests verify no warning for all-valid hits, a single aggregated warning for invalid/orphaned hits, correct behavior when mixed valid/invalid hits are present, and sample-ID inclusion limits via regex checks.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • wpak-ai

Poem

🐇 I hop through code with careful paws,
A warning once for aging fields—applause!
Lost hits I count, a sample shown,
One gentle log so truth is known.
Logs tidy now — hop, skip, and go!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'fixed reassemble and query format module' is vague and uses non-descriptive language that doesn't convey the specific nature of the changes (deprecation warning latch and reassemble skip signal). Use a more descriptive title that highlights the main changes, such as 'Add deprecation warning latch and skip hit logging for reassemble and query format' to better communicate the purpose of the PR.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@66fe34a). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #96   +/-   ##
=======================================
  Coverage        ?   80.63%           
=======================================
  Files           ?       34           
  Lines           ?     1265           
  Branches        ?      414           
=======================================
  Hits            ?     1020           
  Misses          ?      243           
  Partials        ?        2           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jonathanMLDev
Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 18, 2026

✅ Actions performed

Full review triggered.

@jonathanMLDev
Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 18, 2026

✅ Actions performed

Full review triggered.

@whisper67265 whisper67265 requested a review from wpak-ai May 19, 2026 00:23
@wpak-ai
Copy link
Copy Markdown
Collaborator

wpak-ai commented May 19, 2026

@coderabbitai resume

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

✅ Actions performed

Reviews resumed.

@wpak-ai
Copy link
Copy Markdown
Collaborator

wpak-ai commented May 19, 2026

@coderabbitai full review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

✅ Actions performed

Full review triggered.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/server/reassemble-documents.ts`:
- Around line 80-86: The skip logic is treating an empty string key as invalid
but getDocumentKey can return '' (e.g., from document_number) preventing the
fallback to hit.id; update the code around where key is obtained
(getDocumentKey) so blank metadata values are normalized to undefined/null
(e.g., trim and if key === '' set key = undefined) before the existing "if
(!key) { skippedHits++; ... continue; }" check so valid hits with non-empty
hit.id are not dropped or warned (preserve use of sampleIdsForWarn and
SKIP_WARN_SAMPLE_IDS for warnings).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 36e17989-38f9-487f-8ec7-589a0e0b1521

📥 Commits

Reviewing files that changed from the base of the PR and between 4eadc6c and d72ad7f.

📒 Files selected for processing (4)
  • src/server/format-query-result.test.ts
  • src/server/format-query-result.ts
  • src/server/reassemble-documents.test.ts
  • src/server/reassemble-documents.ts

Comment thread src/server/reassemble-documents.ts
@wpak-ai wpak-ai merged commit c8f35db into cppalliance:main May 19, 2026
12 checks 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.

3 participants