Skip to content

fix: preserve index entries when a parser fails instead of purging them#82

Merged
GoodbyePlanet merged 1 commit into
mainfrom
fix/parser-error-purges-index-68
Jul 4, 2026
Merged

fix: preserve index entries when a parser fails instead of purging them#82
GoodbyePlanet merged 1 commit into
mainfrom
fix/parser-error-purges-index-68

Conversation

@GoodbyePlanet

Copy link
Copy Markdown
Owner

Summary

  • registry.parse_file previously caught every parser exception and returned [], which the indexing pipeline treated as "file has no indexable symbols" and used as a signal to delete existing index entries for that file (pipeline.py).
  • Because the file's blob SHA doesn't change when a parser merely crashes on it, incremental indexing would never retry the file — the deleted chunks were gone for good until the file's content changed.
  • This introduces a dedicated ParseError exception: registry.parse_file now re-raises parser failures instead of swallowing them, and IndexPipeline.index_service catches ParseError to skip the file for this run while leaving its existing index entries untouched. Genuinely symbol-less files (parsed OK, zero symbols) still go through the existing delete-stale-entries path.

Fixes #68

Test plan

  • uv run pytest tests/parser/test_registry.py — updated test_parse_file_swallows_parser_exceptionstest_parse_file_raises_parse_error_for_parser_exceptions, now asserts ParseError is raised
  • uv run pytest tests/test_pipeline.py — new test_parser_failure_preserves_existing_index_entries asserts delete_by_file/upsert_chunks are not called when parsing raises
  • uv run pytest — full suite green (217 passed)
  • uvx ruff format --check on all changed files

🤖 Generated with Claude Code

A parser crash was previously swallowed to an empty symbol list, which the
pipeline treated as "no indexable symbols" and used to delete existing
index entries for the file. Since the file's blob SHA is unchanged, it was
never retried, so the data loss was permanent. Parser failures now raise
ParseError, which the pipeline catches to skip the file while leaving its
existing entries intact.

Fixes #68

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@GoodbyePlanet GoodbyePlanet merged commit 6f77ff1 into main Jul 4, 2026
2 checks passed
@GoodbyePlanet GoodbyePlanet deleted the fix/parser-error-purges-index-68 branch July 4, 2026 11:58
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.

Parser error silently purges the file from the index (data loss)

1 participant