Repository navigation
Phase A6: First-party pipeline dispatch - #2054
Merged
neuromechanist merged 28 commits intoNov 6, 2026
Merged
neuromechanist merged 28 commits into
neuromechanist merged 28 commits into
Conversation
Import-free table of nemar-floor and nemar-ica: version, engine, application, resources, and the argument vector that carries the image digest. Reads the recipe's own record for the stamp. Tested: registry shape and digest argument (21 pass); one mutation killed.
Migration 0117 holds one stamp per dataset version, recipe, recipe version and engine, with a partial unique index so a live or succeeded tuple is claimed once. Deleting a dataset deletes its stamps and keeps the job rows. Tested: migration on two engines (19 pass); one mutation killed.
One list of named terms, SQL and TypeScript side by side: active, public, not anonymous (anonymous = 0, decided from the row), first published, not withdrawn, DOI not tombstoned, has a version, EEG as a whole modality token, real nm or on id outside the fixture band. Also the version helpers a run reads. Tested: 24 pass; two mutations killed.
A recipe passes its image digest as an argument and cannot check it, so the Worker compares the value the job passed with the digest the launcher's provenance says it ran, and fails the job as image_digest_mismatch on a difference, a missing flag or a second one. Tested: 5 new, 108 lifecycle pass; one mutation killed.
dispatchPipelineJob resolves a recipe into a complete image job before createJob, claims the tuple's stamp first, takes the hold on the platform pipelines pool, links the stamp and submits. syncPipelineStamps moves stamps to succeeded (rewritten from the recipe's own record) or failed, and recovers a job whose link was lost by its key. Tested: 45 pass on SQLite and Miniflare D1 (race, eligibility, sync, cascade); six mutations killed.
pipelineCandidates lists the eligible datasets whose newest version holds no live or succeeded stamp for the recipe's tuple, skipping a version no launcher can stage. pipelineDryRun reads only and reports the estimate and what blocks each term. dispatchEligible runs the next n datasets and stops at a refusal that would repeat. Tested: 18 queue tests pass; four mutations killed.
POST /admin/compute/pipeline/run takes a recipe, then one dataset with an optional version or the eligible queue with a limit, plus dry_run; the body is strict and the Worker supplies every fact itself. A dry run reads only and works in every environment; a live run refuses compute_disabled unless compute is on and is audited with counts. GET /admin/compute/pipeline/status syncs the stamps and pages them. Tested: 32 route tests, contract and inventory pass; four mutations killed.
The scan allowed one gating read of COMPUTE_ENABLED. The dispatch and its route now refuse new pipeline work with compute off, and the dry run reports the switch; each is named in the scan. Tested: source scan 4 pass.
runComputePipelineDispatchCron is wired into the production-only daily block. It returns null outside exact production, does nothing and touches no table until compute and the pipelines switch are both 1, dispatches automatic recipes only within the daily cap and the live cap per pool and a bound per tick, stops at a refused hold, and holds back a recipe whose registry disagrees with a recent success. Tested: 39 new tests and the cron wiring pass; five mutations killed.
run takes a recipe and one dataset with an optional version, or the eligible queue with a limit, plus --dry-run; wrong arguments are refused before anything is sent and a refused dataset exits 1 with the Worker's word and the terms that block it. status lists and pages the stamps. Every command takes --json. Tested: 33 CLI tests against the real routes pass; three mutations killed.
Amendment for phase A6: the recipe resolved before createJob, the stamp and its claim, the stamp rewritten from the recipe's record, the image digest check, eligibility, the dispatcher's caps and the dry run. Tested: compute-state unit suite passes.
A tuple whose stamp failed is not a candidate for 7 days (initial) and not after 3 failed attempts (initial), decided in the candidate SQL, so failing datasets at the head cannot starve the queue. Tested: 4 new queue tests failed before the change; queue, dispatch, route suites pass.
nemar-ica is marked a placeholder and every dispatch path (single, queue, dry run, route) refuses it with recipe_placeholder, writing nothing. Tested: 3 new tests failed before the change; pipeline suites pass.
A specification the job schema refuses is now invalid_spec with nothing written, and ends a run over the queue, instead of a throw that left a dispatched stamp and aborted the cron. Tested: 2 new tests failed before the change; pipeline suites pass.
If createJob throws after its batch committed and the lookup of the job by its key fails too, the stamp stays dispatched and the failure is logged, so the sync links the job instead of a later attempt making a second one. Tested: new test failed before the change; compute-pipeline suite passes (48).
A record whose package@version exceeds the 64-character engine column is unreadable, so the stamp ends failed (record_unreadable) instead of staying dispatched when the update throws. Tested: 2 new tests failed before the change; pipeline and recipe suites pass.
A rewritten tuple that is already stamped now ends the stamp failed as tuple_already_stamped and is logged; the run itself may be good. A failed audit write after a dispatch returns the job ids with audit_pending instead of a 500. Tested: 4 new or changed tests failed before the change; pipeline, route and contract suites pass.
Every open stamp the sync visits goes to the back of the line, every outcome that leaves a stamp open for later logs the stamp, dataset and reason, and a run over the queue that throws reports the jobs it already made so the cron logs the partial count. Tested: 4 new tests failed before the change; pipeline suites pass.
dispatchEligible no longer syncs again when the cron has just done so, and the cost comment and ADR state the true bound of a tick (about 510). Tested: new test failed before the change; dispatch and state suites pass.
When a job finishes, a record that names another tuple than its stamp claimed holds the claimed tuple on every path (single dispatch, queue, cron, dry run) with registry_drift; a version bump is never held. The seven-day comparison is gone. The ADR records the remaining exposure of jobs in flight. Tested: 9 new or rewritten tests failed before the change; pipeline, dispatch, queue and route suites pass.
The submit records the image digest on the job row, so a provenance naming another image was refused by the older check. The test now clears the row digest first, so only the recipe check can fail it; with that check mutated away it now fails (it passed before). Tested: verify suite passes (5).
The rewrite test no longer promises an assertion it lacks, the compute-off test now proves the gate comes before the dataset read, and the prose uses canceled. Tested: pipeline and migration suites pass.
A recipe cut by the 10-job tick bound is reported as tick_cap in the result and the log line, not as having nothing eligible. Tested: the bound test and a below-the-bound test pass; the first failed before the change.
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR2054Version: 🤖 Updated on each push. |
Platform, cancel and registry failure words no longer count toward the retry cooldown or the failed-attempt cap, so transient errors cannot shut a dataset out. The ADR also says a single-dataset admin dispatch bypasses both. Tested: new test failed before the change and fails with the word list emptied; queue and pipeline suites pass.
The hold does not clear by time. It clears on a registry bump or when its rows are deleted with their dataset; the next mismatch holds the tuple again, bounded by the live cap. Wording only, in the ADR and two comments.
The comment and the ADR gave 5 per stamp; a stamp costs 5 to 9, so the tick is bounded at about 510 usually and 710 at the worst. Wording only.
A rewritten tuple refused by the attempt index (history only) is tuple_attempt_taken; one refused by the live index stays tuple_already_stamped. Neither counts toward the cooldown or the cap. Tested: new test failed before the change and fails with the match removed; pipeline suite passes.
On a dispatched stamp the column is when the sync last looked, since the sync touches every open stamp it visits. Comments in the migration, the contract and the route; no behavior change.
neuromechanist
merged commit Nov 6, 2026
df9e5bd
into
feature/issue-2005-epic-compute-core
17 of 19 checks passed
neuromechanist
deleted the
feature/issue-2011-phase6-first-party-pipeline-dispatch
branch
November 6, 2026 03:36
8 of 9 tasks
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase A6 of the compute core epic (#2005): first-party pipeline dispatch. Closes #2011 once it reaches
devwith the epic.What changed
0117_compute_pipeline_stamps.sql: one stamp per dataset version, recipe, recipe version and engine; a partial unique index ondispatchedandsucceeded;deleteDatasetCascadedeletes stamps and keeps the job rows.shared/compute-recipes.ts(import-free):nemar-floor(CPU,shared, automatic) andnemar-ica(GPU, a placeholder: no path dispatches it,recipe_placeholder); the argument vector that carries--image-digest; the reader of the recipe's own record.compute-pipeline-eligibility.ts: one predicate, SQL and TypeScript side by side, decided from the D1 row (ADR 0065).compute-pipeline.ts:dispatchPipelineJobresolves the recipe BEFOREcreateJob, builds the specification before the claim, claims the stamp first, creates the job on the platformpipelinespool, links the stamp and submits;syncPipelineStamps; the queue (with a cooldown and a cap for tuples that fail for a dataset-caused reason),pipelineDryRunanddispatchEligible.verifyResultscompares the digest a recipe job passed with the launcher'sprovenance.jsonand fails the job asimage_digest_mismatch.POST /admin/compute/pipeline/runandGET /admin/compute/pipeline/status;nemar admin compute pipeline run|status, every command with--json.runComputePipelineDispatchCronin the production-only daily block, dark without both switches.Review fixes (second round of commits)
RETRY_COOLDOWN_DAYS) and not after 3 failed attempts (MAX_FAILED_ATTEMPTS); both are initial values, because the issue states none. Decided in the candidate SQL. Only dataset-caused failures count toward either.NON_DATASET_FAILURE_WORDSexcludes the platform failure codes,job_cancelled,no_job,job_missing,create_failed,recipe_unknown,tuple_mismatch,tuple_already_stampedandtuple_attempt_taken; a refusal is not a failure either. The launcher'sruntime_error,time_limit,out_of_memoryandentry_not_found,job_failed, and the recipe'soutputs_missing,record_unreadableandrecord_mismatchcount. An admin dispatch of one named dataset bypasses the cooldown and the cap (it is still refused for a live stamp, a held tuple or an ineligible dataset).failedstamp,tuple_mismatch), checked in the shared dispatch path, the queue, the cron and the dry run (registry_drift). A version bump is never held. The hold does not clear by time: it clears on a registry bump, or when its rows are deleted with their dataset (the dataset cascade is the rule), and the next mismatch on any dataset holds the tuple again, so the exposure is bounded by the live cap. The jobs already in flight when a mismatch first appears remain exposed (in the ADR).createJobthrows after its batch committed and the key lookup fails too, the stamp staysdispatchedand the sync links the job.invalid_spec, writes nothing and ends a queue run instead of aborting the tick.nemar-icais a placeholder and every path refuses it withrecipe_placeholder, writing nothing.record_unreadable.tuple_already_stampedfor the live index (the tuple already holds a live or succeeded stamp) andtuple_attempt_takenfor the attempt index (history only, same attempt number); a failed audit write after a dispatch returns the job ids withaudit_pendinginstead of a 500.tick_cap.updated_atof adispatchedstamp means last examined (documented in the migration, the contract and the route).Deviations and decisions for review
backend/src/routes/admin/compute-pipeline.ts, registered inroutes/admin/index.ts, and not inroutes/admin/compute.tsas the issue's wording suggests. The file is the A5 pattern (compute-jobs.ts) and keepscompute.tsto the policy and the pools.backend/test/compute-source-scan.test.tsallowed one gating read ofcomputeEnabled; it now names the dispatch and the route (new work is refused with compute off) and the dry run (reports it).Mutation evidence
Each mutation was applied by hand, the named tests failed, and the code was restored. None is committed. The
anonymous = 0toIS NOT 1mutation named in the issue cannot be realized as a row: the column is NOT NULL, so the NULL row cannot be stored. The SQL form is pinned by a test (the term text), and the TypeScript form is tested with a NULL value (the mutation!== 1flips it).= 0toIS NOT 1(SQL and TypeScript)LIKEif (!loaded.eligible)removeddispatchedpythonruntime without an imageNON_DATASET_FAILURE_WORDSemptied) in compute-pipeline.tssync: falseremoveddispatchedremoved.strict()removedCoverage gaps and residual risks
pool_refusedandrun_endedin the cron need a second automatic recipe in the same pool, and the registry has one (the other is a placeholder). The queue run and dispatch look recipes up by name in the real registry, so a fixture registry cannot reach those branches through the real cron. They are two lines each and are tested only by reading.tick_capfor a recipe that starts with no tick budget left has the same limit; the case where the bound cuts a run is tested.extensions.nemar.recipe,.engine,.counts).dispatcheduntil an administrator cancels it.Tests run (targeted; the full suite was not run)
bun teston the 14 changed test files: 511 pass, 0 fail. Neighbors (compute-full-path,compute-lifecycle-migration,compute-lifecycle-money,compute-lifecycle-submit,compute-lifecycle,compute-switches-flag): 206 pass, 0 fail.bun run migrations:d1-check(120 migrations, 195 objects),bun run typecheck,bun run lint.bun testand CI: not run by the implementer.