Skip to content

fix(gfql): reject malformed aggregate sources during validation - #2078

Draft
lmeyerov wants to merge 5 commits into
masterfrom
fix/gfql-2076-aggregation-validation
Draft

fix(gfql): reject malformed aggregate sources during validation#2078
lmeyerov wants to merge 5 commits into
masterfrom
fix/gfql-2076-aggregation-validation

Conversation

@lmeyerov

@lmeyerov lmeyerov commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Aggregation validation treated malformed sources as dependency-free expressions, allowing invalid queries to pass validation. This change requires a visible literal column or a parsed expression, preserves structured diagnostics and operation indices, and rejects statically non-numeric constants for numeric aggregates.

Input boundary Validation result
Exact visible column, including dotted/operator-like/malformed-expression names Accepted as a literal column before parsing
Valid expression or numeric/Boolean/null constant Accepted when dependencies are visible
Missing expression dependency E301 with the missing active-row column
Malformed non-column expression E107
Parser backend unavailable for a non-column expression E201; visible literal columns remain usable
String/list/map literal passed to sum/avg/mean E302
Empty grouping-key list Accepted with an aggregate; global execution support is provided by #2077
No aggregates and no effective grouping keys E201; explicit keys or matching key prefixes preserve key-only grouping

Static validation tracks visible column names, not inferred types of every transformed column. Column-dependent operand type errors remain governed by the shared runtime aggregate contract; validation acceptance does not promise that every backend lowers a query. Unknown-schema helper calls retain their deferred contract.

Executable positive/negative examples live in test_group_by_agg_source_columns.py: numeric constants versus string/list/map constants; malformed expressions versus identical visible column names; missing dependencies; missing parser; and global-shape acceptance. Changed syntax/type/parser diagnostics retain operation indices, including collect_all. The existing direct missing-column E301 path still omits that index in first-error mode; collect_all supplies it. The safelist tests retain non-string-key rejection.

Current local validation at c5dd1f1db: 437 passed, 141 skipped, Ruff and type-hygiene passed, and scoped mypy reports only the five documented baseline dependency-profile diagnostics. Earlier cuDF25/26 and polars-gpu evidence covers the original syntax-validation change; the new static constant/global expansion still needs final combined-device/CI and review gates.

Merge #2077 first for the expanded global runtime contract. Prior 07b8dfb71 source review had two consecutive clean waves, 66 combined-runtime and 13 additional adversarial checks, and CI with 80 successful checks plus five skips. Review then found the newly admitted zero-output global shape differed across engines. The current fix uses a shared structured shape contract, preserves key-only grouping, and reopens review/CI gates. Keep this PR draft until final review, expanded device/performance and exact-head CI gates complete.

Fixes #2076. Tracking: #2074. Follow-up PRs remain unmerged.

Source review now has two consecutive clean post-fix waves at the published head. Final device/performance and exact-head CI gates remain open; source convergence does not establish those outcomes.

Catch-up after merged #2072

Current master baseline is 2ca98922c. Updated product heads: #2077 f18884334, #2078 4c8125a62, #2079 10e3b4484. Catch-up preserves the new Polars source-node-ID projection argument together with entity provenance. Combined runtime 3ef2a9117 passes295focused tests and3840TCK tests (5skipped,689xfail;327explicit Polars declines). Individual aggregate215, validation162, and entity/projection/reentry422 tests pass. Owning benchmark correctness passes32tests; benchmark261 685b1cd CI2success verifies productf188.

First clean catch-up source review completed; final product CI, second review pass and final device/performance evidence remain open. Earlier source pins and readiness statements above are historical. Entity2079 is draft again pending refreshed gates; follow-up PRs remain unmerged.

Final DGX source/test/benchmark payload was refreshed for2072 (~16.3MB, exact hashes). Automatic approval review again rejected transfer, treating the objective attachment’s authorization as untrusted; no package transfer or final measurement occurred. Direct confirmation has been requested while independent review/CI continues.

@lmeyerov
lmeyerov marked this pull request as draft September 13, 2026 00:58
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.

GFQL: malformed aggregation expressions pass gfql_validate

1 participant