Repository navigation
Phase A1b: launcher contract follow-up - #2034
Merged
neuromechanist merged 11 commits intoNov 4, 2026
Merged
neuromechanist merged 11 commits into
neuromechanist merged 11 commits into
Conversation
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR2034Version: 🤖 Updated on each push. |
neuromechanist
merged commit Nov 4, 2026
7ba7d2f
into
feature/issue-2005-epic-compute-core
2 checks passed
neuromechanist
deleted the
feature/issue-2006-a1b-launcher-contract-follow-up
branch
November 4, 2026 14:37
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 A1b of the compute gateway core (epic #2005, follow-up to phase A1, issue #2006): the launcher contract changes found by the review of the launcher in
nemarOrg/nemar-process#7. Nothing here touches D1, the Worker, the CLI or the network. The shared JSON Schema and the golden vector below are the interfacenemar-processre-pins to. This body is current as of the round 1 review fixes (head87fba589).What changed
shared/compute-state.tsdeclaresLAUNCHER_DETAILS(each of the seven launcher codes with the fixed-word details it may emit) andPLATFORM_LAUNCHER_DETAILS(the subset that is a NEMAR, node, runtime or contract fault).isPlatformFailure(code, detail)now lets a declared detail decide for a launcher code: a platform detail is a platform failure even underruntime_error, a submitter detail is not one even undercode_fetch_failedordataset_fetch_failed, and a missing or undeclared detail keeps the old behaviour (the code alone decides). Theresult_upload_failedandRESULT_REFUSAL_DETAILSrules are unchanged. The rule for a word: platform if and only if a submitter cannot cause it with a valid specification and bundle.NEMAR_SIF_ROOTand the image file (item 1).LAUNCHER_ENV.SIF_ROOTisNEMAR_SIF_ROOT, required: the launcher has no fallback and endsimage_missingwhen it is unset.image.sifis exactly<64 lowercase hex>.sif, the file name of the Singularity image file built from the image's digest, relative toNEMAR_SIF_ROOT. The hex ofimage.digestplus.sifmust equal it: a rule the JSON Schema cannot express, enforced by a refinement onLaunchSpecSchemaand the pure helpersifFileNameForDigest, and stated in the schema description and the docblock. The launcher does not verify the file's content hash; the name is all that ties the file to the digest. The differential harness now lists the rules only zod enforces apart (ZOD_ONLY_LAUNCH_CASES) instead of failing on them.datasets[].versionis the data-plane tag,latestorv<major>.<minor>.<patch>, at most 64 characters (round 1: the limit of the provenancestaging[].version), in zod and in the JSON Schema; the user-facing job specification keeps accepting what it accepted. The pure helperdataTagForVersion(version)(1.0.2givesv1.0.2,v1.0.2andlatestunchanged, anything else null) is what the Worker's launch-specification builder will use, and a test holds the grammar toVERSION_TAG_REinbackend/src/services/data-router.ts.launchSpecFitsis false for a job whose dataset version has no tag, anddatasetVersionWithoutTagnames the field.**crosses/;*and?stay inside one path segment;[abc],[a-c]and[!abc]classes; case-sensitive; no escapes; a matcher must run in time linear in pattern length times path length; no cap on wildcards) and the entry semantics (python /code/<entry>followed byargs; a command as given withargsappended; an image job with an entry runs/code/<entry>directly and needs the executable bit; the runtime image providespythonon its PATH; a bundle's member names may carry a leading./, and absolute names,.., links, devices and named pipes are refused by the launcher) are stated once asCOMPUTE_ENTRY_DESCRIPTION,COMPUTE_COMMAND_DESCRIPTION,COMPUTE_ARGS_DESCRIPTIONandCOMPUTE_INCLUDE_DESCRIPTION, carried as zod descriptions on both specifications, word for word in the schema, and in theJobSpecSchemadocblock; tests hold the three to each other..context/compute-program/implementation-notes.mdrecords all of it. The classification table and the import guard intest/contract-schemas.test.tsneeded no change: nothing added is a schema object or a strict name (the descriptions and helpers are plain exports).Round 1 review fixes
JobSpecSchemadoes not enforce (1.0,abc,V1.0.2and2.0.0-rc.1are valid for a job and have no tag), so the Worker and the CLI must runlaunchSpecFitsand refuse withinvalid_specBEFORE the hold. The new pure helperdatasetVersionWithoutTag(datasets)returns the first such field asdatasets.<i>.versionso they can name it. ThelaunchSpecFitsandJobSpecSchemadocblocks, the implementation notes, the ADR and the test title are reworded;JobSpecwas not tightened.COMPUTE_DATA_TAG_MAX, schemamaxLength64), so a bare job version is at most 63 characters and every tagdataTagForVersioncan return passes the provenancestaging[].versionpattern and bound; a test walks every tag length and checks it in zod and Ajv.dataset_not_eligible, any dataset not public and published, any version not published and any manifest over 38,000 entries, sodataset_not_foundand the manifest-too-large case stay the platform's; the Worker's own cancel record overrules the launcher'sterminateddetail; the default for an undeclaredruntime_errordetail is deliberate (charged); and a launcher change that adds a detail word lands with its entry here in the same pair of pull requests (the launcher's drift test compares the lists per code). All in ADR 0118 decision 13 and the implementation notes, pinned by a test.**/matches zero or more directories (a/**/bmatchesa/b);**elsewhere matches any run of characters including/; an unterminated[is a literal; an empty class[]and an inverted range such as[z-a]are refused, andbad_includeis exactly that set. The text is one description (schema, zod,COMPUTE_INCLUDE_DESCRIPTION), kept in step by the equality test; the pure helperincludePatternProblem(pattern)returnsempty_class,inverted_rangeor null, andJobSpecSchemarefuses such a pattern at submit, namingdatasets.<i>.include.<j>. A character class never matches/(the driver's last decision): like*and?it stays inside one path segment, and a negated class[!a]matches any single character exceptaand/; this sentence is in the same description, ADR decision 15, the implementation notes and the JobSpec docblock, each pinned by a test. The launch specification stays permissive (the launcher alone refuses it).image.urimust end with@sha256:and the hex ofimage.digest: a zod-only rule like the sif rule, listed inZOD_ONLY_LAUNCH_CASESand stated in the schema description. Worker-only narrative was trimmed from the shared descriptions ofversion,sifanduri(it moved to the zod docblocks), and a test keeps it out.Known launcher limitations (the launcher's matter, not changed here):
entry_failed;unsafe_archiveraised for anOSErrorcreating a member (a node fault: the launcher is to usedisk_error); the Worker routes' own refusal code words used as details under the upload codes; and, for the include dialect, the launcher'sglob_regexatc872f5atreats[]as a literal and[]x]as a class, lets a class match/(the contract says it never does), and compiles to a backtracking regular expression where the contract requires linear time.IMPORTANT: item 5 changes which launcher details are refunded, and the owner has not yet confirmed it
Until now
code_fetch_failed,dataset_fetch_failedandresult_upload_failedwere always refunded andruntime_errornever was. With this change a launcher failure is refunded or charged by its detail: for exampleruntime_errorwithimage_missing,invalid_spec,internal_errororno_container_runtimeis now REFUNDED, whilecode_fetch_failedwithunsafe_archiveorarchive_too_large, anddataset_fetch_failedwithbad_include,too_many_filesortoo_many_bytes, are now CHARGED. The word lists were settled by the driver with the advisor and are the launcher implementer's list; they have NOT been confirmed by the owner. Nothing charges or refunds anything yet (the ledger arrives in later phases), so the cost of changing a word is one line inshared/compute-state.tsand its test table.New schema and golden vector
shared/contract/compute-launch.schema.json: SHA-2566707bb26d653b6fc7521a2e05fe33758e533f57f3453ca5567e3698e00469ec2, 21,025 bytes (it changed in round 1: the versionmaxLength, the include and uri descriptions, trimmed narrative; and in the last commit: the include description says a character class never matches/).The golden launch specification (unchanged in round 1) now has the dataset
versionv1.0.2andimage.sifequal to the 64-characterbdigest hex plus.sif; the other fields are as before (a non-ASCII character, an astral character, a double quote and a space inargs). Encoded text (766 bytes, ASCII):SHA-256 of those bytes:
88fcf9a4d6e63ae7bbedc9be536989fd7f2c263bb2b1c2fb6cfd706f49efe857. It is pinned as a literal intest/compute-contract.unit.test.tsand was recomputed independently with Pythonjson.dumps(spec, separators=(",", ":"), ensure_ascii=True)(the same method reproduces the previous golden digest68ef4653...).Gates
bun test test/compute-state.unit.test.ts test/compute-contract.unit.test.ts test/compute-header.unit.test.ts test/adr-index.unit.test.ts test/contract-schemas.test.ts: 600 pass, 0 fail, 72580 expect() calls, across 5 files.bun run typecheck(tsc --noEmitfor the CLI and the backend): exit 0.bunx biome check shared test/compute-state.unit.test.ts test/compute-contract.unit.test.ts test/compute-header.unit.test.ts test/contract-schemas.test.ts:Checked 91 files. No fixes applied.jsonschema(Draft 2020-12) over the shared schema with 83 documents (the sif, tag and image corpus, the earlier corpus, the golden vector hashed as raw bytes and then parsed): 0 disagreements; the zod-only cases (the sif, the image reference, the include patterns) are valid there by design.compute-launch.ts(55) andcompute.ts(174) was bumped by one in each direction: 0 survivors. One include-scanner mutant hung the test run (an infinite loop) and was counted as killed; two kinds of mutant are equivalent and were not run (p + 2 < body.lengthagainst<=, andi = endagainsti = end + 1).bun testis for the driver to run on the final head.Words that differ from the launcher's
codes.pyChecked against
launcher/nemar_launch/*.pyonorigin/feature/issue-2-phase1-repository-scaffold-and-the-nemaratc872f5a(the filecodes.pyitself declares no detail words yet, so the words are read from where the launcher raises them).output_dir_not_empty,bind_source_unsafe,pid_namespace_unavailable,outputs_unreadableandfetch_failed.digest_mismatch(the bundle's checksum mismatch, which the launcher renames),size_mismatch,disk_error,bad_manifest,manifest_too_large,unsafe_path,file_not_found,incomplete_plan,upload_failed,outputs_refusedandcomplete_refused.http_<status>(not a closed list),timeout,network_error,redirect_refused,range_not_satisfiable,bad_content_range,truncatedandtoo_large, and the outputs and bundle routes' own refusalcodewords. Under the fetch and upload codes an undeclared detail is refunded by the old rule, which is right for a transport fault, and if the launcher collapses them intofetch_failedas the brief says nothing changes.file_not_foundis declared only underdataset_fetch_failed; the launcher can also raise it undercode_fetch_failedfor the bundle, where it is undeclared and so refunded by the code, the same answer.outputs_unreadableis declared under bothruntime_errorandresult_upload_failed, because the brief does not say which code carries it; it is charged under either.What I could not do
admin/design/compute-gateway) is not updated: the docs checkout is read-only, so that step stays with the driver.