Fix catalog import checkpoint state#17
Merged
Merged
Conversation
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.
Summary
Fixes #16.
This separates catalog completion metadata from incremental import checkpoint metadata for cataloged Codex transcript files.
Problem
When a cataloged transcript changes,
catalog_sessions.indexed_statuscorrectly becomespending, but oldindexed_*fields could remain populated. That is misleading because those fields describe the previous file version, not the current cataloged file.External PR #15 identified the real stale-metadata bug. Its approach of clearing all old
indexed_*values on any file change is not sufficient for ctx, because Codex append-only session JSONL refresh was usingindexed_file_size_bytesas the tail-import checkpoint. Clearing that value makes append refresh reprocess old events instead of importing only the appended tail.Data model change
indexed_*fields as current-file completion metadata only.catalog_sessions:last_imported_at_mslast_imported_file_size_byteslast_imported_file_modified_at_mslast_imported_file_sha256last_imported_event_countindexed_*metadata where possible.Behavior
indexed_*completion metadata.Migration notes
The v14 migration adds nullable checkpoint columns and backfills
last_imported_*from existing indexed metadata. New successful imports storelast_imported_file_sha256so future tail refreshes can reject rewritten prefixes before using a checkpoint.Tests
cargo fmt --all --checkcargo test -p ctx-history-storecargo test -p ctx --test cli search_refresh_auto_tail_imports_appended_codex_session_eventcargo test -p ctx catalog_import_checkpoint_requires_matching_hashcargo test -p ctx-history-capturecargo test --workspace