# Backend evidence for issue 20427

Issue: [#20427](https://git.cafe/pingdotgg/t3code/issues/20427). Final [597cc5acc2](https://git.cafe/pingdotgg/t3code/commit/597cc5acc28f1a40b196e8169797488ca90a3a83), requested base [a46f80ee28](https://git.cafe/pingdotgg/t3code/commit/a46f80ee28d9b498bb8b407c8b60bd4e93bbe2e3). Worktree `/home/ubuntu/wt/issue-20427` remained clean. Captured 2026-10-24 UTC by GPT-6.1 Sol through Codex.

## Artifacts

[Complete compact bundle (scripts, results, raw logs, SHA-256 manifest; no databases)](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/05757f5dabaf8cf9/backend-evidence-final.tar.gz)

Existing [matrix pass 1](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/1c1dc8394140285b/proof-matrix-pass1.md): server-only, zero visual rows. Its final-head evidence gaps are updated below.

- [Raw red runner](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/a900602aea9a067b/red-raw-runner.log)
- [Raw final scoped runner](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/da0e1bb70146d02f/final-focused-tests.log)
- [Original reporter harness](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/ec16c522df7d696d/history-paging.mjs)
- [Exact-identity scratch harness](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/df38e12600f43fcf/history-paging-exact.mjs)
- [Cold timeline scratch harness](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/c5d1e6d1e40a4eb5/history-paging-cold-timeline.mjs)
- [Existing round-2 query benchmark bundle](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/25713ba0a182d12b/round2-bench.tar.gz)

## Red and green

Red checkout: [2492e71a4a](https://git.cafe/pingdotgg/t3code/commit/2492e71a4a069064018a30adc1ccbb86d4b269e2), test-only commit on [6e79211743](https://git.cafe/pingdotgg/t3code/commit/6e792117436662208bf2b6eb71ee8d0d88817e43). Relevant server source is reported identical to requested base. `vp install` succeeded (log bundled); checkout was clean before removal. Command:

```sh
vp test run apps/server/src/orchestration-v2/ProjectionStore.test.ts -t 'pages a whole thread without re-reading its full timeline for every page'
```

Exit 1: history performs 4 whole-thread reads over 4 pages, expected at most 1. One failed, 37 skipped. This raw rerun stops at the history assertion; the old report's independent timeline-red assertion remains reported evidence only. Temporary `/tmp/issue-20427/red-checkout` was removed with `git worktree remove` after runner exit.

Final-head command (checkout cwd):

```sh
vp test run apps/server/src/orchestration-v2/ProjectionStore.test.ts apps/server/src/orchestration-v2/threadHistoryPaging.test.ts apps/server/src/orchestration-v2/ThreadSearch.test.ts apps/server/src/orchestration-v2/ThreadFind.test.ts
```

Exit 0: 4 files, **92 tests passed**, 18.30 seconds. No repository-wide checks. Regression covers both paging APIs' scan count, 600 unique IDs, fork-source append, and committed event-sequence mismatch without direct apply. Existing tests cover bounded history/visibility, imported runless fork history, rollback stability, cursor recovery, complete-turn paging, fallback budgets, search/find invalidation and reader-worker behavior. This does not imply every existing visibility fixture explicitly warms the new paging cache.

## Comparable warm in-process results

Each row: one synthetic completed run; one warmup and three measured walks; all three assert exact chronological IDs, unique count, total count and cursor termination. Node **v26.12.1**, same checkout/host as retained baseline. Scratch harness only adds assertions/page-size recording to reporter harness. No production code or tests edited.

| Items | Pages per walk | Median complete walk ms | Per-page median ms | Result |
|---:|---:|---:|---:|---|
| 1,000 | 6 | 35.7 | 5.96 | [raw JSON](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/a36eb10f8d0d1c1e/result.json) |
| 5,000 | 28 | 210.9 | 6.7 | [raw JSON](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/e9b7b40351d0f881/result.json) |
| 13,000 | 73 | 535.6 | 6.74 | [raw JSON](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/d83204c3a2afe3e0/result.json) |

For each N=1000,5000,13000, command executed from final checkout:

```sh
node /tmp/issue-20427/history-paging-exact.mjs --source /home/ubuntu/wt/issue-20427 --output /tmp/issue-20427/comparableN --items N
```

Retained baseline (bundle `run1000/result.json`, `run13000/result.json`), Node v26.12.1 at the baseline revision: 1,000 items/6 pages, median 74.7 ms; 13,000 items/73 pages, median 5,399.7 ms. Final medians 35.7 and 535.6 ms imply approximately 2.1× and 10.1× for this workload only. No 5,000-item baseline. Raw page timing arrays and page sizes are retained. Host load was not isolated; synthetic, warm, same-process repetitions do not establish cold-process, network, rendering, concurrency or production latency.

The unmodified reporter harness also ran final1000/final5000/final13000 successfully (6/28/73 pages; all counts correct), but invocation outside the checkout selected Node v24.22.1. Those results are retained, excluded from comparable ratios. Additional exact1000/exact5000/exact13000 v24 runs are retained for transparency.

## Independent cold timeline

[Cold timeline result](https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/17e0eecaf1e0f80b/result.json): 1,000 items, 10 pages at limit 100, totalItems=1,000 on every page, exact chronological IDs and 1,000 unique IDs. This walks timeline before any history call on a fresh store; then history also passes. It proves independent cold timeline output, not an independent SQL scan-count trace.

```sh
# cwd /home/ubuntu/wt/issue-20427
node /tmp/issue-20427/history-paging-cold-timeline.mjs --source /home/ubuntu/wt/issue-20427 --output /tmp/issue-20427/cold-timeline1000 --items 1000
```

## Fork query benchmark inspection

Existing round2 scripts/results inspected, not rerun against user data. Fixture: two old ancestry streams plus 300,000 unrelated newer events. At target sequences 2,000/100,000, unhinted query averages 92.7065/93.7410 ms; final hinted-IN shape averages 0.0034/0.0037 ms, identical maxima. EXPLAIN uses covering `idx_orchestration_events_agent_stream_sequence` for hinted variants. Existing real-results report 210,977 events, same maximum 175,153, unhinted 86.2828 ms vs hinted 0.0080 ms warm average. Real-data provenance is inherited, not independently rerun. Bundle contains scripts and numeric plans/results only, no source database or stream IDs. Production final query uses the hinted-IN shape. These are query microbenchmarks, not end-to-end fork paging latency.

## Limits and handoff

No server/browser/provider started, no HTTP request issued, no live state opened. Integrated final-head HTTP proof belongs to lead; existing `http-paging-driver.js` is bundled but not run. Existing HTTP before/after artifacts are not final-head proof and are intentionally excluded from performance comparisons here. No forge writes, PR, push, merge or comments. No task-checkout implementation/test modifications, commits or PR-only artifacts. All spawned runner processes completed; own temporary checkout removed.

Remaining optional matrix depth is not newly imposed as a release gate: no dedicated cache eviction, nested-fork/cycle, transaction-interleaving or exhaustive warm-cache visibility test was added. No memory bound or fully page-size-only claim; per-page array mapping/filtering remains.

## Friction

- RUNTIME_SELECTION | Node shim selects v24 outside checkout, v26 inside it. | Run benchmark from source checkout and record process.version; mismatched runs retained and excluded from ratios.
- EVIDENCE_PROVENANCE | Earlier red artifact was a summary. | Raw red runner captured at exact test-only revision; original timeline-red remains explicitly reported-only.
- PROOF_BOUNDARY | Server-only task forbids HTTP/server/browser execution. | Lead supplies integrated final-head HTTP transcript; in-process measurements remain labeled separately.
