Share thread state idle TTL across client atoms#3163
Conversation
- Extract the thread retention TTL into a shared constant - Apply the same idle retention to thread state and detail atoms - Add coverage for atom family caching and TTL behavior
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
ApprovabilityVerdict: Approved This PR consolidates a shared constant for thread state idle TTL and applies it consistently across client atoms. The behavioral change (adding idle TTL to thread state atoms) is intentional, documented, and tested—low-risk state management alignment. You can customize Macroscope's approvability policy. Learn more. |
|
🚀 Expo continuous deployment is ready!
|
Summary
THREAD_STATE_IDLE_TTL_MSconstant.Testing
vp checkvp run typecheckvp run lintvp test packages/client-runtime/src/state/threads-atoms.test.tsNote
Low Risk
Client-side atom caching/retention only; behavior change is bounded TTL alignment and slightly longer retention for primary thread state atoms.
Overview
Introduces
THREAD_STATE_IDLE_TTL_MS(5 minutes) inthreadRetention.tsso stream-backed thread state and all thread-detail-derived atoms use the same idle retention window—aimed at keeping thread data alive across brief subscriber gaps (e.g. mobile back navigation) without retaining every opened thread indefinitely.createEnvironmentThreadStateAtomsnow pipesAtom.setIdleTTLand a debug label onto each per-thread state atom; detail atoms inthreadDetail.tsswitch from a local constant to the shared one. A small test asserts the TTL value andAtom.familyidentity per environment/thread pair.Reviewed by Cursor Bugbot for commit c5fe456. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Share idle TTL constant across thread state client atoms
THREAD_STATE_IDLE_TTL_MSconstant (5 minutes) into a new threadRetention.ts module, replacing the local copy in threadDetail.ts.createEnvironmentThreadStateAtomsin threads.ts to applyAtom.setIdleTTL(THREAD_STATE_IDLE_TTL_MS)and a descriptive label to each atom in the family — previously these atoms had no idle TTL or label.Macroscope summarized c5fe456.