Repository navigation
feat(query): pseudo-attributes across joins and :db/valid-at on the streaming engine (#545) - #595
Merged
Merged
Conversation
…545) A per-fact pseudo-attribute pattern reads, as the executor does, the metadata of the last pattern with a stored attribute before it in plan order that matched its entity: the scans of those patterns fill metadata columns, and the pseudo-attribute step picks one per row (decision 4 of the #545 plan). The engine runs it when its entity term is the entity term of such a pattern, or when no such pattern runs before it; then, and for every :db/valid-at pattern, it joins with every visible fact of its entity, as [e _ _] does, with the metadata (or the query's valid time) as a column. Other shapes stay on the executor; #594 tracks the plan-order dependence. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HyLscCUuJ1GQpdAeX79EdR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HyLscCUuJ1GQpdAeX79EdR
…other entity term (#545) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HyLscCUuJ1GQpdAeX79EdR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HyLscCUuJ1GQpdAeX79EdR
This was referenced Oct 14, 2026
Codecov Report❌ Patch coverage is
📢 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.
Part 3 of 3 for #545 (#473, part 3 of 9). Plan:
docs/superpowers/plans/2026-10-14-545-joins.md, steps 10–13.What changes
:db/valid-from,:db/valid-to,:db/tx-count,:db/tx-id) reads, as the executor does, the fact of the last pattern with a stored attribute before it in plan order that matched its entity (decision 4). The scans of those patterns fill metadata columns. The pseudo-attribute step then picks one column per row: the latest pattern with the same entity term always matched, and later patterns on other entity terms override it on rows where their entity is join-equal.:db/valid-atpattern, it joins with every visible fact of its entity, as[e _ _]would, with the metadata or the query's valid time (nilunder:any-valid-time) as a column. Other shapes stay on the executor: a pseudo-attribute pattern on an entity that no earlier pattern has as its entity, a_entity, or an expression that rebinds an entity variable.join_2_pseudo.Measurements (#394 envelope, idle server, A/B on separate sockets, swapped between rounds)
join_2_pseudov3→ PREvery other shape is unchanged. At 10M (first 10M run of the PR 2 join shapes):
join_251 µs / 4 MiB,join_3_selective2.5 s / 66 MiB,join_3_scan13.6 s / 59–63 MiB. Release binary is 1,162.8 KiB (+7.6 KiB; the limit is 1,200 KiB).Tests
query::engine::testsoracle matrix: 17 pseudo-attribute join shapes (per-row choice, constant entities, pseudo-attribute patterns planned first, cross products, expressions) and 7:db/valid-atshapes at every temporal. A mutation that drops the per-row choice fails the oracle.--features test-oracleover the whole suite, the engine tests under--features wasm(source order), and clippy for native,wasm, browser and WASI.wasm, so it is a false positive; both are now tests.Docs
CHANGELOG.md,CLAUDE.md,ROADMAP.md,docs/TEST_COVERAGE.md,docs/BENCHMARKS.md. Docs site: project-minigraf/minigraf-docs PR (join rules and pseudo-attributes in the Datalog reference, the streaming-engine section of the architecture page).No public API change and no new error code, so no binding cascade.
🤖 Generated with Claude Code
https://claude.ai/code/session_01HyLscCUuJ1GQpdAeX79EdR