Repository navigation
fix(sessions): skip session rows without an id in the sweep - #1645
Conversation
isStaleActive did not look at id, so a stale active row without a string id reached kv.get(KV.sessions, candidate.id). The engine rejects a state::get with no key, the row was counted as failed, and since the sweep can never abandon it, every hourly run reported success: false. The sweep now skips rows without a non-empty string id, the same check the sessions endpoint and memory_sessions apply. Signed-off-by: Dmitrii Zhukov <dmitry0983@gmail.com>
|
@dmazhukov is attempting to deploy a commit to the rohitg00's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Validate stale session IDs src/functions/session-sweep.ts, test/session-sweep.test.ts |
isStaleActive rejects rows with missing, non-string, or empty IDs. The test verifies that unusable rows remain active, valid stale sessions are abandoned, and the sweep reports no failures. |
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Bug fix · Severity of issue fixed: Medium
Possibly related issues
#1644: The change adds the requested guard that skips stale rows without a non-empty string ID.
Suggested reviewers: rohitg00
Merge Risk: 
Minimal · up to 53ca6
-
The sweep now skips malformed session rows while continuing to abandon valid stale sessions. No actionable merge-blocking issue remains; merge after normal checks pass.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Linked Issues check
-
Explanation
Issue
#1644requires the sweep to skip stale active rows without a non-empty stringid, abandon other stale sessions, and reportsuccess: truewithfailed: 0when no other failures occur.src/functions/session-sweep.tsnow rejects missing, non-string, and empty IDs before stale-session processing. The added test covers these row shapes, verifies that the valid stale session is abandoned, and verifiessuccess: truewithfailed: 0.
Full details: Out of Scope Changes check
-
Explanation
The changes are limited to the required
mem::session-sweepguard and its automated test. The test verifies that unusable rows remain active. No unrelated eviction, import repair, or store cleanup behavior was added.
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 2 files.
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
-
Finishing Touches
-
Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
The override matches mockKV's own get signature and the typed sdk.trigger needs no cast, so the new test follows the no-any rule in CONTRIBUTING. Signed-off-by: Dmitrii Zhukov <dmitry0983@gmail.com>
mem::session-sweepnow skips stale active rows inmem:sessionsthat have no non-empty stringid, so one such row no longer fails every hourly run. Fixes #1644.isStaleActivedid not look atid, so the sweep sentstate::getwith nokeyfor such a row. The engine rejected it, the row was counted infailed, and every sweep returnedsuccess: false, because the row could never be abandoned. The guard is the oneapi::sessionsandmemory_sessionsalready apply.Not covered: the id-less rows stay in the store, and
mem::evictand replace imports still address rows byid; repairing them needs the store key, whichkv.listdoes not return.Summary by CodeRabbit