Repository navigation
Recompute a ranking from a refresh message (Step 4 of #386) - #496
Merged
Merged
Conversation
zipdoki
force-pushed
the
feat/topk-sweep
branch
from
August 19, 2026 08:18
efbd0b3 to
a4df80d
Compare
zipdoki
force-pushed
the
feat/topk-sweep
branch
from
August 20, 2026 02:16
a4df80d to
376049b
Compare
This was referenced Aug 20, 2026
zipdoki
force-pushed
the
feat/topk-sweep
branch
from
August 27, 2026 08:08
d30a692 to
f63cc4d
Compare
The sweep design moved from an _expire table scanned by expiredAt to a refresh queue, and these three payloads never got wired to anything. AggregationExpireItemRequest has no references at all, and AggregationExpireResult is only read by AggregationsExpireResponse.from, which nothing calls. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`AggregationSweepResult` names no item it came from, so a caller pairs a result to its request by position — the same contract `aggregate` has. `sweep` merged handler output as it completed, so a three-item batch came back fully reversed when the first item was the slowest. Same fix as #494 made on the aggregate path, and concurrency is unchanged: `flatMapSequential` subscribes eagerly under the same default `maxConcurrency`.
zipdoki
force-pushed
the
feat/topk-sweep
branch
from
August 27, 2026 09:52
f63cc4d to
0128411
Compare
Contributor
Author
|
Optimistic Merge |
zipdoki
added a commit
that referenced
this pull request
Aug 31, 2026
Steps 3 and 4 landed on main as squash merges (#494, #496) carrying review changes this branch never saw: `AggregationConstants.Topk.REFRESH_TABLE` is now `REFRESH_QUEUE`, the aggregate and sweep dispatchers emit in request order via `flatMapSequential`, and both test classes gained cases for that ordering and for a window that never slides. Took main's side wherever the two overlapped, since this branch's copies are the pre-review versions of the same work. Kept the `AggregationQueryService` bean in `GraphConfiguration`, which is Step 5 and exists only here. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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
The previous PR schedules a refresh for the instant a bucket leaves the sliding window, but nothing consumes it. A windowed ranking goes stale the moment its oldest bucket ages out, and stays stale. This consumes the refresh.
POST /aggregations/v1/sweeptakes refresh messages and recomputes the ranking row each one names:{ "items": [ { "type": "TOPK", "item": { "database": "graph", "table": "likes", "topk": "daily_likes", "source": "...", "target": "...", "direction": "OUT", "entity": "...", "topkDimensionValue": "...", "dimensionValues": "", "ranges": "", "properties": {}, "refreshAt": 1755500000000 } } ] }{ "items": [ { "database": "graph", "table": "likes", "topk": "daily_likes", "entity": "...", "status": "OK", "error": null } ] }SweepItemresolvesitempolymorphically offtypethrough Jackson'sEXTERNAL_PROPERTY, so a second aggregation kind adds aSweepItemPayloadsubtype and aJsonSubTypesentry rather than a second endpoint.AggregationHandlergainssweep, andAggregationServicedispatches byAggregationTypeinstead of fanning out toevery handler the way
aggregatedoes — a refresh message already knows which kind it belongs to.TopkSweepItemcarries exactly whatrefreshKeyencodes, plusrefreshAt, so the consumer can rebuild the ranking without reading the queue row back.Sweep is a write path and is rejected under read-only mode, alongside
POST /aggregations/v1/aggregate.Stacked on #494 — that needs to land first.
Part of #386.
Test plan
./gradlew :engine:test --tests '*TopkAggregationHandlerTest*'— recompute from a refresh message, including the rank row rewrite./gradlew :engine:test --tests '*AggregationServiceTest*'— dispatch to the handler named byAggregationType./gradlew :server:test --tests '*MetadataAggControllerE2ETest*'—POST /aggregations/v1/sweepover HTTP, per-item status and error./gradlew :server:test --tests '*ReadOnlyRequestFilterTest*'— sweep is blocked in read-only mode./gradlew spotlessKotlinCheck build— formatting and full buildAI Assistance