fix(dataset): include tombstone xact_ids in Dataset.version() via audit_log BTQL query - #2508
Open
Mohd Quamar Tyagi (Tyagiquamar) wants to merge 1 commit into
Conversation
…it_log BTQL query Previously, Dataset.version() delegated to super.version() (ObjectFetcher), which queried BTQL without audit_log: true. This meant deleted records' transaction IDs were invisible to the version query, so calling dataset.createSnapshot() after deletions would use a stale version that predated those deletions. Override Dataset.version() to issue its own BTQL query with audit_log: true, scanning all rows including tombstones, and returning the highest _xact_id seen. Add tests covering: - the audit-log BTQL query structure and max-version extraction - createSnapshot() picking up the correct post-deletion version
This branch has not been deployed
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.
Problem\n\nDataset.version() previously delegated to super.version() (ObjectFetcher), which issued BTQL without audit_log: true. Deleted records were invisible to the version query.\n\nCalling dataset.createSnapshot() after deletions used a stale version predating those deletions.\n\n## Fix\n\nOverride Dataset.version() to issue its own BTQL query with audit_log: true, scanning tombstones too. Iterates cursor pages up to MAX_BTQL_ITERATIONS and returns the highest _xact_id seen.\n\nPinned-version fast path preserved: explicit version at initDataset time returns immediately without network calls.\n\n## Changes\n\n- js/src/logger.ts: Override Dataset.version() with paginated BTQL audit-log query\n- js/src/logger.test.ts: 2 new unit tests covering audit-log query structure and createSnapshot() post-deletion version\n\n## Testing\n\nvitest run src/logger.test.ts: Tests 128 passed (128)