Skip to content

engine: project statement checkpoints onto GET /build - #21

Merged
Code4me2 merged 2 commits into
mainfrom
cursor/project-build-checkpoints-05be
Aug 31, 2026
Merged

Code4me2 merged 2 commits into
mainfrom
cursor/project-build-checkpoints-05be

Conversation

@Code4me2

Copy link
Copy Markdown
Member

Fixes #15. Parent #4 remains open.

Why

After #6 the web Timeline was last-good vs failed only. The incremental executor already records per-statement checkpoints inside the worker (index, span, bound names). Those stops were dropped when assembling the §8 BuildResult, so GET /parts/{part}/build could not name them. INTERFACE.md §0.1: if the engine does not say it, do not paint it.

Engine

  • StatementCheckpoint is a first-class §8 field (BuildResult.checkpoints). Old records read back as [].
  • The worker now also records line and the verbatim statement text, so a Timeline can name a stop without slicing the script.
  • assemble_build persists the worker list. Publication mints at most one checkpoint blob — the last-good BRep of a failed build — and attaches that ref to the matching stop. Intermediate stops carry artifact_ref: null (mission rule 4: no invented per-statement BRep).
  • GET /parts/{part}/build projects checkpoints[].
  • A first-fail part (no current successful build) now serves the last-failure record instead of not_built. A later success still wins, so G4.2 geometry_count stays a fact about the current build.

Web

marksFromBuild emits one mark per projected checkpoint. A checkpoint whose artifact_ref is the error's last-good ref is the rewindable last-good stop. The scrubber still only holds that minted ref; it does not invent statement events from the script text.

Out of scope

Appearance, tree, export, composer, CLI verbs, install docs, laser CAM, scan import. Smith/Arche in prose only. Does not close #4.

Tests

  • Core: schema + round-trip, golden build checkpoints on the §8 record, failed-build last-good attach.
  • HTTP: successful GET /build carries checkpoints; first-fail serves last-failure; current wins over a later failure.
  • Web: Timeline marks come from the projection; successful builds do not invent a rewind scrubber.
Open in Web Open in Cursor 

@Code4me2 Code4me2 left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MERGE

Adversarial review of engine: project statement checkpoints onto GET /build (140082e vs main). Issue #15. Did not merge. No fix pushed — nothing in this PR's scope is merge-blocking.

Checkpoints actually land on GET /build

The worker list is no longer dropped at assemble. StatementCheckpoint is a first-class §8 field (BuildResult.checkpoints), assemble_build persists the worker stops, and build_projection always emits checkpoints[] (named [] on pre-field records and on not_built). GET /parts/{part}/build reads current, then last-failure when there is no current. HTTP tests: successful projection, first-fail serves the failed record, later success still wins.

The Timeline does not invent a statement list from script text. marksFromBuild walks build.checkpoints and only then the positions the error / current artifact already named.

Last-good facts are real

Publication still mints at most one checkpoint blob — the failed-build last-good BRep. Intermediate stops stay artifact_ref: null. The runner attaches that minted ref to the stop whose line is error.built_through.line (else the last completed stop). The web last-good kind is checkpoint.artifact_ref === error.last_good_artifact_ref; rewind is still hold of that ref. Successful builds do not grow a rewind scrubber.

_LastGood.update sets statement on every completed statement, so last-good is the last checkpoint under the current worker. The first-line-match join equals checkpoints[-1] except for the rare two-top-level-statements-on-one-line case. The blob is not invented either way.

Old records without checkpoints[] still project last-good vs failed from the error object. That is a join of an existing field, not a client-side event.

No web chrome drive-by

Web edits stay on the Timeline surface (marks helper, Timeline.tsx, Timeline CSS, copy, types, fixtures, tests). Tree, Results, viewport, composer, appearance, export are untouched. The horizontal → column marks list is the existing panel growing engine stops, not a restyle of other chrome.

G4 / G5 not weakened

  • G4.2: geometry_count is still len(BuildResult.geometries), explicit on the projection. Current still wins over a later failure (tested). The G4 e2e still reads /parts/tread/build on a successful current. First-fail failed records have empty geometries (worker returns before the index), so row count stays 0 = 0. Properties still read current_build only (G4.3).
  • G5: no mutation, Monaco, slider, selection, A/B provenance, or idempotency change.

Non-blocking

  1. http/context.py still does build_projection(runtime.cad.current_build(part)) after block.read("/parts/{part}/build"). A first-fail part now has checkpoints on the route and "no current build" in the composer context. Context's sentence is still true; the claimed route identity is not. Mission rule 6, not a gate break. Follow-up if context goldens are expected to mirror GET.
  2. Attach-by-first-matching-line is a weaker join key than "last completed statement" / built_through.statement. Fine for one statement per line (the CAD corpus). Not a false blob.
  3. checkpoints is optional on the §8 schema (required unchanged, additionalProperties: false still holds). Honest for old records.

Verdict: MERGE. #15 is met; last-good is a minted ref; G4.2 current-wins is intact; chrome stay on Timeline.

@Code4me2
Code4me2 marked this pull request as ready for review August 31, 2026 02:27
cursoragent and others added 2 commits August 31, 2026 02:28
Persist the incremental executor's per-statement checkpoints on the
§8 BuildResult and serve them from GET /parts/{part}/build so the
Timeline can grow stops from the engine projection instead of last-good
vs failed only.

A first-fail part now projects the last-failure record (not a not_built
silence). Current successful builds still win, so G4.2 geometry_count
is unchanged. Intermediate checkpoints carry no invented artifact refs;
only the last-good stop of a failed build is minted.

Co-authored-by: Vel <Code4me2@users.noreply.github.com>
The lint+type job failed on list[Unknown] after reading checkpoints
off the HTTP body. Cast the projection to list[dict] like the other
server tests.

Co-authored-by: Vel <Code4me2@users.noreply.github.com>
@cursor
cursor Bot force-pushed the cursor/project-build-checkpoints-05be branch from 140082e to 16efec5 Compare August 31, 2026 02:28
@Code4me2
Code4me2 merged commit 3e5a9f1 into main Aug 31, 2026
18 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.

engine: project statement checkpoints onto GET /build for Timeline web: Smith-class operator session (simple UI, CLI is the agent core)

2 participants