8000 fix(parser): reject a fact with more than four elements, PRS-108 (#649) by adityamukho · Pull Request #654 · project-minigraf/minigraf · GitHub
[go: up one dir, main page]

Skip to content

fix(parser): reject a fact with more than four elements, PRS-108 (#649) - #654

Merged
adityamukho merged 3 commits into
v3from
fix/649-fact-arity
Oct 20, 2026
Merged

adityamukho merged 3 commits into
v3from
fix/649-fact-arity

Conversation

@adityamukho
@adityamukho adityamukho 8000 commented Oct 20, 2026
Copy link
Copy Markdown
Collaborator

Part of #649 (data-integrity; stays open until the v2.x backport is released).

Problem

parse_transact checked fact_vec.len() < 3 and 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 new PRS-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 gets PRS-108 (was PRS-047).
  • PRS-108 registered in src/error.rs and documented in docs/ERROR_REFERENCE.md. The number is free on main too, so the backport uses the same code.
  • Grammar verifier: Cause::FactArity and its KNOWN_DRIFT entry removed (grammar.pest's fact was already exact).
  • Tests (tests/error_codes_prs_test.rs, +2): 5- and 6-element facts fail with PRS-108; a transaction holding one stores none of its facts.
  • Docs: CHANGELOG (Fixed), TEST_COVERAGE, CLAUDE.md, README test counts. No docs-site change needed.

Verification

  • cargo test: 0 failures; verifier tests pass without the drift entry.
  • cargo clippy -- -D warnings, cargo fmt --check clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PtCdzbJMSS1V8qEPaJ4jXz

adityamukho and others added 2 commits October 20, 2026 18:21
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
…ts combined)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PtCdzbJMSS1V8qEPaJ4jXz
@adityamukho
adityamukho merged commit aa36639 into v3 Oct 20, 2026
24 checks passed
@adityamukho
adityamukho deleted the fix/649-fact-arity branch October 20, 2026 13:28
@codecov
codecov Bot commented Oct 20, 2026
Copy link
Copy Markdown

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0