Repository navigation
fix(parser): reject a fact with more than four elements, PRS-108 (#649) - #654
Merged
Merged
Conversation
parse_transact read a fact's 4th element as its optional valid-time map
and ignored everything after it, so [[:alice :person/age 1 {} 99 :junk]]
stored [:alice :person/age 1] and dropped the rest without an error.
A fact of more than four elements now fails with the new PRS-108 and the
transaction writes nothing. Removes the FactArity entry from the grammar
verifier's KNOWN_DRIFT.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PtCdzbJMSS1V8qEPaJ4jXz
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PtCdzbJMSS1V8qEPaJ4jXz
…ts combined) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PtCdzbJMSS1V8qEPaJ4jXz
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
adityamukho
added a commit
that referenced
this pull request
Oct 20, 2026
… (#656) Backport of #654 from v3. parse_transact read a fact's 4th element as its optional valid-time map and ignored everything after it, so [[:alice :person/age 1 {} 99 :junk]] stored [:alice :person/age 1] and dropped the rest without an error. A fact of more than four elements now fails with the new PRS-108 (numbered as in v3.0.0) and the transaction writes nothing. Claude-Session: https://claude.ai/code/session_01PtCdzbJMSS1V8qEPaJ4jXz Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.
Part of #649 (data-integrity; stays open until the v2.x backport is released).
Problem
parse_transactcheckedfact_vec.len() < 3and read element 3 as the optional valid-time map, but never checked the upper bound.(transact [[:alice :person/age 1 {} 99 :junk]])succeeded and stored only[:alice :person/age 1].Change
parse_transact: a fact of more than four elements fails with the newPRS-108(Fact must have at most 4 elements (E A V and an optional map), got {}); the transaction writes nothing. The arity check comes before the 4th-element check, so a 5+-element fact whose 4th is not a map also getsPRS-108(wasPRS-047).PRS-108registered insrc/error.rsand documented indocs/ERROR_REFERENCE.md. The number is free onmaintoo, so the backport uses the same code.Cause::FactArityand itsKNOWN_DRIFTentry removed (grammar.pest'sfactwas already exact).tests/error_codes_prs_test.rs, +2): 5- and 6-element facts fail withPRS-108; a transaction holding one stores none of its facts.Verification
cargo test: 0 failures; verifier tests pass without the drift entry.cargo clippy -- -D warnings,cargo fmt --checkclean.🤖 Generated with Claude Code
https://claude.ai/code/session_01PtCdzbJMSS1V8qEPaJ4jXz