fix(sync): include .pdf in default sync extension allowlist - #394
Open
Wu-Yumin wants to merge 1 commit into
Open
fix(sync): include .pdf in default sync extension allowlist#394Wu-Yumin wants to merge 1 commit into
Wu-Yumin wants to merge 1 commit into
Conversation
PDFs are indexed by 'leann build' by default (should_process_pdfs in cli.py), but DEFAULT_INDEX_EXTENSIONS in sync.py — used by change detection for incremental build and 'leann watch' — does not include '.pdf'. As a result, PDF-only directories hash to an empty set: detect_changes() reports no new files and the first build exits early with 'Index up to date.', leaving an empty index directory behind. PDF additions/modifications/removals are likewise invisible to incremental builds and watch. The allowlist's own comment says to keep it in sync with build's default extension set, so add the missing '.pdf'. Add regression tests covering hashing and first-build change detection for PDFs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
leann buildindexes PDFs by default (should_process_pdfsin cli.py), butDEFAULT_INDEX_EXTENSIONSin sync.py — the allowlist used by change detectionfor incremental builds and
leann watch— includes.docx/.pptxyet not.pdf. The allowlist's own comment says to keep it in sync with build'sdefault extension set.
Consequences:
detect_changes()reportsno new files and the first build exits early with
Index up to date.,leaving behind an empty index directory (shown as ❌ by
leann list).and
leann watch; only--forcerebuilds pick them up.Fix: add the missing
.pdftoDEFAULT_INDEX_EXTENSIONS, plus regressiontests covering PDF hashing and first-build change detection.
Note: #299 fixed the same symptom for multi-document files skipped by
len(file) > 1, and #377 rewrote hashing to raw bytes — but the rewritemoved file selection to this extension allowlist, which is where PDFs were
dropped. This PR closes that gap. Affected: main and the 0.3.8 tag.
Related Issues
Relates to #290, #14
Checklist
uv run pytest) — test_sync.py 10/10; the 3 failures intest_incremental_build.py are pre-existing on origin/main (identical
failure set with and without this change)
ruff formatandruff check)pre-commit run --all-files)