Repository navigation
Phase 2: progress contract, plugin manifest and progress table - #2330
neuromechanist merged 24 commits into
Conversation
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR2330Version: 🤖 Updated on each push. |
|
Review converged: round 1 by a three-reviewer panel (code+types, tests+errors+comments, Opus xhigh on the route, write path, migration and metadata.json access), round 2 Opus xhigh delta; every finding fixed or decided, final fix verified by the driver (5cfa3f8, 6d191fb). The diff-caused CI failures (schema_version expectations, the compute-switch reader rule, metadata snapshots) are fixed in 6d191fb. The remaining red is unit-pure shard 1, which fails on Miniflare D1 itself (a hang to timeout, then a migration assertion in an unnamed hook on rerun), also seen on dev; filed as #2332. Merging into the epic branch per the phase-to-epic gate (targeted tests pass); full green CI is required at epic to dev. |
3d17fab
into
feature/issue-2324-epic-pipeline-progress
Summary
Phase 2 of ADR 0134: live progress of NEMAR's pipeline runs, the plugin manifest contract, and the tables that hold progress and the neuroschema documents built from it.
roots: {dataset, record}) and validation of any bundled schema by itsnsc:/id;NEUROSCHEMA_VERSIONis 0.5.0. The liveschema_versionchecks also accept 0.4.x until the backend serving 0.5.0 is deployed (NEUROSCHEMA_TRANSITION_LINES; empty it after the deploy).nemar.progress.v1(shared/contract/compute-progress.tsand.schema.json): closed, counts per checkpoint in the shape of neuroschemacheckpointCounts, at most 10 failures, at most 8192 bytes. The heartbeat request gains an optionalprogress(the runner schema refers to the progress schema by$id).nemar.plugin-manifest.v1(shared/contract/plugin-manifest.tsand.schema.json): closed; a declared metric plus a value and the plugin is a valid neuroschemaqualityMetric; a time-series figure is PNG or WebP only.nemar-floor,nemar-ica), withdeclaredCheckpoints,checkpointOfStep,recipeCheckpointMap.shared/compute-checkpoints.ts: the counting rules (table reader, per-recording outcomes, counts, failures),progressProblem,liveDisagrees,pipelineRunStatus(stalledworked out on read), and the builders of theprocessingandsignalJourneyentries.shared/contract/compute-progress-vectors.jsonholds vectors nemar-process replays in Phase 3.compute_pipeline_progress_runs,compute_pipeline_progress,compute_pipeline_documents.POST /compute/jobs/:id/progress(job token, no session) for NEMAR pipeline jobs on Tapis; the runner heartbeat stores progress after the lease renewal, never at its cost. Both go through one guarded batch (recordProgress): the first statement holds the job state, the rate floor and not-yet-reconciled; every later statement is gated on its randomwrite_id.report_too_soon(429,Retry-After: 60);report_too_soonandstorage_unavailableare now route sentences (the latter declared once, the submit table inherits it).syncPipelineStamps(reconcilePipelineProgress, 10 runs and 10storedrows per call): counts from the uploaded recordings table, disagreement with the live counts recorded,storedresolved from the derivative store,processingandsignalJourneydocuments written.SyncResultgainsreconciled,reconcile_later,reconcile_errored./<id>/metadata.jsonserves the final dataset-levelextensions.processingandextensions.signalJourneyentries, and anin_progresslink worked out on read for a reporting run, behind the existing public gate and never for a concealed deposit.stalledis derived on read and reconciliation rides the stamp sync.No compute switch is added or changed; no cron is added.
Owner answers (2026-11-22)
submitted,queued,running; refusesarchiving,unreported, terminal and tenant jobs; 429report_too_soonwith a 50 s floor against the 60 s launcher cadence.1.0.0-b1, and the vectors were regenerated withNEMAR_WRITE_PROGRESS_VECTORS=1.processingandsignalJourneyentries are served now in/<id>/metadata.jsonunderextensions, through that route's existing access rules. Record-level documents stay deferred.storedis resolved from the derivative store.not_run), failure entries carry their checkpoint, ASCII paths up to 256, at most 10 failures,unreportedshows as stalled: as recommended.Closes #2325
Part of epic #2324
Test plan
bun run typecheck,bun run lint, Biome on every touched file (43 files, clean)bun run migrations:d1-check: all migrations applied on real D1, catalog matches bun:sqlitereconciled_at IS NULLfrom the gate fails the reconciled-run test; dropping the stamp order on documents fails the older-stamp test; dropping the concealed-deposit check fails its testbun test(epic todevgate)test/contract-live.test.tsandtest/data-route.test.tsagainst the deployed dev backend, which serves 0.4.1 until this deploys (the transition line keeps them green)Follow-ups
NEUROSCHEMA_TRANSITION_LINESonce the backend serving 0.5.0 is deployed./<id>/page-bundle.jsonbuilds the same metadata with its own read and does not yet carry the pipeline extensions: page-bundle.json does not carry the pipeline extensions #2331.compute-progress.schema.json,plugin-manifest.schema.jsonand the vectors; validate progress before attaching it to a heartbeat and retry without it oninvalid_body.Review round 1
Merged
origin/feature/issue-2324-epic-pipeline-progress(with #2329) into this branch; no rebase.compute_pipeline_progress_runsis not unique;RECONCILE_CANDIDATES_SQLskips atuple_mismatchhold stamp whose job belongs to another stamp (HOLD_STAMP_WORD, held equal toTUPLE_MISMATCH_WORD);stampForJobreads only the dispatched stamp. Test: a tuple-mismatch sync ends withreconcile_errored0, the hold stamp has no run row, and the run behind it is reconciled.compute_pipeline_documentsholds only final entries (nofinalcolumn);/<id>/metadata.jsonworks outin_progressfrom a dispatched stamp and its unreconciled run row (liveSignalJourneyLinks). Every outcome writes a final result: completed link when buildable, a finalfailedlink for a failed stamp and for every outcome without counts, and a succeeded run whose link cannot be built keeps the previous final link (link_not_written reason=record_unlinkable). Tests: both reviewer repro cases, and "a new run's live report does not erase the last completed link".recipe_versionanddeclaredat reconcile;resolveStoredresolves from them, each item in its own try/catch; a row that cannot make an entry is resolved without a document (processing_not_written reason=<word>);processingDatasetEntryreturns null on a missing column. Tests: stamp version moved after reconcile, a missing middle row, limit 1 with a bad row ahead of a good one.pipelineRunStatustakesPipelineStampStateandComputeState; stalled only forsubmitted,queued,running(andunreported);archivingis running; a terminal job on a dispatched stamp is finished or failed;PIPELINE_STALLED_SQLgains the stamp-state precondition. Table tests both sides.recordcounts against the last declared checkpoint (RECORD_STEP); step-less faults keep the first-checkpoint rule; vectors gainrecordrows.pipelineDispatchLogLinereportssynced_reconcile_laterandsynced_reconcile_errored(errored is level error);reconcile_later stamp=<id> reason=results_unbound|read_failed; the skipped failed-run processing entry is logged;reconciledcounts only when the gate'smeta.changesis 1 (race test).runningand the phase is the only difference; the cap test sends schema-valid bodies padded insideprogressto exactly 16,384 bytes (accepted) and 16,385 (refused).no_checkpoint_mapcaveat is gone.recordProgresstests: a Tapis job moved toarchivingorfinishedafterstampForJob, another lease, another runner, and a deleted stamp each givebad_stateand zero rows; the reconcile gate wins once; a stale write id writes no document.storedbranch tests for a stored, failed, and expired derivative with and withoutstored_at.storage_unavailablewithprogress_stamp_read_failed(test renames the stamps table away and back).parseRecordingsTablerefuses more thanPROGRESS_MAX_RECORDINGSrows (too_many_rows, sotable_unreadable).storedclaims the run row with a write id; thestoredupdate and the document are gated on it.floor_live_partial.PROGRESS_MAX_BYTESis stated as compact UTF-8 JSON; the largest-object test uses a 256-character path of"(8,142 bytes).headlineplus value and plugin is aqualityMetric, and whereheadlinelives.RecipeCheckpoint.checkpointisDeclarableCheckpoint;TableRead.reasonisTableReadProblem.test/compute-recipes-process-drift.unit.test.tsalso compares each checkpoint map with nemar-processSTEP_ORDER(floor, then floor plus ica).Mutation evidence (each reverted): dropping the hold exclusion, the job-state term, the lease term, the stamp term, the document write-id guard or the stamp order each fail their test; counting
reconciledwithout the gate's change fails the race test; reading the stamp's version instead of the recorded one fails the I2 test; accepting progress in any phase fails the phase test; an 8 KiB or a 32 KiB heartbeat cap each fail the cap test; a changedSTEP_ORDERcopy fails the drift test.Gates on 5ce7177: typecheck, lint, Biome on all 43 touched files,
migrations:d1-check; pure tests 941 pass (with the drift test against nemar-processdevandNEMAR_REQUIRE_PROCESS_RECIPES=1); backend 756 pass (migration, route, runner progress, reconcile, metadata, inventory, callbacks, runner jobs, switches, cron wiring, pipeline, dispatch, derivatives, runner queue). Not run, would check: the fullbun test(epic todev).Review round 2
failedlink only for a failed stamp. A succeeded stamp of a known recipe gets thecompletedlink built from its record (no checkpoint map needed); a record that cannot make one, or a recipe the registry no longer knows, leaves the last final link standing (link_not_written reason=record_unlinkable|recipe_unknown). OnefinalLinkStatementserves both paths; docblocks and the test header corrected. Tests: the hold-stamp case servescompleted(version9.0.0) for the succeeded stamp; a succeededno_checkpoint_maprun replaces the last completed link with its own completed link; a succeeded run of an unknown recipe leaves the last link standing.LIVE_LINKS_SQLkeepss.state = 'dispatched', now pinned: an ended stamp whose run reported and was never reconciled serves noin_progress.storedrow resolve it once and write its entry; a resolved row can no longer be claimed (STORED_CLAIM_SQLchanges 0).LIVE_LINKS_SQLjoinscompute_jobsand requiressubmitted,queued,runningorarchiving(LIVE_LINK_JOB_STATES); test:submittedandarchivingare live,finished,cancelledandunreportedare not.Mutation evidence (each reverted): writing
failedfor every outcome fails the no-checkpoint-map test; dropping the dispatched term fails the S1 test; dropping the job term fails the S3 test; dropping the claim's pending guard fails the S2 claim test.Gates on 5cfa3f8: typecheck, lint, Biome on the touched files; reconcile, metadata, route, runner progress, pipeline, dispatch, migration and checkpoint tests pass (232). Not run, would check: the full
bun test(epic todev).