Skip to content

fix(driver-memory): accept the engine QueryAST in aggregate() (analytics fallback)#1703

Merged
os-zhuang merged 1 commit into
mainfrom
fix/memory-driver-ast-aggregate
Jun 11, 2026
Merged

fix(driver-memory): accept the engine QueryAST in aggregate() (analytics fallback)#1703
os-zhuang merged 1 commit into
mainfrom
fix/memory-driver-ast-aggregate

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

Completes the staging "No rows" fix chain (framework#1701 was layer 1).

After #1701, dataset queries on in-memory environments correctly fall back from NativeSQL to the aggregate strategy — which then crashed with this[#pipeline].map is not a function: ObjectQL.aggregate hands drivers the QueryAST ({where, groupBy, aggregations}), but InMemoryDriver.aggregate() only understood MongoDB pipeline arrays (Mingo).

aggregate() now detects the AST shape and serves it through the same where-filter + performAggregation path find() already uses (the shapes match exactly — {function, field, alias}); real pipeline arrays keep the Mingo passthrough unchanged.

Test: driver-memory 68 green — new: grouped sums via AST; where + no-groupBy single-row totals; pipeline-array passthrough.

Staging validation: bump cloud .framework-sha after merge → the expense Spending Dashboard should finally render real numbers.

🤖 Generated with Claude Code

…ics fallback)

ObjectQL's engine calls driver.aggregate(object, AST) with the same
{ where, groupBy, aggregations } shape find() consumes — but the in-memory
driver's aggregate() only understood MongoDB pipeline arrays, so the
analytics RAW_SQL_UNSUPPORTED fallback (framework#1701) crashed with
"this[#pipeline].map is not a function" on in-memory environments — the
last broken link in dataset queries on staging tenants.

aggregate() now detects the AST shape and serves it through the SAME
where-filter + performAggregation path find() uses (count/sum/avg/min/max,
multi-field groupBy, aliases); a real pipeline array keeps the Mingo
behavior unchanged.

driver-memory: 68 tests green (3 new: grouped sums via AST, where+no-groupBy
single-row totals, pipeline-array passthrough).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jun 11, 2026 2:04am

Request Review

@os-zhuang
os-zhuang merged commit 649e56b into main Jun 11, 2026
10 of 11 checks passed
@os-zhuang
os-zhuang deleted the fix/memory-driver-ast-aggregate branch June 11, 2026 02:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant