Repository navigation
fix: reject unexpected trailing arguments in transact/retract (#303) - #350
Merged
Merged
Conversation
`(transact [facts] {opts})` — the options map placed *after* the facts
vector instead of before it — was silently accepted as if no options
were given: the map was dropped and every fact's valid-time defaulted
to the transaction's wall-clock timestamp instead of the intended
:valid-from. This made :valid-at appear to filter by transaction time
rather than a fact's actual valid-from, since facts only became
visible once the query timestamp caught up to real ingestion time.
The read path (:valid-at filtering, net_asserted_facts, and the
on-disk index after checkpoint/reopen) was already correct — this was
a write-side parser gap: parse_transact/parse_retract only read the
elements they expected and never checked for leftover ones. Both now
hard-error on trailing arguments instead of silently discarding them.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Nsh3ZnmoK6PTaUbp4HcqHY
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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
(transact [facts] {opts})— the options map placed after the facts vector instead of before it, exactly the syntax quoted in :valid-at appears to filter by transaction time instead of a fact's actual valid-from date #303's own repro — was silently accepted as if no options were given. The map was dropped and every fact's valid-time defaulted to the transaction's wall-clock timestamp instead of the intended:valid-from.:valid-atappear to filter by transaction time instead of a fact's actual valid-from: facts only became query-visible once:valid-atreached real ingestion time, matching every data point in the issue's reproduction table.:valid-atfiltering in the executor,net_asserted_factsretraction/window semantics, and the on-disk B+tree index after checkpoint + reopen were all verified correct with direct reproductions. The defect is inparse_transact/parse_retract: both only ever read the elements they expected and never checked for leftover trailing elements, so a misplaced or extra argument was silently discarded rather than rejected.parse_retracthad the identical latent gap (no observable impact today since retract doesn't parse an options map, but the same silent-discard defect), fixed alongside per user request.Closes #303
Test plan
(transact {opts} [facts])→ error; trailing garbage after(retract [facts])→ errorcargo test— 693+ tests, 0 failurescargo fmt --checkcleancargo clippy --all-features -- -D warningsclean (matches CI'srust-clippy.ymlscope)(transact {:valid-from ...} [facts])verified correct for single-fact, multi-pattern-join, and checkpoint+reopen (on-disk index) scenarios; incorrectly-ordered form now errors clearly instead of silently corrupting valid-time🤖 Generated with Claude Code
https://claude.ai/code/session_01Nsh3ZnmoK6PTaUbp4HcqHY