Skip to content

Off-thread live tracking, targeted clue recovery and private scan diagnostics - #66

Merged
senegrom merged 33 commits into
masterfrom
improve/live-worker-recovery-diagnostics-20260919
Sep 21, 2026
Merged

senegrom merged 33 commits into
masterfrom
improve/live-worker-recovery-diagnostics-20260919

Conversation

@senegrom

@senegrom senegrom commented Sep 19, 2026

Copy link
Copy Markdown
Owner

Completed and verified — branch only

Branch: improve/live-worker-recovery-diagnostics-20260919.
Final head: 65b932865beff062e60e9bb379247a8e0b42493d.
This PR remains a draft. Nothing has been merged or deployed.

The original worker-backed tracking, selected-cell OCR and private diagnostic exports are retained. All three requested follow-up additions are now implemented and verified.

1. Safe failed/exhausted retries

A failed or timed-out targeted read retires only its own request and preserves the previous full reading and review evidence. That reading is displayed only while the original scene is currently verified. Late replies cannot restore a retired puzzle or overwrite a newer retry.

Identical-crop and explicit zero-OCR skips refund their reserved attempt, while retaining the quality threshold and 1.5-second cooldown to avoid repeated work on unchanged evidence. Errors/timeouts conservatively consume an attempt. After two spent attempts per cell, the interface and diagnostics explicitly request manual review rather than continuing to promise automatic recovery. Changed content/settings, prolonged scene loss and Stop retain their existing invalidation rules.

2. Frame-aware, load-bounded camera processing

Heavy processing follows newly presented video frames through requestVideoFrameCallback where available, with fallback decoded-frame counts or a changing video clock. Duplicate, out-of-order, missing, paused and ended video evidence cannot renew freshness.

Processing intervals are bounded to 100–300ms and adapt to worker timing and settled readings; the latest-frame queue remains bounded. A separate 100ms heartbeat checks the existing 500ms freshness limit even when video callbacks stop. A late detector response cannot sample a frozen feed and manufacture fresh evidence. Image extraction/rendering still involve the main thread; this is not a physical-phone speed or battery claim.

3. Genuine automatic-recovery regression

live_recovery_regressions.cjs drives the production camera, detector, actual tracking worker and Tesseract with a real canvas MediaStream. A printed cell loses raster detail and is then restored. OCR values, uncertainty flags, quality scores, corners and identity proofs are not injected. Expected values are used only to score output.

The suite tests automatic selected-cell recovery, unchanged confident clues and blank cells, review preservation, paused/resumed playback, and a real OCR reply delayed until the photographed puzzle changes. The changed-puzzle case verifies that changed pixels reached the preview and the original ownership was retired before releasing the old reply.

It runs in both Scanner quality and independent acceptance of the exact built app.

Final verification

All four app-test workflows passed on the final head:

Workflow Run Result
Browser branch tests 35524954414 Passed
CI 35524954393 Passed
Scanner quality 35524954492 Passed
Full build and exact-artifact acceptance 35524954483 Passed
  • 774 JavaScript tests passed, with zero failures, cancellations or skipped tests. This includes 22 follow-up tests beyond the original 752-test branch.
  • Native adapter/solver regressions and the self-hosted runtime build passed.
  • The complete camera/solver/capture, OCR-reuse, cross-tab update, offline smoke, scanner settings/repair, photo transaction, Play, review and newspaper gates passed.
  • The fresh-runner live-acceptance job downloaded the already-built scanner-static-build, verified its build ID, and passed moving-video, backup/preferences/modal, diagnostics and real recovery checks in Chromium 153.0.8010.12 and WebKit 26.6.
  • The actual Pages configuration and deployment jobs were skipped, as required for this unmerged branch.

Tested PR integration: e3ce7527c95a313b8113890777626389cf307754, with parents master 0127cfda54ff48129df7dfcd130cb11d14946ddb and the final head above. Tested tree: b5af3511a7af36f738a7c04d426236b2b48dbb0f. Independent diagnostic exports identify the build as e3ce7527c95a.

No source changes were made after these successful checks.

Measured real-video results

Both Scanner quality and independent exact-artifact acceptance reproduce these outcomes:

Normal 27-clue recovery scene Chromium WebKit
Initially correct printed clues 26/27 27/27
Initial degraded-cell reading Unread, flagged 6, flagged
After automatic selected-cell recovery 27/27 27/27
Full reads / targeted reads 1 / 1 1 / 1
Initial full OCR calls / additional retry calls 60 / 3 60 / 3
Full samples / selected samples 54 / 2 54 / 2
Selected cell 52 only 52 only

Chromium genuinely recovers the missed printed 6. WebKit was already numerically correct but naturally uncertain, so no accuracy increase is claimed there. All other clues and every blank cell remain unchanged. The new proposal still requires review.

Paused playback hides captured clue metadata; resuming reuses the verified reading without another full read. In the changed-puzzle scenario, both browsers reject the retired targeted reply and perform exactly one new full read, correctly transcribing the modified 27-clue puzzle including the new 9.

The existing moving-video test still completes 22/22 clues in one initial read without movement-induced cancellation. Its initialization cancellation calls are not counted as movement failures. Existing still-image quality remains 777/778 correct printed clues in Chromium and 778/778 in WebKit, with no unflagged discrepancies.

Test repairs made during verification

Retained raw failures exposed assumptions in the test harness rather than a reason to weaken scanner safety. Controlled canvas-video probes now supply an explicit frame clock. Verified capture snapshots are copied in the same browser task that checks their availability. Late-detector tests observe all status mutations, including transient removed text, rather than requiring legitimate progress messages to stay identical.

The synthetic recovery and motion videos now start through a real click, matching the user-opened camera instead of relying on cold WebKit canvas-stream autoplay. Startup and playback state are recorded. An earlier independent failure had zero OCR calls and no started camera; it is preserved as a failed run, not relabelled as passing. Motion startup also cleans up its stream/timers and prevents late playback from restarting a stopped test.

All original stale-clue, changed-structure, image-privacy and manual-review assertions remain. No matcher threshold, OCR model, puzzle classification or native solver change was used to force a test to pass.

Raw evidence

Downloaded artifacts were SHA-256 verified:

  • Scanner quality recognition-report, artifact10608369836: 7b45532be0f96dce8aa3f774916b3305fc1879b8750fb7503db6abe0973cea78.
  • Scanner quality live-report, artifact10608484668: 8c44bd168d15a9bc669dbd436468aedefa9ee511b8840c7e0ba8fefabc3deede.
  • Full build browser-test-report, artifact10610025727: f39f8735b57276fd9edcc7d4b7e4d7a67ac2a166b045c1c99c8699b22917d214.
  • Independent deployed-live-acceptance, artifact10608739560: 4a73e8677861f0c54788d5229838217f75cd80ffaf73f348c21096b321feba32.

Reports retain before/after cells, natural uncertainty, selected targets, engine-call counts, scheduling data, changed-puzzle outcomes and browser screenshots. The original isolated worker/API tests are not represented as measurements of the complete camera pipeline; the new end-to-end tests provide that coverage. The earlier original-branch test count was 752, not 754.

Limits

These synthetic video fixtures are regression controls, not an arbitrary-photo accuracy estimate or physical-iPhone frame-rate, battery or memory benchmark. WebKit's already-correct reading is not counted as an accuracy gain. Strong blur can still fail identity verification instead of authorizing a guessed match. Recovered readings remain unconfirmed. User photographs were not published; temporary transfer/probe workflows are absent from the final tree.

See web/LIVE_REFINEMENT.md and web/LIVE_TRACKING.md. Keep this PR on the branch; no merge or deployment is requested.

senegrom and others added 30 commits September 19, 2026 13:22
…e transfer tooling

Add the new real-worker/real-OCR/privacy suite to existing scanner-quality and exact-built-artifact acceptance. All durable repository permissions remain read-only except existing master-only Pages jobs. No deployment or merge requested.

Final source tree 194b372 matches the locally tested implementation exactly. 746 JavaScript tests passed, seven focused runtime-build/motion-import tests passed, syntax and whitespace checks passed. The same full JavaScript suite also passed on the hosted source-transfer runner. Browser integration must now run through the PR gates.

Remove temporary read-only source snapshot and content-only delivery workflow; no encoded transfer files remain.
…stic previews

The existing controlled camera/solver probes advanced 12 simulated seconds while the new real tracking worker had only milliseconds to reply. Wait for the actual bounded worker queue to settle before each synthetic clock advance; keep every changed-digit, erased-clue, late-read and late-solver assertion. Real-time moving-video suites remain separate.

Bound video playback setup and record allowlisted diagnostics on motion-test failure. Diagnostic corners now declare input dimensions and coordinate space; manual photo crops and accepted targeted readings remain visible in exported evidence. A new scan or camera close also retires prepared exports and image consent.

747 full unit tests passed before the final additional diagnostic-retirement regression, which passes separately. Exact final source tree 6af1aca matches local source. Temporary content-transfer workflows removed. Branch only, no merge or deployment; integrated browser gates rerun on this head.
The moving-camera test exposed a liveness defect: after one displayed proof aged out, every camera tick advanced the display serial ahead of all delayed worker replies. Record the fresh fallback's timestamp while clearing every proof, so a subsequent timely worker reply can recover without removing serial or stale-frame fences. Keep diagnostics updated even for discarded worker replies.

A new regression fails on the preceding logic and passes with this correction, including rejection of queued replies after closing. Full local JavaScript suite: 749 passed, zero failed/skipped. Final tree faca192 matches local source. Browser checks must rerun; feature branch only, no master update or deployment.
…kening display identity

The real moving-video test now reads 22/22 in one job in both engines and passes covering/uncovering. WebKit exposed acquisition starvation on the subsequent changed board when gaps between async replies repeatedly cleared its observation count. Keep observations tied to the same original anchor through brief missing proofs; explicitly require current verification before starting any read. Changed content, settings, prolonged loss and Stop still reset ownership, and missing proof still hides every overlay and capture reading.

Add before/after regressions for brief proof gaps and rejection of unverified/prolonged-loss acquisition. Accepted targeted proposals also retain their sharper rectified source for manual review; empty retries cannot replace the original evidence.

Full local suite: 752 passed, zero failed/skipped. Exact tested tree 5a497dd. Final browser checks rerun on this head. Feature branch only; no merge or deployment.
Stage the exact locally tested retry-retention and frame-aware scheduling sources through a branch-scoped temporary apply job with per-file Git hash checks and a complete test run before its non-force push. The full local candidate passes 772 tests, zero failed or skipped. This transfer helper is removed before final acceptance; no master update or deployment.

New tests cover retry timeout/rejection retention, zero-OCR budget refunds, explicit exhaustion, late-result fencing, actual video-frame metadata, fallback clocks, load pacing, freshness heartbeat and stalled-camera detector replies.
…evidence

Drive production camera, detector, tracking worker and Tesseract from a real canvas MediaStream. Fixed cell-interior resampling in two fonts produces genuine uncertainty; a clear frame must trigger selective recovery, preserve other clues and blanks, remain review-gated and use less OCR work. Also test stalled playback and a changed puzzle while a real targeted reply is delayed.

Remove temporary source-application code after its hash-verified full 772-test pass and branch-only commit. Browser evidence on the new end-to-end case remains pending until this workflow completes. No merge or deployment.
…oling

Finish retry-failure retention, zero-OCR attempt refunds, exhausted-state feedback and frame-aware load-bounded scheduling with independent stalled-video expiry. Paused/ended video cannot claim freshness from advancing counters. Local complete suite: 774 tests passed; seven focused Python tests passed. Uploaded tree exactly matches the locally validated tree.

Add the production degraded-to-clear camera test to both Scanner quality and exact-artifact deployment acceptance. Use a fixed Courier New resampling case whose Chromium full-camera read genuinely misses a printed 6; do not inject OCR flags, values, quality, corners or matching proofs. The Times probe already reads confidently in WebKit and is not used to manufacture uncertainty. Browser processes are fresh per scene to avoid the measured WebKit stopped-canvas-stream restart limitation. A late real retry on a changed puzzle remains a required negative control.

Remove the temporary source/probe/apply workflows and scripts. No content-identity thresholds, OCR models, native solver or master changes. Keep PR66 a branch-only draft; final browser results must be read from this head's acceptance workflows.
…he late-retry witness

The older controlled camera probes use canvases, not video elements. Supply their explicitly advancing source clock instead of treating missing frame metadata as fresh video. Wait one maximum bounded processing interval before checking changed pixels; all old clue/structure/storage assertions remain. Production code and identity thresholds are unchanged.

The real MediaStream recovery race now waits until changed pixels actually reached the preview and content ownership was retired before releasing a delayed real OCR reply. Require exactly one new full read and no commit of the retired retry. Run the genuine recovery suite first in Scanner quality so later unrelated tests cannot hide its measurements.

Local serial suite: all 774 tests pass. A concurrent run reproduced the existing undici Response.clone cache-fixture flake; no baseline fixture or production code was altered to hide it. Uploaded tree a7a3d42 matches local sources exactly. Final hosted acceptance pending. Branch only.
… next frame

The independent exact-artifact acceptance caught two test time-of-check/time-of-use races: a predicate observed a verified overlay, then a later browser call found that the next frame was safely hidden. Preserve the app's fail-closed freshness rules. Return the capture snapshot from the same browser task that checks it, and release temporary image copies/JS handles. Apply the same pattern to the new genuine-recovery test.

No production code, identity thresholds, deadlines, expected clues, review flags or negative stale-result assertions changed. The preceding source passed all 774 Node tests, CI, complete Scanner quality including real degraded recovery in both engines, and the full build's native/browser/offline/Play suites. Independent acceptance exposed the separate stale test-snapshot race; its raw failure report is retained rather than masked by a blind rerun.

Uploaded tree cb840dc matches the local syntax-checked source. Final workflows rerun on this head. Branch only; no merge or deployment.
The repeated hosted WebKit failure occurred before camera.start(): canvas-stream playback did not begin, with no OCR or tracking invoked. Retain those failed reports. Open the test's actual video through a real Playwright click, matching the application's user-opened camera rather than relying on cold-stream autoplay. Record playback state in the raw report. No recognition values, uncertainty, geometry, identity checks, acceptance assertions or production code change.

Syntax and whitespace checks pass; expected test blob bb164e2. The preceding production-identical code passes all 774 Node tests, CI, recognition quality and both real Chromium recovery scenarios plus WebKit's changed-puzzle scenario. Final full acceptance must rerun, not inherit those partial results. Keep PR66 on its branch; no merge or deployment.
…ress

The full build's WebKit run failed because a legitimate asynchronous status advanced from unread-clue guidance to clearer-frame guidance between two Playwright calls. Replace equality across those calls with an observation window that checks every status mutation, including removed nodes and old character data, for the obsolete detector error. Keep camera visibility, live-track, recovery-call and all recognition/review assertions unchanged.

Production code is unchanged. The preceding head's complete Scanner quality run 35472629423 passed the real recovery and changed-puzzle cases, moving video, native-solver/capture, backups and diagnostics in both engines. The separate build failure is preserved in its raw artifact, not reported as a passing run. New source passes local syntax checking; expected blob 4c04157. Final full acceptance reruns on this commit. Branch only; no merge or deployment.
senegrom and others added 3 commits September 20, 2026 18:09
Independent acceptance run35524059657 failed before the WebKit camera began: its synthetic video never played (zero reads, zero cancellations, no tracking). Use a real Start click for this older motion fixture, matching the production camera and the already-passing recovery fixture, instead of depending on cold canvas-stream autoplay. Record playback state and clean up the stream and timer on success or failure. All original moving OCR, occlusion, changed-clue and external-image assertions remain unchanged.

Production code, OCR data, timing limits and identity thresholds are unchanged. Local script syntax passes; blob21c44d0808f50751273aac3d158f291d0a753892. The preceding head passed all774 JavaScript tests, CI, Scanner quality and the full native/browser build gates; its failed independent playback report is retained. This head reruns full acceptance rather than claiming that prior green checks cover the repair. Branch only; no merge or deployment.
It archived this branch's tree as an artifact for transfer between agents,
triggered only by pushes to this branch name. It has done its job and has
no meaning on master. Without it the tree is exactly the one the pull
request describes as tested (65b9328 on master 0127cfd, tree b5af351).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FHZVC6KGcurYV8iu4MjrE8
@senegrom
senegrom marked this pull request as ready for review September 21, 2026 09:07
@senegrom
senegrom merged commit fc99ab1 into master Sep 21, 2026
11 of 12 checks passed
@senegrom
senegrom deleted the improve/live-worker-recovery-diagnostics-20260919 branch September 21, 2026 09:07
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