feat(aggregation): cumulative/running-total time-bucket aggregates (#2058)#2062
Merged
Merged
Conversation
…2058) Implements the last open requirement of adhoc-aggregation-suite (REQ-AGG-103): a `cumulative: true` flag on the ad-hoc time-bucket primitive that orders buckets ascending and returns a running total alongside each per-bucket value. - AggregationQuery gains a `cumulative` flag, valid only alongside a dateBucket; carried into the cache-key shape (toArray()) so a cumulative request and a plain request never collide in AggregationCache. - TimeseriesRequestValidator parses/validates the `cumulative` query param (requires `interval`); AggregationController::timeseries() wires it through. - AggregationRunner: Postgres computes the running total natively via `SUM(...) OVER (ORDER BY bucket)`; MySQL, SQLite and the PHP fallback use the new addCumulativeColumn() PHP post-pass over the already-ordered buckets. Both paths are pinned to agree by a dedicated parity test. - Response shape is unchanged when `cumulative` is absent. - Archives the adhoc-aggregation-suite OpenSpec change (all 6 requirements now shipped) and syncs the delta into openspec/specs/aggregation-api/spec.md. - Repoints @SPEC tags that referenced the change directory at the canonical openspec/specs/aggregation-api/spec.md so they survive the archive move.
Contributor
Quality Report — ConductionNL/openregister @
|
| Check | PHP | Vue | Security | License | Tests |
|---|---|---|---|---|---|
| lint | ✅ | ||||
| phpcs | ❌ | ||||
| phpmd | ✅ | ||||
| psalm | ✅ | ||||
| phpstan | ✅ | ||||
| phpmetrics | ✅ | ||||
| eslint | ❌ | ||||
| stylelint | ❌ | ||||
| composer | ❌ | ✅ 172/172 | |||
| npm | ❌ | ❌ | |||
| PHPUnit | ⏭️ | ||||
| Newman | ⏭️ | ||||
| Playwright | ⏭️ |
Quality workflow — 2026-07-24 11:45 UTC
Download the full PDF report from the workflow artifacts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the last open requirement of the
adhoc-aggregation-suiteOpenSpec change — REQ-AGG-103 cumulative/running-total time-bucket aggregates — and archives the change.cumulative: trueflag to the ad-hoc time-bucket primitive (AggregationQuery,TimeseriesRequestValidator,AggregationController::timeseries()). Only valid alongside a time-bucket (dateBucket) request.valueplus a running-totalcumulative.SUM(...) OVER (ORDER BY bucket)— no extra bind parameter (reuses the existingbucketoutput alias).AggregationRunner::addCumulativeColumn()PHP post-pass over the already-ordered buckets.AggregationQuery::toArray()now carriescumulative, so the ad-hoc cache key differentiates a cumulative request from an otherwise-identical plain request (REQ-AGG-105).cumulativeis absent (regression-pinned).openspec/changes/adhoc-aggregation-suite(all 6 requirements now shipped) and syncs the delta intoopenspec/specs/aggregation-api/spec.md.@spectags that referenced the change directory at the canonicalopenspec/specs/aggregation-api/spec.mdso they survive the archive move.Closes #2058
Test plan
AggregationRunnerCumulativeTest(new, 12 tests):AggregationQuerycumulative validation, Postgres SQL-window emission + wiring, MySQL PHP-post-pass, PHP-fallback running total, SQL-window-vs-PHP-post-pass parity, cache-key differentiation, unchanged-shape-when-absent regression.TimeseriesRequestValidatorTestextended with cumulative parsing/validation cases.nextcloud:34.0.0-apachecontainer, no regressions.phpcsclean on all touchedlib/files (0 errors; only pre-existing unrelated warnings).openspec validate adhoc-aggregation-suite --strictpassed before archive;openspec validate aggregation-api --strictpassed after.Known pre-existing, unrelated CI/test failures (npm lockfile, eslint/stylelint/license/Newman infra, repo-wide phpcs debt, ~18 unrelated local phpunit failures in MapLinkService/PhotoLinkService/PollLinkService/SchemaLinkedTypes/SettingsController/RelationsController/etc, all confirmed present on unmodified
origin/development) are out of scope for this change.