Skip to content

Rewrite LoadDerivationSnapshot with set-based aggregation - #41

Merged
ewhauser merged 1 commit into
mainfrom
derivation-snapshot-query
Aug 5, 2026
Merged

Rewrite LoadDerivationSnapshot with set-based aggregation#41
ewhauser merged 1 commit into
mainfrom
derivation-snapshot-query

Conversation

@ewhauser

@ewhauser ewhauser commented Aug 5, 2026

Copy link
Copy Markdown
Owner

Fixes #38 — the deriver snapshot query drops per-scope correlated aggregation for the 0005-style keyset + grouped hydration shape (issue's EXPLAIN evidence: 578ms at the 500-scope cap). Row-for-row equivalence proven over adversarial seeds (EXCEPT ALL both directions, payloads compared parsed and textually), ordering explicit, plan shape pinned. No deriver behavior change.

Built and adversarially reviewed by paired Codex sol-xhigh agents in a dedicated worktree (parallel batch #33#38). Full gate green locally.

🤖 Generated with Claude Code

The per-scope correlated aggregation scaled linearly in scopes toward
the deriver's 500-scope cap (32.6ms for one scope, 578.6ms at 500 in
the issue's EXPLAIN evidence). Following the 0005 drift keyset
pattern, the query now resolves the scope key set first and hydrates
with grouped set-based aggregation. Row-for-row equivalence with the
prior shape is proven over adversarial seeds (duplicate scopes,
unknown scopes, empty scopes, tombstoned entities, every entity kind)
via EXCEPT ALL in both directions, with the jsonb payloads compared
both parsed and textually since downstream consumers may hash
snapshot text; explicit ordering is preserved. A plan-shape assertion
pins the set-based form. No deriver behavior change.

Fixes #38

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ewhauser
ewhauser force-pushed the derivation-snapshot-query branch from 71ed18e to 0283da0 Compare August 5, 2026 01:42
@ewhauser
ewhauser merged commit 0d17622 into main Aug 5, 2026
5 checks passed
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.

Rewrite LoadDerivationSnapshot to avoid per-scope correlated aggregation

1 participant