Skip to content

feat(review-tutor): coalesce answer streaming and add tab question ownership - #66

Closed
ElbertePlinio wants to merge 1 commit into
feat/review-tutor-packagefrom
feat/review-tutor-hardening
Closed

ElbertePlinio wants to merge 1 commit into
feat/review-tutor-packagefrom
feat/review-tutor-hardening

Conversation

@ElbertePlinio

Copy link
Copy Markdown
Member

Closes #64. Stacked on #65 (base branch feat/review-tutor-package); part of the batched Review Tutor chain #65 → this → #62 slices. Merge in order; GitHub retargets the base automatically.

What changed

  • Streamed answer Markdown renders are coalesced to at most one DOM update per animation frame (16ms timeout fallback without rAF). Accumulated text updates immediately; terminal question events cancel any pending frame and render synchronously from canonical state, so no final delta can be lost and native selection is no longer destroyed by every delta.
  • Explicit multi-tab question ownership: each page mints a per-tab id in sessionStorage, sends it as an optional ownerPageId on ask, and the server echoes it on QuestionView. A page adopts an active question only when it owns it or the question is ownerless (legacy). A reload still recovers its own question; a second tab no longer adopts, displays, or cancels a foreign one, but stays honestly busy-gated while it runs.
  • rt/1 is unchanged: both fields are additive and optional.

Tested

  • New deterministic large-stream test: 300 deltas across 3 simulated frames produce exactly 4 renders (including the terminal render) with byte-exact final text.
  • New tests: owned reload recovery, foreign tab non-adoption, legacy adoption, ask payload carries the page id, protocol validation (omitted / valid / oversized / wrong type), ownership persisted through ask response and /api/state.
  • bun run check: 417 passed | 25 skipped, coverage 78.34% statements, typecheck, lint, build.

Not tested

Risks

  • Low. A second tab now sees Ask/Cancel disabled while another tab's question runs, with no answer shown — intentional per the ownership contract.

Local review: standard risk class, one independent correctness/test-integrity reviewer + KISS gate. Not release-note-worthy (platform packages repo).

Human gate: stops at ready for human review; merge only on Elberte's authorization.

…nership

Streamed Markdown renders now coalesce to one DOM update per animation
frame with synchronous terminal rendering, and questions carry an
optional per-tab owner id so a reload recovers its own question while a
second tab no longer adopts a foreign one. rt/1 stays compatible; the
new fields are additive and optional.
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.

1 participant