fix(fumadb): mirror aggregate review hardening#62
Conversation
Greptile SummaryThis PR ports four targeted review-hardening fixes from upstream onto
Confidence Score: 5/5Safe to merge. The Drizzle adapter fix is a single-line guard that corrects empty Both changed logic paths have direct test coverage across memory and SQLite harnesses. The No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[buildJsonFilter called] --> B{filter.kind?}
B -- and --> C[Drizzle.and items.map ...]
C --> D{"items empty?"}
D -- yes --> E[Drizzle.and returns undefined]
D -- no --> F[SQL AND expression]
E --> G[buildScopedConditions: if compiled skip push]
G --> H[no JSON constraint = vacuously true]
F --> I[pushed to parts]
B -- or --> J{"items.length === 0?"}
J -- yes --> K["return sql 1=0 NEW FIX"]
K --> L[pushed to parts always false]
J -- no --> M[Drizzle.or items.map ...]
M --> N[SQL OR expression]
B -- compare / array --> O[leaf SQL predicate]
subgraph executor.ts pluginStorageWhereToJsonFilter
P[iterate condition entries] --> Q{"operator === in?"}
Q -- yes --> R[push array filter, continue]
Q -- no --> S{"operator in pluginStorageJsonCompareOperators?"}
S -- no --> T[continue skip NEW GUARD]
S -- yes --> U[look up operator from map]
U --> V[push compare filter]
end
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[buildJsonFilter called] --> B{filter.kind?}
B -- and --> C[Drizzle.and items.map ...]
C --> D{"items empty?"}
D -- yes --> E[Drizzle.and returns undefined]
D -- no --> F[SQL AND expression]
E --> G[buildScopedConditions: if compiled skip push]
G --> H[no JSON constraint = vacuously true]
F --> I[pushed to parts]
B -- or --> J{"items.length === 0?"}
J -- yes --> K["return sql 1=0 NEW FIX"]
K --> L[pushed to parts always false]
J -- no --> M[Drizzle.or items.map ...]
M --> N[SQL OR expression]
B -- compare / array --> O[leaf SQL predicate]
subgraph executor.ts pluginStorageWhereToJsonFilter
P[iterate condition entries] --> Q{"operator === in?"}
Q -- yes --> R[push array filter, continue]
Q -- no --> S{"operator in pluginStorageJsonCompareOperators?"}
S -- no --> T[continue skip NEW GUARD]
S -- yes --> U[look up operator from map]
U --> V[push compare filter]
end
Reviews (1): Last reviewed commit: "fix(fumadb): mirror aggregate review har..." | Re-trigger Greptile |
Summary
Mirrors the review-hardening deltas from upstream RhysSullivan/executor#1119 onto
dev.devalready contains the broader FumaDB aggregate and keyset query feature, so this PR only carries the remaining drift from the upstream review loop.Changes
orfilters to a constant false SQL predicate.orand emptyandfilters across the aggregate harness.Intentional Differences From Upstream RhysSullivan#1119
devalready has that feature surface.devalready has the mock shape needed by the expanded collection facade.devfeature surface.Tests
bun run bootstrapbun run --cwd packages/core/fumadb test -- src/query/aggregate.test.ts src/query/table-policy.test.tsbun run --cwd packages/core/sdk test -- src/plugin-storage-aggregate.test.ts src/plugin-storage.test.tsbun run --cwd packages/core/fumadb typecheckbun run --cwd packages/core/sdk typecheckbun run typecheck./node_modules/.bin/oxfmt --check packages/core/fumadb/src/adapters/drizzle/query.ts packages/core/fumadb/src/query/aggregate.test.ts packages/core/fumadb/src/query/aggregate.ts packages/core/sdk/src/executor.ts packages/core/sdk/src/plugin-storage.ts