Skip to content

fix(server): retain one timeline revision per request shape - #2067

Draft
Yazington wants to merge 1 commit into
get-bb:mainfrom
Yazington:fix/timeline-cache-revision-retention
Draft

fix(server): retain one timeline revision per request shape#2067
Yazington wants to merge 1 commit into
get-bb:mainfrom
Yazington:fix/timeline-cache-revision-retention

Conversation

@Yazington

Copy link
Copy Markdown

What was wrong

The timeline response cache included the thread max sequence in its map key. Each appended event therefore made the prior entry unreachable by future lookups while still retaining its full payload until global LRU eviction. Active threads could accumulate many obsolete revisions for the same request shape, contributing avoidable server heap pressure. See #2066.

What changed

  • Key the cache map by normalized request shape and store the current revision alongside the value.
  • Return a hit only when the stored revision matches the requested revision.
  • Replace the previous revision immediately when a new cacheable response is built.
  • Remove the previous revision when the replacement exceeds the cache size limit, preventing stale data from remaining strongly retained.
  • Preserve independent entries for distinct request shapes and the existing global LRU bound.
  • Add regression coverage for revision replacement, independent shapes, oversized replacements, repeat hits, and LRU eviction.

How you verified

  • Focused timeline-cache.test.ts Vitest suite: 7/7 passed; the revision-retention assertion failed before the implementation change.
  • @bb/server Turbo typecheck passed.
  • ESLint and Prettier checks passed for all three changed files.
  • git diff --check origin/main...HEAD passed after rebasing onto current main.
  • No Playwright or browser automation was used.

Fixes #2066

AGENT GENERATED: by OpenAI Codex (GPT-5)

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.

Timeline cache retains obsolete revisions for the same request shape

1 participant