# PDF retry proof driver

Run separately on base [b5c30ad04a](https://github.com/pingdotgg/t3code/commit/b5c30ad04a1c212167489dd4023a86427d9b9e07) and head [a83786b392](https://github.com/pingdotgg/t3code/commit/a83786b39220039a97fe3902003423d57f9a9a51), using each checkout's own fresh server home. Use the repository's scripts/scenarios/start-app.ts web launcher (no copied database), a 1280x800 CSS viewport, light theme and the in-app PDF.js viewer. Copy seed.ts to scripts/manual-proof-seed.ts so its helper import resolves; run it with the fresh home as its argument. Replay's multi-turn model supplies the synthetic conversation. If the model catalog is still discovering, allow discovery to finish before starting the thread.

Start the server with NODE_OPTIONS pointing to clock.cjs via --require, and PDF_CLOCK_FILE naming a scratch text file. The preload changes Date.now only in the real server CLI process. Initially write -3420000 into that file (server wall clock 57 minutes behind). The real one-hour signed grant consequently has about three minutes left as seen by the browser. This is clock-controlled expiry, not an actual one-hour wait and not a fabricated asset response.

1. Sign in using the launcher's browser-dev-token through POST /api/auth/browser-session; open the seeded thread directly.
2. Evaluate the first PDF download-blocking block in browser-driver.js before opening planning.pdf. It forces the PDF.js fallback, rejects that PDF's initial fetch and records later real response statuses. Start tab recording. Open planning.pdf using Control+P and the file-picker result after the picker is ready. Wait for Failed to fetch and Try again.
3. Use pdfProof.fetch(pdfProof.original, {cache:'no-store'}) to verify the real original grant returns 200. Write 240000 into PDF_CLOCK_FILE (advance the isolated server 61 minutes). The same cache-bypassed GET must now return 404. Set pdfProof.blocked=false.
4. Click Refresh workspace files. Evaluate the read-only React-props block to find the new PdfDocumentRevision URL in pdfProof.renewed; fetch it cache-bypassed and verify 200 application/pdf. This only observes props and makes direct GETs; it never changes the URL the app receives.
5. Click Try again. Base: pdfProof.requests records original=true/status=404; the error remains. A second click repeats the same 404. Head: original=false/status=200; the actual canvas and PDF text render on the first click.
6. Blur the active input before stills; capture two screenshots at least 500 ms apart and compare decoded pixels. The primary before and after stills each had zero differing pixels. Stop recording.

Head-only follow-up: open the supplied three-page reading.pdf through the same real asset service with the initial clock offset, downloads allowed, and the probe adapted to reading.pdf. Go to page 2 and click Zoom in (65%). Record, advance the clock 61 minutes and refresh workspace files. The PdfDocumentRevision props acquire a different URL while page 2 / 3 and 65% remain; the request log contains only the initial PDF download. reading.mp4 records that refresh.

Head-only delayed-renewal follow-up: use another fresh home with the initial offset and a failed planning.pdf. Install the final WebSocket-send gate block from browser-driver.js after that failure. Record; advance the clock, unblock PDF downloads and click Refresh workspace files. Confirm pdfHold.queue.length is 1. Click Try again before releasing that request; the original PDF fetch returns 404. Call pdfHold.release() to send the unchanged real RPC to the real server. The renewed link arrives, fetches successfully (original=false/status=200), and the PDF renders without a second click. The uploaded delayed-renewal video is slowed to one-quarter playback speed for readability.

The seed and probe contain synthetic data only. No app source or asset response was replaced. The primary before/after recordings are at original playback speed.
