Skip to content

fix(sessions): preserve legacy data when exclusive projection fails - #11469

Merged
diegosouzapw merged 2 commits into
diegosouzapw:release/v3.8.51from
KaspaPulse:fix/sessions-exclusive-projection-fallback
Aug 26, 2026
Merged

diegosouzapw merged 2 commits into
diegosouzapw:release/v3.8.51from
KaspaPulse:fix/sessions-exclusive-projection-fallback

Conversation

@KaspaPulse

@KaspaPulse KaspaPulse commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Root cause

The additive exclusive-session projection introduced by #11389 ran inside the same outer try as the legacy /api/sessions snapshot. A database or projection failure therefore returned 500 and discarded already-available count, sessions, and byApiKey data.

Graceful fallback

The exclusive projection now has a narrow failure boundary. On projection failure the endpoint keeps its legacy data and returns exclusiveSessions: [] with one static warning per contiguous outage, without changing lease authority, routing, schema, storage, or UI behavior. A successful projection re-arms the warning for a later distinct outage.

Privacy guarantee

The warning never includes the caught error. The failure-injection regression test places an owner hash, generation, API-key ID, credential, token, connection identity, lease ownership, and fencing material in the thrown error and proves that none appears in the response or warning.

Duplicate search

Authenticated GitHub searches covered open and closed issues, open/closed/merged PRs, Discussions, recent commits, current release/v3.8.51 code, and all 28 open PRs for the required terms. No equivalent fallback or open PR touching src/app/api/sessions/route.ts was found; the only directly relevant result was merged PR #11389.

Focused validation

  • Original fallback TDD: 5 passed, 1 failed before the graceful fallback (500 !== 200), then 6 passed, 0 failed after it.
  • Warn-storm TDD: 5 passed, 1 failed before warning deduplication (the second consecutive failed poll warned again), then 6 passed, 0 failed after it.
  • The focused outage regression proves identical legacy responses across consecutive failures, one warning per contiguous outage, and re-arm after a successful projection.
  • git diff --check: pass.
  • Prettier on all three touched files: pass.
  • ESLint on both touched TypeScript files: pass.
  • Full matrix, build, Docker/OCI, runtime smoke, and provider/model calls were intentionally not run.

The changelog also records the maintainer clarification from #11389 that the Sessions badge intentionally shows the merged legacy and exclusive row count.

⚠️ base-red inherited: #11449

Refs #11389

@KaspaPulse
KaspaPulse force-pushed the fix/sessions-exclusive-projection-fallback branch from 6ba813c to e9a9692 Compare August 25, 2026 08:19
@diegosouzapw
diegosouzapw merged commit be6cbe7 into diegosouzapw:release/v3.8.51 Aug 26, 2026
7 of 16 checks passed
@KaspaPulse
KaspaPulse deleted the fix/sessions-exclusive-projection-fallback branch August 31, 2026 11:12
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…iegosouzapw#11469)

Validated in a combined sub-batch worktree off release/v3.8.51 tip.
- Focused test: exclusive-session-observability.test.ts — part of sub-batch's 165/165 node:test run
- typecheck:core, file-size, changelog-integrity, complexity, cognitive-complexity — all OK
- Full-repo lint: 228 pre-existing dashboard react-hooks/* findings, unrelated to this diff

Thanks for the narrow failure boundary and the privacy-conscious warning (proven not to leak the caught error's sensitive fields) — a projection failure discarding valid legacy data was a real regression from diegosouzapw#11389.
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.

2 participants