Repository navigation
fix(databases)!: a write to a stored key raises; storage metadata must match on append; no statistics on the id column (ITL-1386) #644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
eywalker
merged 29 commits into
main
from
eywalker/itl-1386-a-write-to-a-stored-key-raises
Nov 29, 2026
Merged
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
c2c1e07
fix(databases)!: enforce database write rules (ITL-1386)
eywalker c7f79d7
fix(databases): allow Delta appends with unrecorded extension metadat…
eywalker 1e48d3d
fix(databases): preserve Delta append metadata and reuse strict write…
eywalker 6f11cbe
fix(databases): keep the readable snapshot after a failed Delta refresh
eywalker d4a4cc2
fix(delta): allow appends with unknown IPC extension storage metadata
eywalker 2123aef
fix(delta): compare duplicate IDs using Arrow storage values
eywalker 3db039f
fix(delta): compare composite extension record IDs
eywalker bb141c7
fix(delta): preserve typed record IDs during duplicate checks
eywalker 296f291
fix(databases): honor stored struct IDs and known IPC metadata
eywalker 4d0a81a
fix(delta): refuse mismatched nested record ID types
eywalker f702e41
chore(delta): integrate main’s Delta load safeguards
eywalker 8c08ee1
fix(sqlite): preserve replacement for separate unique constraints
eywalker feb8957
chore: merge main into ITL-1386
eywalker 3c4bcdd
test(delta): verify persisted rows after a conflicting flush
eywalker 0428941
chore: merge main into ITL-1386
eywalker 17cf1c2
chore: merge main into ITL-1386
eywalker 147c3b2
chore: merge main into ITL-1386
eywalker 8c8b073
fix(delta): check persisted timestamp IDs after lossy writes
eywalker 73a1385
Merge remote-tracking branch 'origin/main' into eywalker/itl-1386-a-w…
eywalker e9122fd
fix(delta): refresh IDs after native temporal conversions
eywalker d65eb4b
Merge remote-tracking branch 'origin/main' into eywalker/itl-1386-a-w…
eywalker db43778
fix(delta): restore reviewed ID cache behavior
eywalker 597bbbf
fix(delta): compare nested timestamp IDs in one unit
eywalker 7535eec
chore(merge): resolve main conflicts for ITL-1386
eywalker 1d3bcf9
fix(databases): tighten stored record ID checks
eywalker fb1d67b
chore(merge): sync ITL-907 from main
eywalker aa37cc6
test(sources): repair stored fixture without a duplicate append
eywalker 1cb4bdd
fix(databases): look up only incoming strict append IDs
eywalker c6c955b
chore(merge): sync main into ITL-1386
eywalker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| ### Breaking changes and migration | ||
|
|
||
| - `add_record` and `add_records` now raise `ValueError` with the default | ||
| `skip_duplicates=False` when a record ID is already stored or pending. A batch | ||
| rejected for a duplicate queues no rows. Use `skip_duplicates=True` for | ||
| write-if-missing behavior. If another writer commits an ID after the add-time | ||
| check, the first commit keeps the row. SQLite still applies its existing | ||
| replace or ignore policy when only a separate unique constraint conflicts. | ||
| (ITL-1386, ITL-1487) | ||
|
|
||
| ### Fixed | ||
|
|
||
| - Delta accepts extension-backed record IDs outside Python's date range and | ||
| skips late duplicate list and struct IDs when flushing. (ITL-1386) | ||
| - Delta rejects a changed nested record ID storage type before queueing the add, | ||
| including when an append omits a nullable field inside the ID. (ITL-1386) | ||
| - Delta compares nested timestamp IDs across the input and stored timestamp units. | ||
| (ITL-1386) | ||
| - Delta checks nested extension storage types before skipping a matching stored | ||
| ID. Connector-backed databases report a failed stored-ID lookup as a read | ||
| error. Writable connectors implement `existing_record_ids` to check only the | ||
| incoming IDs by primary key. (ITL-1386) | ||
| - Appends reject mismatches in known field metadata inside Arrow extension | ||
| storage. Delta accepts IPC-decoded whole-column extensions that are | ||
| unregistered when the existing append checks pass. (ITL-1415) | ||
| - Delta excludes the record ID column from data-skipping statistics for every ID | ||
| type so concurrent MERGEs detect conflicting writes. The statistics property | ||
| is written at table creation. Tables created earlier keep their settings. | ||
| (ITL-1444) | ||
|
|
||
| ### Known limitations | ||
|
|
||
| - If Delta cannot refresh its cached snapshot, a successful strict add can | ||
| also miss an ID another writer committed before the add-time check. A | ||
| successful flush keeps the stored row. (ITL-1386) | ||
| - As before, with Delta's `schema_handling="coerce"`, strict adds can miss | ||
| duplicate IDs that become equal when cast to the pending batch's type. | ||
| (ITL-1662) | ||
| - After a Delta commit, the log has no metadata for list items or map keys and | ||
| values inside extension storage. Appends can compare those fields against | ||
| queued rows only. A create file's Parquet footer can carry list item metadata, | ||
| while files written by a later MERGE can omit it. (ITL-1415) | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| ## `src/orcapod/databases/` | ||
|
|
||
| ### WK1 — A strict add accepts an already stored record ID | ||
| **Status:** resolved | ||
| **Severity:** high | ||
| **Issue:** ITL-1386 | ||
|
|
||
| A strict add of an already stored ID was silently skipped by Delta and silently | ||
| replaced the row in memory and connector-backed stores. All three refused an ID | ||
| that was already in the pending batch. | ||
|
|
||
| **Fix:** Check stored IDs when adding, along with the pending IDs, and reject the | ||
| entire add if any conflict. The write-if-missing option still skips duplicates. | ||
| Writable connectors look up only the incoming IDs by primary key. | ||
| SQLite keeps its existing conflict policy for unique constraints on other columns. | ||
| Delta reuses the loaded table and ID snapshot when the log has not advanced. | ||
| Delta compares extension IDs by their Arrow storage values on both the writing | ||
| handle and reopened handles, including extension IDs stored as lists or structs. | ||
| Delta refuses an add whose nested ID storage type differs from the pending or | ||
| stored ID type, before schema handling can change the ID. | ||
| Arrow's primitive comparison preserves values outside Python's date range. | ||
| Delta streams the MERGE for nested IDs so a batch that loses to a committed row | ||
| can still flush and insert any distinct IDs it holds. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| ## `src/orcapod/databases/` | ||
|
|
||
| ### WK3 — Appends accept changed field metadata inside extension storage | ||
| **Status:** resolved | ||
| **Severity:** high | ||
| **Issue:** ITL-1415 | ||
|
|
||
| The append check skipped the nested fields of extension types. An append could | ||
| carry different field metadata inside a struct-backed extension and read back | ||
| with the held column's metadata. | ||
|
|
||
| **Fix:** Compare field metadata recursively in extension storage. Delta checks | ||
| the metadata held in its log against the incoming storage fields before enqueue | ||
| and also checks against the version loaded for a commit. | ||
| Nested logical identifiers are checked separately from ordinary field metadata. | ||
| When IPC exposes an unregistered whole-column extension as storage with an | ||
| Arrow annotation, Delta refuses conflicting metadata explicitly present on | ||
| corresponding struct fields of both sides and treats missing attributes as | ||
| unknown. Delta refuses extensions nested inside another type (ITL-1372). | ||
|
|
||
| The Delta log has no field metadata for list items or map keys and values | ||
| inside extension storage. For committed rows, those annotations are unknown. | ||
| The initial Parquet footer can carry list item metadata, while later MERGE | ||
| footers can omit it. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| ## `src/orcapod/databases/delta_statistics.py` | ||
|
|
||
| ### WK4 — Delta file statistics on typed record IDs can let concurrent commits miss an overlap | ||
| **Status:** resolved | ||
| **Severity:** high | ||
| **Issue:** ITL-1444 | ||
|
|
||
| Statistics on non-binary record IDs could let Delta file skipping hide a conflict | ||
| when two handles committed the same new ID. | ||
|
|
||
| **Fix:** Exclude the record ID from every new table's statistics configuration. | ||
| Existing table properties are retained. |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| ## `src/orcapod/databases/connector_arrow_database.py` | ||
|
|
||
| ### WK2 — A second connector commit replaces the first writer's row | ||
| **Status:** resolved | ||
| **Severity:** high | ||
| **Issue:** ITL-1487 | ||
|
|
||
| Two connector-backed database handles could queue the same new ID, then commit | ||
| different values. The last flush replaced the first writer's row when adding | ||
| with the default duplicate policy. | ||
|
|
||
| **Fix:** Use the connector's insert-if-missing operation at commit in both modes. | ||
| A conflicting ID visible at add time is refused in strict mode. |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.