Skip to content

fix(sources): report files skipped during import - #676

Closed
annieyii wants to merge 1 commit into
nashsu:mainfrom
annieyii:fix/report-skipped-source-imports
Closed

annieyii wants to merge 1 commit into
nashsu:mainfrom
annieyii:fix/report-skipped-source-imports

Conversation

@annieyii

Copy link
Copy Markdown
Contributor

Fixes #675.

Problem

Importing sources dropped files silently. Every gate in the import loop
discarded the file with a bare continue, a failed copyFile only reached
console.error, and handleImport wrapped the call in try/finally with
no catch, so a thrown import became an unhandled rejection that never
reached the UI.

The file dialog also offers Images, Media, Code and jsonl/tsv/ndjson
filters that INGESTABLE_SOURCE_EXTENSIONS does not accept, so those files
could be selected, confirmed, and discarded without a word.

Change

importSourceFiles and importSourceFolder now return
{ imported, skipped }, where each skipped entry carries a reason:

Reason Cause
unsupported-type Not in INGESTABLE_SOURCE_EXTENSIONS
excluded excludeExtensions / excludeDirs / excludeGlobs / hidden file
too-large Over maxFileSizeMb, with the actual size as detail
unreadable getFileSize threw
copy-failed copyFile threw
sensitive-config Withheld by isSensitiveConfigSourceFile

The sources view lists them with the same per-item pattern URL import already
uses, and both handlers now catch a thrown import instead of logging it.

Exclusions are checked before the ingestable-type test, so a hidden file that
is otherwise a supported type reports excluded rather than the misleading
unsupported-type.

Notes

Testing

npm run test:mocks — 127 files, 1832 tests pass. npm run typecheck clean.

10 new tests cover each skip reason for both entry points plus the display
decision, written test-first. Five existing tests were updated for the new
return shape. New i18n keys are added to all four locales so
i18n-parity.test.ts stays green.

Also verified by hand in tauri dev: importing a 142 MB PDF against the
default 100 MB limit now reports too-large with the file size instead of
doing nothing.

🤖 Generated with Claude Code

Importing sources dropped files silently. A file rejected for its
extension, an exclusion rule, or the size ceiling was skipped with a
bare `continue`, a failed copy only reached `console.error`, and the
file-picker handler had no `catch` at all, so a thrown import turned
into an unhandled rejection. The picker also offers images, media and
code that INGESTABLE_SOURCE_EXTENSIONS does not accept, so selecting
them closed the dialog and did nothing.

importSourceFiles and importSourceFolder now return
{ imported, skipped } with a reason per skipped file, and the sources
view lists them instead of leaving the user to guess.

Exclusions are now checked before the ingestable-type test: a hidden
file may still be a supported type, and "excluded" is the reason the
user can act on.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@annieyii

Copy link
Copy Markdown
Contributor Author

This landed on main as fd9c953. Thanks!

Shipped in v0.6.10. Closing as superseded by the direct commit.

Ref: #675

@annieyii annieyii closed this Aug 25, 2026
@annieyii
annieyii deleted the fix/report-skipped-source-imports branch August 25, 2026 12:08
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.

Source imports drop files silently: no error, no indication which files were skipped

1 participant