Skip to content

fix: preserve per-series semantics for raw window queries - #529

Merged
zzylol merged 2 commits into
mainfrom
fix/raw-per-entity-safety
Sep 8, 2026
Merged

zzylol merged 2 commits into
mainfrom
fix/raw-per-entity-safety

Conversation

@zzylol

@zzylol zzylol commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Before this PR

A bare per-series window query such as sum_over_time(m[1m]) could bind pooled raw state. With api=40 and worker=200, that state emits one value 240 instead of two labeled rows, violating Planner's Reduction::PerEntity contract.

After this PR

Backend-local planning retains native execution when a selected per-entity leaf cannot preserve source entities. An explicit direct SUM over additive Sum/Count state authorizes pooling, so global/grouped sums remain eligible for warm execution; permission does not cross binary arithmetic. Other independent roots and keyed TopK state remain available.

The compatibility demo now uses an explicit global sum and verifies exact forwarding for its bare quantile. Sharing/cost fixtures use semantically valid additive reductions. This change protects newly compiled plans; physical Sum state alone cannot identify whether an older artifact intended per-series or explicit aggregate output.

Validation: 663 control-plane tests, the concrete two-series worker regression, and all four compatibility process tests pass on current main with Planner abb2f20. The process fallback mock verifies forwarding, not numerical Prometheus agreement.

@zzylol
zzylol merged commit ae04ecd into main Sep 8, 2026
1 check passed
@zzylol
zzylol deleted the fix/raw-per-entity-safety branch September 21, 2026 18:42
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.

1 participant