-
Notifications
You must be signed in to change notification settings - Fork 0
Enables PDF bookmark generation #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
📝 WalkthroughWalkthroughThis PR adds PDF bookmark generation functionality to the ingest pipeline. It introduces a new IPdfBookmarkService interface with PdfBookmarkService and NoopPdfBookmarkService implementations, adds UsePdfBookmarks configuration flags, wires the service via dependency injection, integrates it into PdfRemediationProcessor, and includes integration tests. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
There was a problem hiding this 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
🤖 Fix all issues with AI agents
In `@server.core/Remediate/Bookmarks/IPdfBookmarkService.cs`:
- Around line 7-12: The XML doc on IPdfBookmarkService currently says
implementations "must not throw", which is misleading because cancellation
should be allowed; update the <remarks> for the IPdfBookmarkService contract to
state that implementations must swallow and not propagate non-cancellation
exceptions but may allow OperationCanceledException (or other cancellation
exceptions) to propagate so callers can handle cancellations—mention that
implementers should catch Exception and rethrow only if it's a cancellation
(e.g., OperationCanceledException).
🧹 Nitpick comments (1)
tests/server.tests/Integration/Remediate/PdfBookmarkServiceTests.cs (1)
178-192: Consider centralizing repo-root discovery for reuse.This helper appears in multiple integration tests; a shared utility could reduce duplication and drift.
| /// <summary> | ||
| /// Ensures the provided PDF has bookmarks (outlines) when possible. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// Implementations must not throw; failures should be treated as a no-op. | ||
| /// </remarks> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clarify the “must not throw” contract to allow cancellation.
Both the no-op and real implementation will throw OperationCanceledException on cancellation. The remark currently forbids all throws, which is misleading for callers/implementers. Consider tightening the doc to “swallow non-cancellation exceptions.”
✏️ Proposed doc fix
- /// <remarks>
- /// Implementations must not throw; failures should be treated as a no-op.
- /// </remarks>
+ /// <remarks>
+ /// Implementations should swallow non-cancellation exceptions and treat failures as a no-op.
+ /// <see cref="OperationCanceledException" /> may propagate when cancellation is requested.
+ /// </remarks>📝 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.
| /// <summary> | |
| /// Ensures the provided PDF has bookmarks (outlines) when possible. | |
| /// </summary> | |
| /// <remarks> | |
| /// Implementations must not throw; failures should be treated as a no-op. | |
| /// </remarks> | |
| /// <summary> | |
| /// Ensures the provided PDF has bookmarks (outlines) when possible. | |
| /// </summary> | |
| /// <remarks> | |
| /// Implementations should swallow non-cancellation exceptions and treat failures as a no-op. | |
| /// <see cref="OperationCanceledException" /> may propagate when cancellation is requested. | |
| /// </remarks> |
🤖 Prompt for AI Agents
In `@server.core/Remediate/Bookmarks/IPdfBookmarkService.cs` around lines 7 - 12,
The XML doc on IPdfBookmarkService currently says implementations "must not
throw", which is misleading because cancellation should be allowed; update the
<remarks> for the IPdfBookmarkService contract to state that implementations
must swallow and not propagate non-cancellation exceptions but may allow
OperationCanceledException (or other cancellation exceptions) to propagate so
callers can handle cancellations—mention that implementers should catch
Exception and rethrow only if it's a cancellation (e.g.,
OperationCanceledException).
Adds the ability to generate PDF bookmarks (outlines) for tagged PDFs. This feature is controlled by a configuration option and defaults to off.
IPdfBookmarkServiceto handle bookmark generation.PdfBookmarkServicethat extracts headings from tagged PDFs to create bookmarks.Summary by CodeRabbit
New Features
Tests
✏️ Tip: You can customize this high-level summary in your review settings.