Skip to content

fix: improve page index descriptions - #17268

Merged
wangq8 merged 5 commits into
infiniflow:mainfrom
buua436:b118
Jul 23, 2026
Merged

wangq8 merged 5 commits into
infiniflow:mainfrom
buua436:b118

Conversation

@buua436

@buua436 buua436 commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Improve the PageIndex extraction template so entity descriptions are concise, source-grounded, and useful for later cross-chunk merging.

Parent headings without direct content now receive a higher-level overview instead of an empty description.

Type of change

  • Bug Fix (non-breaking change which fixes an issue)

@coderabbitai

coderabbitai Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f2702528-a37e-4117-a863-78f1ccfac8fb

📥 Commits

Reviewing files that changed from the base of the PR and between bfe7f71 and eb8869f.

📒 Files selected for processing (1)
  • api/db/init_data/compilation_templates/page_index.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • api/db/init_data/compilation_templates/page_index.yaml

📝 Walkthrough

Walkthrough

The page index compilation template now requires concise, source-grounded heading descriptions, including synthesized parent overviews when direct content is absent. Its JSON output rules now include description fields and clarify empty-content and ambiguity handling.

Changes

Page Index Extraction

Layer / File(s) Summary
Heading description extraction
api/db/init_data/compilation_templates/page_index.yaml
The template adds compact, source-grounded heading descriptions, parent overviews derived from child sections, restrictions against verbatim or meta text, empty-description handling, and an expanded JSON heading shape with description plus clarified ambiguity rules.

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

Poem

I’m a rabbit with a prompt in my paws,
Compressing pages without flaws.
Parent headings bloom with a view,
Grounded in text, concise and true.
Empty stays empty when sources do.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: improving PageIndex descriptions.
Description check ✅ Passed The description explains the problem, purpose, and change type, though it doesn’t use the repo’s exact Summary section heading.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Checkov (3.3.8)
api/db/init_data/compilation_templates/page_index.yaml

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'


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.

@buua436
buua436 marked this pull request as ready for review July 23, 2026 02:10
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jul 23, 2026
@buua436
buua436 requested a review from wangq8 July 23, 2026 02:11

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

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 `@api/db/init_data/compilation_templates/page_index.yaml`:
- Around line 9-10: Update the heading extraction prompt in the page-index
template to consistently require the entity key title rather than name, matching
the emitted JSON schema. Ensure all related instructions use title and preserve
the existing PageIndex format expected by consumers.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f03fc89d-0cd0-4120-a219-61022b69c16e

📥 Commits

Reviewing files that changed from the base of the PR and between f7446ca and bfe7f71.

📒 Files selected for processing (1)
  • api/db/init_data/compilation_templates/page_index.yaml

Comment on lines +9 to +10
entity's `name` must be the exact clean heading text. For each heading,
write a strongly compressed summary of only the content belonging to

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Use title consistently instead of name.

The prompt requires an entity name, but the emitted JSON shape uses title at Line 35. This ambiguity can produce the wrong key and break consumers expecting the existing PageIndex format.

Proposed fix
-      The entity's `name` must be the exact clean heading text.
+      The entity's `title` must be the exact clean heading text.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
entity's `name` must be the exact clean heading text. For each heading,
write a strongly compressed summary of only the content belonging to
The entity's `title` must be the exact clean heading text. For each heading,
write a strongly compressed summary of only the content belonging to
🤖 Prompt for 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.

In `@api/db/init_data/compilation_templates/page_index.yaml` around lines 9 - 10,
Update the heading extraction prompt in the page-index template to consistently
require the entity key title rather than name, matching the emitted JSON schema.
Ensure all related instructions use title and preserve the existing PageIndex
format expected by consumers.

@wangq8 wangq8 added the ci Continue Integration label Jul 23, 2026

@wangq8 wangq8 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for this improvement! The updated page_index template is a solid enhancement — making entity descriptions more source-grounded, concise, and useful for cross-chunk merging is exactly the right direction.

What works well:

  • Parent headings without direct content now get a higher-level overview derived from children instead of an empty description — this is a key fix for downstream merging quality.
  • Explicitly forbidding meta descriptions like "heading for…" and empty descriptions except when there is truly no source content adds useful guardrails.
  • The 1–2 sentence / 2–4 key facts constraint provides concrete guidance without being too rigid.

Minor considerations (non-blocking):

  • The prompt is significantly longer now, which will increase token cost per page_index call. This is probably fine given the quality gain, but worth keeping an eye on.
  • "Roughly half the length of a normal summary" is a bit subjective — LLMs may interpret this inconsistently. Not a problem, just worth monitoring output quality in practice.

Overall LGTM. Thanks for the contribution!

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jul 23, 2026
@wangq8
wangq8 marked this pull request as draft July 23, 2026 02:15
@wangq8
wangq8 marked this pull request as ready for review July 23, 2026 02:15
@wangq8
wangq8 merged commit d0a4881 into infiniflow:main Jul 23, 2026
4 of 5 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Jul 27, 2026
1 task done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants