Skip to content

feat: long entity pagination#217

Draft
johanpel wants to merge 9 commits into
rapidsai:mainfrom
johanpel:long-entity-limiter
Draft

feat: long entity pagination#217
johanpel wants to merge 9 commits into
rapidsai:mainfrom
johanpel:long-entity-limiter

Conversation

@johanpel

@johanpel johanpel commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

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

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>
@johanpel johanpel force-pushed the long-entity-limiter branch from a3e4756 to 763b04c Compare June 11, 2026 13:45
@johanpel johanpel added feature request New feature or request non-breaking Introduces a non-breaking change labels Jun 11, 2026
@johanpel johanpel changed the title feat: long entity pagination (WIP) feat: long entity pagination Jun 11, 2026
johanpel and others added 8 commits June 12, 2026 12:02
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature request New feature or request non-breaking Introduces a non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant