feat: long entity pagination#217
Draft
johanpel wants to merge 9 commits into
Draft
Conversation
Add per-entry pagination to the long-entities portion of the resource timeline endpoints. Requests gain optional long_entities_max (page size; null/0 = unlimited) and long_entities_page (0-based index); responses gain long_fsms_total so clients can compute page count, and long_fsms becomes the ranked page slice. Entities are ranked by their longest qualifying usage span (descending, id tie-break). The analyzer tracks that duration per entity; it rides on FiniteStateMachine as a serde/ts-skipped field used only for server-side ranking and never appears on the wire. Pagination runs after chunk merge in the server cache layer at a single tail point covering the fast path and all uncached fallbacks, and is excluded from the chunk cache key so pages reuse cached chunks. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
a3e4756 to
763b04c
Compare
…sumers
Adopt the LongEntitiesParams/PageParams request structure proposed in the previous commit across all consumers so the workspace builds again: the server cache derives the threshold from long_entities for the chunk cache key and reads PageParams for post-merge pagination (the page stays out of the cache key); the simulator analyzer reads the threshold from long_entities; and the UI request builders emit long_entities: { threshold_s, page } or null.
Also removes the orphan LongEntitiesPageParams.ts binding left over from an earlier iteration.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drop the per-FSM duration field carried solely for ranking and instead derive the rank key server-side from each FSM's transitions (the largest gap from a usage-bearing transition to the next), applied at the pagination tail. Reverts the analyzer/simulator duration plumbing so the long-entities order is established entirely from data already present in transitions, with nothing extra on the FSM or the wire. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…nsumers Adopt the Option<LongEntities> response structure proposed in the previous commit. The analyzer's ResourceTimeline.long_entities becomes Option<Vec<Uuid>> (Some iff a threshold was requested), which flows to the response Option without threading a flag through the converters. The simulator maps it to Option<LongEntities>; the server's combine_chunks merges each chunk's Option (None unless requested, otherwise the deduped union) and paginate ranks/slices the Some case; the UI reads long_entities?.long_fsms. Semantics: None = not requested, Some with empty long_fsms = requested but none found, Some with entries = ranked page plus long_fsms_total. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…builder In the same pass as binning, the resource timeline builder records entities whose usage span on the resource exceeds the long-entities threshold, keeping each entity's longest such span (LongUsageEntity). build() returns them ordered longest-usage-first (id tie-break), or None when no threshold was requested. Ranking, pagination, caching and chunking are deliberately left to higher layers. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Reference snapshot of the approach where long entities ride the chunked timeline: server cache (timeline_cache.rs) owns ranking, cross-chunk order recovery, and pagination; the simulator resolves entities; the public entry points are renamed paginate_*. Kept for reference only — to be superseded by a dedicated entities endpoint (see docs/agents/). Co-Authored-By: Claude Opus 4.8 (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.
Description
WIP, do not review or merge yet.
This PR will add the option for the UI to limit the number of long entities that use a resource are transported to it in full from the analyzer.
Related Issues
#214