Skip to content

Workbench: instant checks, opt-in auto-check, job progress, keyboard palette and offline guidance - #16

Merged
4waan merged 37 commits into
mainfrom
feat/web-live-automation
Nov 11, 2026
Merged

4waan merged 37 commits into
mainfrom
feat/web-live-automation

Conversation

@4waan

@4waan 4waan commented Nov 11, 2026

Copy link
Copy Markdown
Owner

Stacked on #15 (feat/web-workspace-productivity); review and merge that one first.

Summary

The workbench now responds while you edit instead of only after a Lean job returns. Browser diagnostics appear right away under the label Preview (not yet checked by Lean), and the Lean evidence replaces them when it arrives. An opt-in auto-check submits a check 1.2 s after editing stops, and it works with the service's small queue: it backs off on 429, supersedes its own unfinished check, and never runs on invalid inputs. Running jobs show elapsed time, an estimate and the service budget, and signal when they finish. Keyboard users get Ctrl/Cmd+Enter, Esc, a ? shortcuts dialog and a Ctrl/Cmd+K command palette. When the service is offline, a card shows npm start with a copy button and reconnects automatically. A width selector exposes the experimental 3×3 and 2×2 AES-like designs that validateDesign already accepts.

This branch builds on feat/web-workspace-productivity. After review it also guarantees one status line and one Stop button per running job, Escape that closes popovers before stopping anything and stops the job the view shows, visible errors for runs that end without a report, no Checked by Lean or Up to date for runs that did not finish, and announcements that are read on every view.

What is changed

Nothing new is proved: this is a web-workbench change. No Lean or engine code changes. The only service change: a 400 invalid-request response now also sets error.path to the first validation issue's JSON Pointer (the schema's JobError.path already allowed it, and the message text is unchanged).

  • Instant browser diagnostics (components/LiveChecks.tsx, components/ResultsPanel.tsx)
    • A strip under the run buttons shows the lib/preview.ts results for the inputs in the editor, debounced by 150 ms: MDS witness, distinct offsets, S-box collisions, power-map gcd and circuit coefficient equivalence.
    • Each item has a dashed preview outline, the text Preview (not yet checked by Lean), and never a proof status.
    • The result area shows the same cards before the first check, while a check runs, and above results from an earlier version.
    • A Lean report for exactly these inputs (matched by digest) replaces the preview item by item, and the strip then reads Checked by Lean, but only for a run that ran to the end. For a run that timed out, failed or was stopped (by the run state, or by the report's own execution.state for a recorded or cached report), only the claims Lean decided replace their previews and the strip names how the run ended.
  • Auto-check (lib/autocheck.ts, state/actions.ts)
    • Off by default; the setting is saved in cryptificate.prefs.v1.
    • It is a pure decision function plus a debounced driver. It runs 1.2 s after the last edit and keeps at least 2.5 s between submissions.
    • It does not run while the inputs have problems, outside the workspace, while connecting, or while an experiment runs, so native timing is not disturbed.
    • It waits for room in the queue: one running job plus limits.maxQueued, less this page's own live jobs.
    • It never cancels a check the user started. It stops its own unfinished check of earlier inputs (POST /api/jobs/:id/stop) before submitting the next one.
    • Late results for superseded inputs are shown as from an earlier version.
    • Its status never reads Up to date unless a check of exactly these inputs ran to the end: a replay or offline look-up with no matching recording says so, and a recorded or cached report of a run that did not finish counts as not finished.
    • The Check button and Ctrl/Cmd+Enter also supersede a running check of earlier inputs.
  • Busy service (lib/retry.ts, data/api.ts)
    • ApiError carries Retry-After.
    • On 429 a run enters a retrying state and resubmits after Retry-After, or after 2/4/8/16/32 s when the header is missing (capped at 60 s): six submissions in all, the first and five retries. The error text, the progress line (attempt n of 6) and the README all count submissions this way (BUSY_MAX_ATTEMPTS).
    • The progress line shows a countdown with Retry now and Stop.
    • When a run is stopped while its request is still in flight, the job that request creates is stopped as well.
    • Running out of attempts is reported as an execution failure.
    • A request the service refuses with 400 invalid-request ends as invalid input with the service's message and the JSON Pointer of the first problem, read from error.path (or from errors[0].path for a service without the change above); the pointer prefix the service puts in the message is shown once, beside it. An unreachable service ends as a failure saying so.
  • Job progress and completion (components/RunProgress.tsx, lib/progress.ts, lib/signals.ts, state/signals.ts)
    • Shows elapsed time, the running step's own time, and an estimate from the median of recent local durations (cryptificate.timings.v1; cached results are excluded). An estimate bar appears when there is history.
    • Shows the service budget: analysisBudgetSeconds, or the profile's totalSeconds. The Experiments profile buttons show the budget too.
    • Elapsed time stops updating while native code is being timed.
    • The tab title shows ◌ Running during a run, and ✓ Done or how the run ended (✕ Failed, ✕ Timed out, ✕ Stopped, ✕ Rejected) if it ends while the page is in the background.
    • Each running job has one status line (the screen-reader live region) and one Stop button, in the run bar (beside the step's button in the story). The progress panel in the result area shows only the estimate bar, the steps and the busy-retry explanation (RunDetails), and says where Stop is. In the workspace the run bar shows the running job's status and Stop beside any input problems, because the inputs can be edited while a job runs. The story's run areas are not live regions, so the ticking step times are not announced.
    • A check or experiment that ends without a report (busy service, unreachable service, rejected request, stopped before the service took it) shows the error in the execution banner and says nothing was checked; the workspace run bar keeps its status with a link to that explanation, while that job is the most recent of the workspace's check and experiment and the inputs in the editor are the ones it was given. Such a run shows no duration.
    • Alerts offers an optional desktop notification, enabled by a click that requests permission, and an optional short tone. Both are off by default. Auto-checks only mark the title.
  • Keyboard-first (lib/shortcuts.ts, lib/commands.ts, components/Overlays.tsx, App.tsx)
    • Ctrl/Cmd+Enter checks, also from inside a field. Ctrl/Cmd+Shift+Enter runs a quick experiment.
    • Esc stops the running job the current view shows (the experiment on Experiments, the check in the workspace, the story's own runs in the story), else another running job, and announces which. With a dialog or the Alerts popover open, Esc closes it and stops nothing. ? opens the shortcuts dialog. Neither fires while focus is in a text field.
    • Announcements (for example Stopping the experiment.) come from one polite live region mounted by App, so they are read on every view.
    • Ctrl/Cmd+K opens a command palette with views and story steps, every preset, run/stop, auto-check, theme, JSON export, share link, evidence bundle, and undo/redo. A command that cannot run says why. The Stop command names the job it stops, chosen as for Esc.
    • Palette matching: word starts first, then label substrings of two letters or more, then group/keyword word starts or substrings of three letters or more; letters in order within one label word only when nothing else matches. A single letter matches word starts only.
    • Both dialogs are native modal <dialog>s, and the palette follows the ARIA combobox/listbox pattern.
    • A footer link opens the shortcuts dialog.
  • Offline state (components/ServiceCard.tsx)
    • The workspace and experiments show a card, headed The local service is not answering, with npm start (and a copy button) and npx cryptificate serve. Its Try now is the only retry control while it is shown.
    • The page reconnects automatically after 3, 5 and 10 s, then every 15 s, with a countdown and Try now.
  • Width selector (lib/width.ts, components/DesignEditor.tsx)
    • A roving-tabindex radio group offers 4×4, 3×3 experimental and 2×2 experimental.
    • Changing the width loads an MDS circulant for that width (circ(02,01,01) or circ(02,03), both checked by a test), offsets 0..w−1, and a term-by-term circuit. The change is one undo step.
    • Requests carry "experimental": true. The hints say that the activity bound is not established by this method at widths 2 and 3, and the offset hint names the actual width.
  • Docs: apps/web/README.md (a new Checking as you edit section, plus updated accessibility shortcuts) and README.md.

Screenshots

Taken with Playwright against vite preview of the production build, with the API mocked in the test script (capabilities, a long-running job, a job that times out with a partial report, a 422 rejection, the service's real 400 invalid-request body, an aborted connection, and an unreachable service). Light and dark at 1440 px and 390 px for each review-fix state; the script also counted Stop buttons (one per running job on Experiments, Workspace, Workspace with an input problem, and story step 1, at every size), checked for horizontal overflow (none) and read the announcement after Esc on Experiments (Stopping the experiment.).

  • screens/web-automation-final/esc-stopped-experiments-1440-light.png
  • screens/web-automation-final/experiments-rejected-1440-dark.png
  • screens/web-automation-final/experiments-rejected-1440-light.png
  • screens/web-automation-final/experiments-rejected-390-dark.png
  • screens/web-automation-final/experiments-rejected-390-light.png
  • screens/web-automation-final/experiments-running-1440-dark.png
  • screens/web-automation-final/experiments-running-1440-light.png
  • screens/web-automation-final/experiments-running-390-dark.png
  • screens/web-automation-final/experiments-running-390-light.png
  • screens/web-automation-final/offline-card-1440-dark.png
  • screens/web-automation-final/offline-card-1440-light.png
  • screens/web-automation-final/offline-card-390-dark.png
  • screens/web-automation-final/offline-card-390-light.png
  • screens/web-automation-final/palette-e-1440-dark.png
  • screens/web-automation-final/palette-e-1440-light.png
  • screens/web-automation-final/palette-e-390-dark.png
  • screens/web-automation-final/palette-e-390-light.png
  • screens/web-automation-final/story-step1-running-1440-light.png
  • screens/web-automation-final/story-step1-running-390-dark.png
  • screens/web-automation-final/timeout-strip-1440-dark.png
  • screens/web-automation-final/timeout-strip-1440-light.png
  • screens/web-automation-final/timeout-strip-390-dark.png
  • screens/web-automation-final/timeout-strip-390-light.png
  • screens/web-automation-final/workspace-experiment-rejected-1440-dark.png
  • screens/web-automation-final/workspace-experiment-rejected-1440-light.png
  • screens/web-automation-final/workspace-experiment-rejected-390-dark.png
  • screens/web-automation-final/workspace-experiment-rejected-390-light.png
  • screens/web-automation-final/workspace-experiment-unreachable-1440-dark.png
  • screens/web-automation-final/workspace-running-problem-1440-light.png, -1440-dark, -390-light, -390-dark (a running check after a matrix cell was made invalid: the problem count, the status and one Stop)
  • screens/web-automation-final/workspace-failed-then-checked-1440-light.png, -390-dark (an experiment that failed on an unreachable service, then a completed check: the run bar no longer shows the failure)
  • screens/web-automation-final/workspace-analysis-rejected-1440-light.png, -1440-dark, -390-light, -390-dark (a check rejected with the real 400 body: message and /design/rounds shown once)
  • screens/web-automation-final/workspace-running-results-1440-dark.png
  • screens/web-automation-final/workspace-running-results-1440-light.png
  • screens/web-automation-final/workspace-running-results-390-dark.png
  • screens/web-automation-final/workspace-running-results-390-light.png
  • screens/web-automation-final/workspace-running-top-1440-dark.png
  • screens/web-automation-final/workspace-running-top-1440-light.png
  • screens/web-automation-final/workspace-running-top-390-dark.png
  • screens/web-automation-final/workspace-running-top-390-light.png

The screenshots of the first version are in screens/web-automation/.

Tests run

  • npm run build && npm test at the worktree root (all workspaces): build passes; schema 14/14 pass; server 42 pass, 0 fail, 5 skipped (the skipped tests need a Lean toolchain); web 37 test files, 520 tests pass.
  • New vitest coverage:
    • lib/retry.test.ts: Retry-After parsing, backoff, queue room.
    • lib/autocheck.test.ts:
      • the decision table;
      • the driver with fake timers: debounce, invalid inputs, supersede-then-start, minimum interval, switching off, reporting only changes.
    • lib/progress.test.ts, lib/prefs.test.ts, lib/commands.test.ts and lib/signals.test.ts.
    • lib/shortcuts.test.ts: appShortcut and isTextField.
    • lib/width.test.ts: every width gives a valid design with an MDS preview and an equivalent circuit, plus the experimental flag.
    • state/runs.test.ts, with a mocked API:
      • a 429 waits for Retry-After and then resubmits;
      • the run gives up after the last attempt;
      • Stop and Retry now while waiting;
      • stop a job created by an in-flight request;
      • Check supersedes a check of earlier inputs;
      • the auto-check view and queue room.
    • Render tests:
      • LiveChecks/ResultsPanel: the preview label, no proof status classes, replacement by the Lean report, and stale ordering;
      • RunProgress: elapsed time, estimate, budget, retry countdown;
      • ServiceCard;
      • palette commands and disabled reasons;
      • the width selector markup.
  • Review-fix coverage:
    • views/RunControls.test.tsx: exactly one Stop button and one status line for a running job on Experiments and in the workspace (both counted 2 before the fix), also while the inputs have a problem (0 before); story step 1 has one Stop button and no live region other than the status line; the workspace run bar keeps a job that ended without a report and links to the explanation, but not once a later job reported or the inputs changed; nothing is kept after a completed job.
    • App.test.tsx: one announcement region on every view.
    • RunProgress.test.tsx: RunDetails has no live region and no buttons and renders nothing once the run ended; no duration for a run the service never accepted.
    • LiveChecks.test.tsx: no Checked by Lean for a timed-out, failed or stopped run, including a completed fetch of a report whose execution timed out.
    • data/api.test.ts: a 400 body exactly as apps/server sends it gives the message, code and path; the path falls back to errors[0].path; a message without a path is kept.
    • apps/server/test/http.test.ts: the 400 body's error.path equals the first issue's path and the message keeps its path: message form.
    • state/runs.test.ts: Esc/Stop target per view, a 400 invalid-request ends as invalid with its path, an unreachable service ends as a failure, auto-check never reads Up to date for an unmatched look-up or an unfinished recorded run.
    • lib/commands.test.ts: one-letter queries match word starts only; letters in order only within one word and only as a last resort.
    • ServiceCard.test.tsx, Overlays.test.tsx, signals.test.ts: offline heading, Stop label, tab-title marks.
  • Manual check in the browser with Playwright: Esc stops a running check, and the tab title shows ◌ Running during a check. There is no horizontal scroll at 390 px on the workspace, the experiments view, the story, or the 2×2 workspace.

Scope and limits

  • The preview is computed in the browser and is never presented as a proof. Only a Lean report for the same input digest replaces it. Rust refinement, native correctness and timing are never previewed.
  • The service has no endpoint to list or cancel queued jobs from other clients. Queue awareness counts only this page's jobs, so a 429 can still happen and is handled by retrying.
  • Elapsed times and estimates are measured on the client and include polling latency. The estimate uses only durations from this browser.
  • Desktop notifications depend on browser permission. Some browsers allow them only from a service worker, and the page then falls back to the title mark.
  • Widths 3 and 2 rely on the existing experimental schema support. The engine and Lean path for those widths were not exercised end to end here, because no live service with Lean was available in this environment. Every live screenshot uses a mocked API.
  • Auto-check only automates analyses, never experiments.
  • When the current view shows no running job, Esc and the palette's Stop act on another running job (and name it). This fallback is deliberate; a stricter rule would leave Esc doing nothing on Experiments while a check runs.
  • The workspace run bar keeps only runs that ended without a report; a completed run's status is not kept there (its results are in the result area and the strip), so the screen-reader region announces the end of failed, timed-out, stopped and rejected runs but not of completed ones.

Generated by Claude Code

…d completion signals

Runs record when they start and end; a 429 puts the run in a retrying
state that resubmits after Retry-After (or a doubling wait) up to five
times, and Stop cancels it. Check supersedes a running check of earlier
inputs. Auto-check is a pure decision plus a debounced driver: it waits
1.2 s after the last edit, never runs on invalid inputs or during an
experiment, respects the service queue and stops a superseded auto-check
before submitting the next. Settings and recent durations are saved in
this browser.
… not checked

The result area shows the lib/preview.ts diagnostics for the inputs in
the editor before any run, while a check runs and above results from an
earlier version, under 'Preview (not yet checked by Lean)'. A Lean result
for exactly these inputs replaces it.
The popover focused its first input, which is disabled when notifications
are blocked, so focus stayed outside it and the window handler read Escape
as Stop. The popover is now an overlay in the store, focuses the first
enabled control, closes on Escape from the button or panel and on tabbing
out, and the window key handler (moved to state/keys.ts) leaves Escape to
any open overlay.
On Experiments it stops the experiment before any check, in the story the
story's runs; the announcement and the palette command name the job.
The error, the progress line and the README now all count attempts in
all (six: the first and five retries).
A busy service that never took the run, an unreachable service, a rejected
request or a stop before the job started now show their error (with the
path the service named) in the execution banner, say that nothing was
checked, and keep the instant preview below with a Check again button.
The progress line keeps only errors of runs still under way.
… by Lean'

Only a completed run labels the strip 'Checked by Lean'. After a time-out,
failure or stop the strip names that outcome, shows Lean's status only for
claims it decided, and keeps the preview for claims left not established
because the run ended.
…eck matched

A look-up that found no recording (replay, or the service offline) now
reads 'No recorded check for these inputs; start the service to check
them.'
The card says which results are recorded Lean runs and which are an
unchecked browser preview. The header badge drops its Retry wherever the
card shows its own Try now, and uses the same label in the story.
… last resort

Typing 'stop' no longer lists the story steps and a preset under the Stop
command: a letters-in-order match must stay inside one label word that
starts with the same letter, and is offered only when nothing matches
better.
A failure, a time-out or a rejected input is not something the user
stopped: the title now reads ✕ Failed, ✕ Timed out, ✕ Stopped or
✕ Rejected, and the Alerts popover and README say so.
The Experiments view showed the running experiment twice, compact in the
action bar and in full in the panel below, each with its own live status
region and Stop button; the workspace result area and the first story
step did the same for their runs. The compact RunProgress beside the run
buttons is now the single status region and Stop control, and the panels
use RunDetails, which shows the progress bar, the steps and the busy-retry
explanation with no live region and no buttons.
The polite announcement region lived in the workspace view, so 'Stopping
the experiment.' after Escape on Experiments, and other announcements made
outside the workspace, were never read out. It is now mounted once by App.
A quick experiment started from the workspace that failed before any
report (busy service, unreachable service, rejected request) left no trace
in the workspace. The run bar now keeps the status of the latest check or
experiment that ended without a report, in the same live region that
showed it running, with a link to Experiments or Jump to results.
A recorded or cached report of a timed-out or failed run, fetched by a run
that itself completed, made the strip read 'Checked by Lean'. The strip
now takes the outcome from the report's execution state when it has one.
The auto-check status read 'Up to date.' whenever the latest check of these
inputs had completed, including a completed fetch of a recorded or cached
report whose own execution timed out or failed. Such a check now counts as
not finished, as in the instant-checks strip.
The page can only observe that the service does not answer (it may be
starting, or listening elsewhere), not that it is not running.
Typing a single letter matched every command whose label, group or
keywords contained it anywhere. One letter now matches only the start of
a word; label substrings need two letters and keyword substrings three.
The run bar holding the Stop button is at the top of the workspace, well
above the result area; the panel's caption now says so.
A refused or unreachable submission read 'took 0.0 s' next to Failed. A
run that ended without a job id did no work and now shows no duration.
@4waan
4waan changed the base branch from feat/web-workspace-productivity to main November 11, 2026 19:30
@4waan
4waan merged commit c9c5ec3 into main Nov 11, 2026
10 checks passed
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.

2 participants