Skip to content

feat(desktop): preserve transcript continuity across bounded ranges - #4560

Open
Sun-GLiang wants to merge 3 commits into
apache:mainfrom
Sun-GLiang:codex/issue-4123-bounded-continuity
Open

feat(desktop): preserve transcript continuity across bounded ranges#4560
Sun-GLiang wants to merge 3 commits into
apache:mainfrom
Sun-GLiang:codex/issue-4123-bounded-continuity

Conversation

@Sun-GLiang

@Sun-GLiang Sun-GLiang commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Summary

Rebuilds transcript partial-history handling on current main around the existing bounded-range seams.

  • Render an in-flow gap row only at an actual older or newer boundary.
  • Load older, newer, and latest ranges through the existing transcript range controller.
  • Keep the resident transcript as one contiguous bounded window.
  • Keep the existing transcript scroll authority as the only scroll writer.
  • Clear the historical reading anchor when an explicit newer or latest navigation supersedes it, so restoration cannot pull the range backward again.
  • Consume a search jump after it successfully lands, so later range paging cannot be pulled back by stale search-restore intent.

This intentionally does not add a position index, storage table, cursor protocol, compatibility-epoch change, alternate pager, or second scroll authority.

Fixes #4123

Current status

Ready for maintainer review. The rebuild and local verification are complete, CI is green, and the PR remains open awaiting approval.

Verification

Current head: e5365d2e34daa79aef702356e729b14e58284854

  • CI test — passed
  • CI label — passed
  • npm --workspace @maka/desktop run build:with-deps
  • npm --workspace @maka/desktop run typecheck
  • npm --workspace @maka/desktop run test:dist — 2163 passed, 0 failed
  • npm --workspace @maka/desktop run check:architecture — 101 checks passed plus architecture-ledger validation
  • Targeted Electron E2E: partial-history-notice.spec.ts — passed
  • Biome check for the 35 changed files — passed

Review focus

  • Gap placement for latest, historical, intermediate, and live-overlay ranges
  • Reuse of the existing loadBefore, loadAround, loadLatest, reading-anchor, and scroll-authority seams
  • Explicit newer/latest navigation superseding stale historical restoration intent
  • One-shot search restore after a successful jump
  • Preservation of a single contiguous resident range and a single transcript scroll writer
  • No storage, Runtime Host protocol, compatibility-epoch, or design-document changes

AI use

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Codex rebuilt the implementation from current main, added tests, and reviewed the diff against the corrected issue and repository standards.

Checklist

  • Tests cover the behavioral change
  • Targeted local build, typecheck, architecture, E2E, formatting, and test verification complete
  • CI complete

Does this PR entail a change in behavior?

  • Yes — partial transcript boundaries are represented and loadable in-flow
  • No

@github-actions github-actions Bot added the effort/XL Under 2500 readable lines label Sep 2, 2026
@Sun-GLiang
Sun-GLiang marked this pull request as ready for review September 2, 2026 16:40
@Sun-GLiang
Sun-GLiang marked this pull request as draft September 2, 2026 16:44
@Sun-GLiang
Sun-GLiang marked this pull request as ready for review September 2, 2026 19:17
@Sun-GLiang
Sun-GLiang marked this pull request as draft September 3, 2026 06:59
@Sun-GLiang
Sun-GLiang marked this pull request as ready for review September 3, 2026 15:42
@github-actions github-actions Bot added effort/XXL Over 2500 readable lines and removed effort/XL Under 2500 readable lines labels Sep 3, 2026
@Sun-GLiang
Sun-GLiang force-pushed the codex/issue-4123-bounded-continuity branch 3 times, most recently from fc447c8 to fd473f0 Compare September 4, 2026 11:40
@Sun-GLiang
Sun-GLiang force-pushed the codex/issue-4123-bounded-continuity branch from fd473f0 to c69e995 Compare September 4, 2026 15:30
@Astro-Han

Copy link
Copy Markdown
Contributor

Thanks for the work, and I owe you an apology: I left you hanging after asking you to pause #4258 and #4295 on Aug 31, so you had to build against the outdated issue text. That is entirely on me.

I have corrected #4123. Most of this PR's 6.7k lines trace back to two incorrect assumptions in the original issue:

  • Separated ranges can appear adjacent: They cannot. #evictToBudget only trims from the ends and #acceptRange throws on internal sequence gaps, so the resident durable window stays contiguous; only the two boundaries need markers.
  • Identity and paging state do not cross the preload boundary: They already do (identity, durableThrough, hasOlder, hasNewer, loadBefore, and loadAround).

The position-index chain (sqlite-session-turn-positions.ts, session-transcript-position-pager.ts, transcript-signed-cursor.ts, the new operation, and the 109→110 epoch bump) is therefore unnecessary. What is left is small: project generic rows, render a boundary gap row, and page via existing loadBefore / loadAround.

Two scroll-layer issues to note regardless of scope:

  1. recordProgrammaticScroll introduces a second time-window authority (160ms) alongside transcript-scroll-authority (which deliberately refuses to infer intent from timing; see header). Its wheel, pointerdown, touchstart, and keydown listeners also break nested scrollers because wheel bubbles.
  2. root.scrollTop += displacement in restorePagingAnchor adds a second writer of scrollTop. "One writer" is an explicit acceptance criterion of that authority, not a style preference — a second writer is the exact bug class bug(ui): upward scroll can snap back to the live tail during geometry changes #4269 turned out to be.

Landing order: #4793 (pin owns scroll anchoring) then #4259 (containment CSS) must land first. Both touch the same scroller, and #4259 already conflicts with this branch.

Next steps: A rebase will not fix this, as the shape follows issue text I got wrong. The corrected #4123 is now specific enough to build against directly: generic rows, a gap row, and existing pagers — no new persistence, no epoch bump. If you would rather not redo it after two false starts, let me know and I will take it over. Either way, I will review follow-ups within a day, not a week.

@Sun-GLiang
Sun-GLiang force-pushed the codex/issue-4123-bounded-continuity branch from c69e995 to 6b2c88a Compare September 5, 2026 03:36
@Sun-GLiang
Sun-GLiang marked this pull request as draft September 5, 2026 03:49
@Sun-GLiang
Sun-GLiang force-pushed the codex/issue-4123-bounded-continuity branch from 6b2c88a to d856588 Compare September 5, 2026 03:55
@github-actions github-actions Bot added effort/L Under 1000 readable lines and removed effort/XXL Over 2500 readable lines labels Sep 5, 2026
@Sun-GLiang
Sun-GLiang force-pushed the codex/issue-4123-bounded-continuity branch from d856588 to 9868f5f Compare September 5, 2026 05:13
@Sun-GLiang
Sun-GLiang force-pushed the codex/issue-4123-bounded-continuity branch from 9868f5f to 7fdc015 Compare September 5, 2026 05:56
@Astro-Han

Copy link
Copy Markdown
Contributor

Thanks for substantially simplifying this! My earlier comments about the timer/extra scroll writer and waiting for #4793 no longer apply; #4793 is closed, and I don't see a reason to require #4259 first.

One remaining P2 at 7fdc015: clicking the newer gap records a reading anchor, but only latest clears it. If loadAround evicts that anchor, restoreRange can load the old range again. Please let explicit newer navigation supersede the stale restore intent at the existing navigation seam, and cover that the page stays advanced. This is a source-level finding; I haven't reproduced it in Electron.

AI-assisted review with Codex.

@Sun-GLiang
Sun-GLiang marked this pull request as ready for review September 5, 2026 07:07
@Sun-GLiang

Sun-GLiang commented Sep 5, 2026

Copy link
Copy Markdown
Contributor Author

@Astro-Han Fixed in b93cefee6.

I reproduced the behavior in the Electron E2E: after explicit newer navigation, the newer range appeared briefly, then restoreRange restored the stale reading anchor and the older boundary disappeared again.

The fix stays at the existing loadTranscriptHistory navigation seam: explicit newer and latest navigation now clear the reading anchor, while earlier paging preserves it (source).

The existing bounded-history E2E now waits across rendered frames after clicking the newer gap and verifies that both boundaries remain present, so the page stays advanced (regression). The added assertion fails before the fix and passes after it.

Local verification passed: Desktop build, typecheck, 2163 Desktop tests, 101 architecture checks, and the targeted Electron E2E.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/L Under 1000 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(desktop): preserve transcript continuity across bounded ranges

2 participants