Repository navigation
A refresh updates a keyed row in place - #1542
Merged
Merged
Conversation
2 tasks done
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.
Fixes #1540
A config table's watch refresh (
reconcile_batch_rows) now compares and writes only the columns theon-filecommand emits, and matches rows by the table's key:PRIMARY KEY, else the first unique, non-partial index (aUNIQUEconstraint orCREATE UNIQUE INDEX, in index-name order) whose columns the new rows all fill non-NULL. Read frompragma_table_info.pk/pragma_index_list/pragma_index_info; expression indexes are skipped. A generatedINTEGER PRIMARY KEYthe command doesn't emit is NULL in every row, so it is passed over.UPDATEd by rowid (rowid and non-emitted columns kept) and emitsupdate; vanished keys are deleted, new keys inserted (never paired into an update).UPSERT was not used: the old rows are needed for the events anyway, and a matched-row
UPDATEby rowid is simpler thanON CONFLICTper candidate key.Not in this PR (follow-up): per-file SDK hooks (
handle_upsert) still delete and reinsert a file's rows; the--persiststartup refill of a config table (stream_table_rows) still deletes and reinserts.Docs:
hooks.md(refresh semantics),config.mdandhowto/search-indexes.md(keyed tables need anAFTER UPDATEtrigger).E2E Verification
cargo test --workspace --features cli)packages/python/e2e-attestations/<branch>.jsonreceipt written ifpackages/pythonchanged (just e2e-attest-python)packages/ts/e2e-attestations/<branch>.jsonreceipt written ifpackages/tschanged (just e2e-attest-ts)testing-conventions e2e attest 'uv run python -m pytest tests/e2e/watch_speed_test.py tests/e2e/on_file_query_test.py tests/e2e/server_speed_test.py -q -p no:cacheprovider'(packages/python);testing-conventions e2e attest 'pnpm test:e2e'(packages/ts);cargo test --workspace --features clidirsql serveron the experiments example; renamingaemits oneupdate, ids unchanged; adding0.jsonemits oneinsertwith id 3; touching an unchanged file emits nothing.Changelog / Migrations
<root>/<pkg>/changelog.d/for each changed package (or:skip-changelogtrailer on a commit with reason)<root>/<pkg>/migrations.d/for each changed package (every subsection but Summary_None._when nothing breaks)