Repository navigation
fix(import): keep row ids and fields, do not resurrect soft-deleted rows (#1633) - #1636
Merged
Merged
Conversation
…ows (#1633) The JSONL importer stores a row under its id (skip and count on an id conflict), carries memory_type, importance, pinned, content_type, slug and deprecated through with validation, and skips content that is soft-deleted in the target. Rows without an id keep the cosine dedup (#1005). export writes the fields; import_full reads deprecated from the bundle row. The result and POST /import add duplicates_skipped, id_conflicts_skipped and soft_deleted_skipped.
| // same content is a duplicate, other content an id conflict, and | ||
| // a live row whose stored copy was forgotten stays forgotten. | ||
| if let Some(id) = &row_id | ||
| && let Some((stored, stored_deprecated)) = self.store.content_and_state(id)? |
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
…1633) An import into another namespace (--namespace) of a store's own export counted every row as a duplicate. Ids are unique across the store, so such a row now gets a new id and the content checks of the target namespace.
…y-1633 # Conflicts: # CHANGELOG.md
ajianaz
added a commit
that referenced
this pull request
Nov 8, 2026
… (#1690) * fix(import): import a live row whose content was only forgotten (#1689) A plain forget soft-deletes (deprecated=1) and is recoverable; only forget --reason writes rejected_values and rejects (#1627, untouched). #1633/#1636 made import skip any row whose content matched a soft-deleted one, so re-importing after a forget (restored backup, the LongMemEval harness forgetting after each question) dropped the rows. An anonymous live row over a forgotten copy now inserts as a new live row. Still skipped: a row carrying the forgotten memory's own id, a row marked deprecated in the file, and exact duplicates of live rows. * bench: LongMemEval-S 500Q receipts for the import tombstone-skip fix (#1689) Full 500-question run on Modal (10 shards, strategy default, binary built from 32a5cf3, ORT lib from v0.23.0), app ap-HNerZq2X0lO17WJ0CytCfb, 28129s wall clock. any@5 0.9820, strict@5 0.8800, misses@50 0, strict@5 flips -0/+0 vs the committed v0.20.0 baseline - all audit gates of #1689 pass. --------- Co-authored-by: ajianaz <[email protected]>
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
Closes #1633, including both items of the owner's comment.
Uteke::import/import_with) stores a row under itsid(a UUID, canonical lowercase form; anything else is dropped and a new id is generated, as for old files). A stored id is never overwritten: the same content counts as a duplicate, other content as an id conflict. Ids are unique across the store, so when the id is stored in another namespace than the row's target (a copy with--namespace), the row gets a new id and the content checks of the target namespace (Cora finding on the first push).memory_type,importance,pinned,content_typeandslugare carried through and validated (unknown type, importance outside 0..1, malformed content type, blank slug fall back to today's defaults:fact,0.5,false,text, none).Store::content_hashes_with_state). Content (or an id) that was forgotten in the target is skipped, not resurrected. A row markeddeprecated(Cloud export rows) is stored deprecated withdeprecated_at, without a vector.uteke exportnow writesid,memory_type,importance,pinned,content_type,slug, so OSS → OSS round-trips keep identity.import_fullreadsdeprecated(bool or 0/1) anddeprecated_atfrom the bundle row instead of the literal0.ImportResultand thePOST /importresponse addduplicates_skipped,id_conflicts_skipped,soft_deleted_skipped(names follow the Cloud importer).skippedkeeps its meaning (invalid / rejected rows); the CLI prints the new counts.Why
An export → import round-trip changed every id and flattened every typed memory to
fact/0.5, so anything holding memory ids (room links, timeline, external references) dangled after a restore, and re-importing an old export brought deliberately deleted memories back (hit in production on 2026-11-02).import_fullun-deleted every forgotten row whose id a bundle carried.CORE contract:
POST /importchanges are additive (three new response keys, the request is unchanged). The new id/dedup semantics converge on what the Cloud importer already does (duplicates_skipped/id_conflicts_skippedonPOST /api/v2/import), so Cloud needs no change.Testing
Tests written first (they failed to compile against
develop), inimport_export::fidelity_testsandstructural_export::column_roundtrip_tests:imported 0,duplicates_skipped 3, no new rowsid_conflicts_skipped 1, stored row unchangedsoft_deleted_skipped, nothing comes back livedeprecated: truerow → stored deprecated with itsdeprecated_at; re-import is a duplicate--namespace othercopies the rows under new ids (and links their rooms); a second copy is a duplicateimport_full:deprecated: trueanddeprecated: 1rows stay deprecated, rows without the key stay livecargo fmt --all,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspacepass locally.