Skip to content

Phase 6: standalone launch, recipe progress and results report contracts - #2340

Merged
neuromechanist merged 9 commits into
feature/issue-2324-epic-pipeline-progressfrom
feature/issue-2324-local-launch-contracts
Nov 23, 2026
Merged

neuromechanist merged 9 commits into
feature/issue-2324-epic-pipeline-progressfrom
feature/issue-2324-local-launch-contracts

Conversation

@neuromechanist

@neuromechanist neuromechanist commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The three public contracts the standalone launcher (Phase 6, ADR 0134 decision 8) reads and writes, declared once in shared/contract/ as closed zod schemas with hand-written JSON Schemas that nemar-process will copy byte for byte under its existing progress pin. This PR lands first; the nemar-process implementation re-pins to its merge commit.

  • nemar.local-launch.v1 (compute-local-launch.*): the job file a person hands nemar-launch-local --spec FILE. Its runtime, entry, command, args, bundle, image, env and resources, and the oneOf and if/then rules, are the launch specification's own (the JSON Schema members are equal value for value, and the zod schema takes them from LaunchSpecSchema). It drops job_id, api_base, job_token, limits and NEMAR datasets, and adds a required format word and datasets by name (unique, at most 20). A launch specification is refused here and a local one by LaunchSpecSchema.
  • nemar.recipe-progress.v1 (compute-recipe-progress.*): the file a job writes at $NEMAR_OUT/.nemar-progress/progress.json for the launcher to read. The schema describes exactly what nemar-process's launcher reader accepts: a corpus of 60 documents (8 written by nemar-process's recipe layer Tracker at nemar-process 77922f37, the rest mutations of them), each with the verdict of nemar-process's check_recipe_progress at that commit, is replayed through zod (all 60 agree) and Ajv (all agree except the two rules a schema cannot state, a checkpoint named twice and a step in two checkpoints, which zod enforces).
  • nemar.results-report.v1 (compute-results-report.*): the launcher's local report. Its counts, failures and their definitions equal the live progress schema's, its checkpoint map equals the recipe progress file's, result equals the launch specification's $defs/result, and the image reference is the launch specification's, all value for value; zod reuses the same schemas. Every counts object it accepts, neuroschema checkpointCounts accepts.

ADR 0134's decision 9 table gains a row per schema; the CHANGELOG has an Unreleased entry. The three files join the strict-by-design list and their strict schema names join the import guard. Disjoint from shared/compute-recipes.ts and the progress vectors (the parallel Phase 5 N1 PR).

Owner answers (2026-11-23)

  • The schemas live in nemar-cli shared/contract/ and are copied byte for byte into nemar-process.
  • Opt-in --pull verifies with cosign inside a narrow fence window; without it nothing is pulled.
  • Linux is supported; macOS Docker Desktop is documented as unverified.
  • Local Zarr input, the docs.nemar.org guide, and results reports from runners or Tapis are follow-ups; output caps are identical to the service path.
  • Driver decisions on the remaining opens: the cosign trust root lives in a per-run home inside scratch, and --pull is limited to NEMAR's two signed repositories.

Part of epic #2324
Refs nemarOrg/nemar-process#67

Test plan

  • bun test test/compute-local-launch-contract.unit.test.ts test/compute-recipe-progress-contract.unit.test.ts test/compute-results-report-contract.unit.test.ts test/contract-schemas.test.ts test/compute-progress-contract.unit.test.ts test/plugin-manifest-contract.unit.test.ts test/compute-contract.unit.test.ts: 744 pass, 0 fail
  • test/adr-index.unit.test.ts, test/changelog-format.unit.test.ts: 17 pass
  • bun run typecheck, bun run lint, Biome on the changed files: clean
  • Mutations, each turning a test red: the local schema's uniqueItems off (1 fail), zod's dataset-name uniqueness off (1), zod's step uniqueness in the recipe map off (1), the running-path cap 4096 -> 4097 (2), the report's checkpoints/reason oneOf removed (2), the sif-verification rule off (2), the finished-before-started rule off (1)
  • The recipe-progress corpus files pass nemar-process's check_recipe_progress (run on the pinned commit's code)
  • CI
  • Not run: the full bun test (epic to dev gate)

Update (review round 1)

Every finding was accepted and fixed.

  • Important, image.uri rule the report did not enforce: ResultsReportSchema now refuses a @sha256:<hex> suffix that differs from image.digest (issue at image.uri); the case is in the zodOnly corpus. The report's uri description no longer mentions sif; the pin against the launch schema compares the member without its description and checks the report's own wording.
  • Moderate, checkpoints block: failures gets maxProperties: 8 and a zod key-count refine. Zod now requires failures keys to equal the map's checkpoints, each failure's checkpoint to equal its key, and the counts and failures to hold together by progressProblem (reused, not copied; its checkpoints_differ also holds the counts keys to the map). progressProblem takes readonly { checkpoint: string }[] so the map can be passed as is. The rules are named in the docblock, $defs/Checkpoints and the ResultsReport description. ADR 0134's row now says the failure items are the live object's shapes, arranged per checkpoint.
  • Moderate, recipe progress "exactly what the reader accepts": both descriptions now state the encoding rules (UTF-8, no duplicate key, no NaN/Infinity, integers without a fraction).
  • Moderate, service-path descriptions in the local launch schema: preferred option; shared members stay identical and the top-level description (and the docblock) says they describe the service path, with the standalone equivalents --code FILE and --sif-root DIR.
  • Moderate, Ajv strict: false: both tests use { strict: true, strictRequired: false, allErrors: true }; nothing was flagged.
  • Suggestion, duplicated superRefine: refineRunnable(spec, ctx) exported from compute-launch.ts (with SIF_FILE_RE and the shared messages), used by both schemas.
  • Suggestion, dataset bound: LAUNCH_SPEC_MAX_DATASETS is used by the launch spec and LOCAL_LAUNCH_MAX_DATASETS; the test pins the local schema's maxItems to the launch schema's.

Tests: the three new contract tests, contract-schemas, compute-contract, compute-checkpoints, compute-progress-contract and adr-index pass (796 tests); typecheck and Biome clean. Each fix was mutated (rule reverted) and a test failed, then restored. The full bun test was not run (epic -> dev gate).

The nemar-process copies of compute-results-report.v1.json, compute-recipe-progress.v1.json and compute-local-launch.v1.json must be re-copied from this branch.

Update (review round 2)

The round-2 delta review had three items. All were accepted and fixed.

  • Image pin guard: the results report's pin rule runs only when image.digest is well formed, as refineRunnable does. A bad digest gives one issue, at image.digest.
  • Checkpoints block: progressProblem is not read over an empty map. A failure naming a checkpoint the map lacks is now reported once, as failure_checkpoint_differs, not also as "listed under its checkpoint". Zod skips a refinement when a field fails, so both guards are reachable only by calling the refinement directly. To test them, the two refinements are exported as refineResultsReport and refineResultsCheckpoints, and the tests run them with z.any().superRefine(...).
  • Runnable rule paths: one table of tests pins {path, message} for both-entry-and-command, neither, and entry-without-bundle, run against both LaunchSpecSchema and LocalLaunchSpecSchema.

Tests: 805 targeted tests pass, and typecheck and Biome are clean. I removed each guard in turn and a test failed every time. The full bun test was not run.

One refineRunnable and LAUNCH_SPEC_MAX_DATASETS for both specs; local description names --code and --sif-root; strict Ajv. Targeted tests pass.
UTF-8, no duplicate keys, no NaN/Infinity, integers without fraction. Targeted tests pass.
Image uri pinned to digest; failures key bound and keys equal the map; each failure under its key; counts by progressProblem. Strict Ajv. Targeted tests pass.
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

📦 Package Preview

Your package is ready to test!

bun install -g nemar-cli@PR2340

Version: 0.10.40-PR2340.4210dae
Commit: 4210dae


🤖 Updated on each push.

Pin rule only with a well-formed digest; no progress rules over an empty map; a stray failure checkpoint is only failure_checkpoint_differs. Refinements exported for direct tests. Targeted tests pass.
Entry and bundle issues checked on both launch specs. Targeted tests pass.
@neuromechanist

Copy link
Copy Markdown
Contributor Author

Review: r1 code+types+tests+comments, 1 Important, 4 Moderate, 2 Suggestions, all fixed (3aebf3e..d769f91); r2 delta converged with one low and two nits, all fixed (cf29577, 4210dae). Targeted tests rerun on 4210dae: 805 pass, 0 fail. Merging into the epic branch per the phase-to-epic gate; full CI runs at epic to dev.

@neuromechanist
neuromechanist merged commit e8bf3c2 into feature/issue-2324-epic-pipeline-progress Nov 23, 2026
1 check passed
@neuromechanist
neuromechanist deleted the feature/issue-2324-local-launch-contracts branch November 23, 2026 16:28

This branch was previously deployed

1 inactive deployment
npm — 4210daed Deployed Nov 23, 2026 by neuromechanist via publish #4812
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