Skip to content

Phase B4: checkpoint outcomes and signalJourney links per recording (#2324) - #2416

Merged
neuromechanist merged 16 commits into
feature/issue-2324-epic-pipeline-progressfrom
feature/2324-record-processing
Nov 26, 2026
Merged

neuromechanist merged 16 commits into
feature/issue-2324-epic-pipeline-progressfrom
feature/2324-record-processing

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Phase B4 of epic #2324: checkpoint outcomes and signalJourney links per recording (ADR 0134 decision 9), and, under the same rule, the dataset level.
Both levels now describe each recipe's promoted run (its current public derivative, ADR 0137 decision 7), built on read; nothing is stored per recording.

  • Record level (new). GET /<id>/quality/v1/<recipe>/processing/<recording> answers nemar.processing-record.v1: the recording's neuroschema processing entry (each declared checkpoint's status, code and step, then stored) and its signalJourney link (completed with its record's location, SHA-256 of the bytes and sj_version, or failed for a recording the run wrote no record for). It is built from the promoted derivative's recordings table (a scan of ranged reads of the whole table for the exact path: at most 32 MiB, refused unread above that, lines of at most 65,536 characters; a recording that two rows name refuses the table) and the recording's record. A cache miss is charged to the caller's data miss budget (as a brokered git file's miss is), and a recording the table does not list is remembered in the edge cache under the same key; the client still gets no-store. stored follows the last declared checkpoint, so a recording whose quality plugin was skipped shows stored: skipped with the plugin's code. A code that does not fit failureCode is written unrecorded_code. The route's gate, derivative choice, epoch-keyed edge cache, Cache-Tag purge and ETag apply unchanged; no new word.
  • Dataset level (changed, owner ruling of 2026-11-26). metadata.json and the page bundle build processing from the promoted run's reconciled counts (with stored worked out as kept) and signalJourney from the link reconciliation now keeps on the run row, so processing, signalJourney and dataQuality of one answer describe one run. A run in progress, a canary run and a failed run show nothing publicly; no in_progress link is served. Admins keep the grid.
  • Consistency. A recording's outcomes summed over the run equal the dataset counts that metadata.json serves after the real reconciliation of the same run (a test checks it through both routes). A recording's link SHA-256 equals the record_sha256 of its dataQuality entry. Every entry at either level is checked against the vendored neuroschema before it is shown.
  • One row per recording. parseRecordingsTable refuses a path that two rows name (duplicate_path). Reconciliation gives that run the outcome table_unreadable with no counts, and the admin run-quality listing answers table_unreadable (its own de-duplication is gone).

What the alignment changes (Q2)

  • What the public sees during a run: the promoted run's entries, unchanged; no in_progress.
  • Canary and failed runs: nothing public. A dataset with no promoted derivative shows none of the three namespaces.
  • Promotion and expiry: the derivative choice is made on every request (one D1 batch for all three namespaces), so a promotion shows at the next request. metadata.json keeps max-age=60. The quality route's cache key carries the derivative key and the dataset's epoch, so no purge is needed on promotion; unpublishing, making private and concealing already purge nemar-dq-<id>. No code lowers a class.
  • Reconciliation writer: it no longer writes compute_pipeline_documents (nothing reads it any more). It keeps the run's completed link on compute_pipeline_progress_runs.link. stored resolution is unchanged in its counts (storedCounts), and the grid still reads it.
  • Tests that asserted the latest run were rewritten to the promoted run: compute-progress-reconcile, metadata-json-pipeline-route, metadata-json-quality, quality-documents, compute-runner-progress, compute-progress-route, compute-pipeline-grid, compute-pipeline (deletion) and the 0150 migration test. liveSignalJourneyLinks, LIVE_LINKS_SQL, PIPELINE_DOCUMENTS_SQL and FINAL_DOCUMENT_SQL are gone.
  • Website (feature/issue-586-epic-pipeline-progress): no reader of metadata.json processing or signalJourney (it reads only extensions.dataQuality), so nothing there changes behavior. Its captured metadata-*.json fixtures seed no run rows and stay byte-identical. Its quality-route drift test compares a fixed list of constants and the word table, both unchanged.
  • Docs: docs#144 and docs#146 say nothing of the latest run (docs#144 already says public pages show only promoted results; docs#146 describes the admin grid). On docs main, the gated admin/design/compute-gateway.md mirrors ADR 0134's decision 9 table (lines 1096 to 1097: processing_status in_progress while reports arrive) and decision 4 (line 1153), so it needs the amendment when it is next synced. The docs repo was not edited.

Migration 0154

0154_compute_pipeline_promoted_run.sql:

  • adds compute_pipeline_progress_runs.link (a JSON object or NULL, CHECK named), backfilled from the last signalJourney documents (completed links only);
  • drops compute_pipeline_documents;
  • adds compute_derivatives.checkpoint_map (a JSON array or NULL), written at keying beside quality_plugins, so a derivative of a recipe version the registry has moved past is read with its own map. The derivative sync fills a NULL map while the registry holds the row's version. A row with neither answers record_unreadable (checkpoint_map_unknown).

#2397 (feature/issue-2182-epic-pq-decide) also numbers 0150-0154; whichever reaches dev second renumbers, and test/migration-prefixes.unit.test.ts catches a clash.

Contract files changed

  • shared/contract/quality-route.ts: adds QUALITY_PROCESSING_SEGMENT, QUALITY_PROCESSING_FORMAT, QUALITY_TABLE_MAX_BYTES (the backend's TABLE_READ_MAX_BYTES is now this constant), QUALITY_TABLE_LINE_MAX, qualityProcessingPath and the endpoint's docblock. The words are unchanged. The website copies these when it reads the endpoint.
  • shared/contract/compute-admin.ts: comment only (the run-quality listing's unlisted no longer counts repeated paths). The website's drift test reads constants, not comments.
  • shared/compute-checkpoints.ts (not under contract/, but on nemar-process's advisory drift list): readRecordingsHeader, readRecordingsRow (now used by parseRecordingsTable), storedCounts, processingRecordEntry, processingRecordProblem, UNRECORDED_CODE, and the new duplicate_path refusal. nemar-process's launcher reader is its own, so it may want the same refusal. A completed link's location is checked against neuroschema's relativeLocation, so a non-ASCII recording path can be linked. compute-progress-vectors.json is unchanged, so nemar-process's pin bump is a no-op copy.

ADR and changelog

  • ADR 0134: an amendment after decision 9, "what a public page shows of a run": the promoted run, built on read; stored follows the last declared checkpoint; one row per recording. Plus its index line. No owner attribution.
  • CHANGELOG Unreleased: the phase 2 entry is corrected to the end state, and a B4 entry is added.

Follow-ups

Test plan

  • bun run typecheck, bun run lint, bunx biome check on every touched file
  • bun run migrations:d1-check (145 migrations on real D1; catalog matches bun:sqlite)
  • Targeted root suites: compute-checkpoints, quality-route-contract, adr-index, migration-prefixes, page-bundle, contract-neuroschema, quality-documents-contract, compute-recipes, schema-check-contract, compute-admin-contract (661 pass)
  • Targeted backend suites: compute-progress-reconcile, metadata-json-pipeline-route, metadata-json-quality, quality-documents, quality-processing-route (new), quality-route, quality-admin-views, quality-admin-route, quality-cache-purge, compute-derivatives, compute-pipeline, compute-pipeline-grid, compute-runner-progress, compute-progress-route, git-file-broker, the 0150/0151 migration tests and compute-pipeline-promoted-run-migration (new) (507 pass)
  • 35 one-line mutations (20 from the first push, 15 for the round 1 findings), each applied alone, fail the tests that name them; the tree was clean after each
  • Full bun test: not run. It would check the whole process for shared-state leaks; it is the epic-to-dev gate (Pipeline checkpoints, live progress and quality views (ADR 0134, ADR 0137) #2412)

Agentic AI tools were used. The author assumes full responsibility for this content.

Export the recordings header and row readers that parseRecordingsTable now uses, so one row is read by the same rules as the whole table. Add storedCounts, processingRecordEntry and processingRecordProblem for a recording's processing entry, and check a completed link's location against neuroschema's relativeLocation so a recording's record path can be linked.

Tested: bun test test/compute-checkpoints.unit.test.ts (66 pass).
metadata.json and the page bundle now build the dataset-level processing entry and signalJourney link from each recipe's current public derivative, as dataQuality already was: the run's reconciled counts with stored worked out as kept, and the completed link reconciliation keeps on the run row. A run in progress, a canary run and a failed run show nothing; no in_progress link is served. Migration 0154 adds compute_pipeline_progress_runs.link (backfilled from the last documents) and compute_derivatives.checkpoint_map, and drops compute_pipeline_documents, which nothing reads any more.

Tested: bun test of compute-progress-reconcile, metadata-json-pipeline-route, metadata-json-quality, quality-documents, compute-runner-progress, compute-progress-route, compute-pipeline-grid, compute-pipeline, compute-pipeline-progress-migration and the new compute-pipeline-promoted-run-migration suites (all pass).
Keying writes the recipe version's checkpoint map into compute_derivatives.checkpoint_map beside quality_plugins, so a recording's outcomes can be read with the map of the version that made the derivative after the registry moves on.

Tested: bun test test/compute-derivatives.test.ts (91 pass).
Add GET /<id>/quality/v1/<recipe>/processing/<recording> to the public quality route: the recording's neuroschema processing entry (each declared checkpoint, then stored) and its signalJourney link, built on request from the current public derivative's recordings table (a ranged scan for the exact path, bounded) and the recording's record, under the route's gate, epoch-keyed edge cache, Cache-Tag and ETag. A recording that failed or was skipped has a failed link. The contract gains the segment, the answer's format, the table bounds and the path builder; no word changes.

Tested: bun test of quality-processing-route (new, 20 pass), quality-route, quality-admin-views, quality-cache-purge and test/quality-route-contract.unit.test.ts.
Amend ADR 0134 after decision 9: a public page's processing and signalJourney entries, at the dataset and the record level, describe the promoted run, built on read; no in_progress link and no row per recording. The index line says so.

Tested: bun test test/adr-index.unit.test.ts (11 pass).
Correct the phase 2 entry to the end state (no stored documents, the run's link on its row) and describe phase B4: the promoted run on public pages, the processing endpoint, migration 0154 and the contract additions.

Not tested: documentation only.
Give the newer canary run a record of its own so dropping the public derivative term shows, add a tail of a listed path to the exact-path case, and name only mutations each test was watched failing under.

Tested: the three suites (56 pass); each named mutation applied alone fails its tests (scratchpad b4-mutate.py, 20 mutations).
promotedProcessingEntry, checkpointMapOfRow and scanRecordingRow have no caller outside their modules.

Tested: typecheck; bun test quality-processing-route and metadata-json-pipeline-route (26 pass).
parseRecordingsTable refuses a path two rows name (duplicate_path). A record-level entry writes unrecorded_code for a code that does not fit failureCode, and derives stored from the last declared checkpoint, as storedCounts does; the docblocks say what stored means and where the cascade rule and a skipped plugin would conflict. A registry test holds every plugin step to the last declared checkpoint.

Tested: bun test test/compute-checkpoints.unit.test.ts test/compute-recipes.unit.test.ts.
The admin run-quality listing now gets duplicate_path from parseRecordingsTable and answers table_unreadable; its own de-duplication is gone, and the contract's unlisted comment says so.

Tested: bun test test/quality-admin-route.test.ts (27 pass).
The derivative sync gives a row with no checkpoint map its recipe version's map while the registry holds that version, never replacing a recorded one. TABLE_READ_MAX_BYTES is now the contract's QUALITY_TABLE_MAX_BYTES.

Tested: bun test test/compute-derivatives.test.ts.
The processing endpoint scans the whole table and refuses a recording two rows name (duplicate_path); a recording with no checkpoint map is record_unreadable. A miss is charged to checkDataMissBudget, and a recording the table does not list is remembered in the edge cache under the same key while the client still gets no-store. Tests add the served-counts invariant after a real reconciliation, the size bound with no ranged read, BOM and CRLF, identity by recipe and version, a non-UTF-8 record, map validity and precedence, and the tombstoned and never-published gate.

Tested: bun test test/quality-processing-route.test.ts (28 pass).
readPipelineExtensions shows a promoted run's processing entry and link only when they pass the vendored neuroschema, as a recording's do. Tests: each term of the read's own gate alone (not_anonymous with the trigger dropped, first publication, tombstone and the rest), tombstoned and never-published datasets through metadata.json, the concealed-deposit test relabelled to the two guards it holds, and a succeeded run whose table repeats a path.

Tested: bun test of metadata-json-pipeline-route, metadata-json-quality and compute-progress-reconcile.
A completed link longer than the new column takes is left out of the backfill.

Tested: bun test test/compute-pipeline-promoted-run-migration.test.ts.
ADR 0134's amendment says stored follows the last declared checkpoint and that a table repeating a path is refused; the changelog describes the miss budget, the absent memo, unrecorded_code, the map fill, the schema check and the duplicate refusal.

Tested: bun test test/adr-index.unit.test.ts.
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

📦 Package Preview

Your package is ready to test!

bun install -g nemar-cli@PR2416

Version: 0.10.40-PR2416.c341780
Commit: c341780


🤖 Updated on each push.

Route tests: a failed row whose code does not fit failureCode answers unrecorded_code on the failed checkpoint and on stored; a newer promoted derivative under the same epoch serves neither the old answer nor the old remembered absence. The route's header now says the absent-recording marker is the one refusal kept in the cache, never sent; the cache test is renamed to match.

Tested: bun test test/quality-processing-route.test.ts (30 pass); removing the substitution, and dropping the derivative key from the cache key, each fail this suite.

This branch was previously deployed

1 inactive deployment
npm — c3417807 Deployed Nov 26, 2026 by neuromechanist via publish #5005
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