Repository navigation
feat: declare the runner contract once - #2146
Merged
neuromechanist merged 4 commits intoNov 13, 2026
Merged
neuromechanist merged 4 commits into
neuromechanist merged 4 commits into
Conversation
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR2146Version: 🤖 Updated on each push. |
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.
Declares protocol
nemar.runner.v1once inshared/: the executor, accounting, backend and runner refusal words andrunner_lost(the thirteenth platform failure code, four details) inshared/compute-state.ts; the protocol words, prefixes, header, numbers and the ten request and response zod shapes inshared/contract/compute-runner.ts, with the byte-sharedcompute-runner.schema.json.Requests are strict, responses are open (a claim answer holds at most 32 jobs);
test/compute-runner-contract.unit.test.tspins every word and number, reads the schema back against the constants, and judges a generated corpus of 198 instances by Ajv and zod, which agree on every one.Gates run:
bun run typecheckandbun run lintclean;bunx biome checkon the three named files clean;bun test test/compute-runner-contract.unit.test.ts40 pass;grep -rl "compute-state" test backend/test | xargs bun test1498 pass, 0 fail;test/contract-schemas.test.tspass (compute-runner.ts added to its strict-by-design list, one line).Each test group fails under a one-line mutation (22 mutations run, all killed, reverted).
Not run, would check: the full
bun test, because it is the epic gate.Card DM-04.
Review round 1 fixes (head d133cfd):
The new exemption of
compute-runner.tsintest/contract-schemas.test.ts(a deviation from the card's Scope, needed because its request schemas are strict) now keeps the per-schema protection: the five request names are added to the strict-name set the import guard looks for (pinned length 10 to 15), with probes and a test that each is strict by behavior and that no runner response is in the set.A probe file in
shared/contractthat importedRunnerClaimRequestSchemamade the guard fail, and was removed.The docblock and test name there now list
compute-runner.tsand say why it is exempt.The claim response cannot enforce
jobs.length <= free_slots(a cross-field rule), so the runner must check it; this is now in thecompute-runner.tsdocblock.A claimed job's
cores,gpusandmemory_mbbounds (1-256, 0-8, 1-16777216) are the registration bounds reused; this is an inference, the card does not state them.min_runner_versionstays a strict semver as the card states. Patch note for DM-07: the Worker must answer a version of at most 32 characters.backend/src/services/compute-pipeline.tsbuildsNON_DATASET_FAILURE_WORDSfromPLATFORM_FAILURE_CODES, sorunner_loststops counting against a dataset's cooldown (intended; no backend test pins it; DM-05 and DM-06 authors should know).Gates rerun:
bun run typecheckandbun run lintclean; biome check on the four touched files clean; the compute-state importers 1499 pass, 0 fail; the runner and contract-schemas tests 104 pass, 0 fail.