Repository navigation
Phase D3b: nemar compute submit, logs, results and cancel - #2076
Merged
neuromechanist merged 27 commits intoNov 7, 2026
Merged
neuromechanist merged 27 commits into
neuromechanist merged 27 commits into
Conversation
📦 Package PreviewYour package is ready to test! bun install -g nemar-cli@PR2076Version: 🤖 Updated on each push. |
neuromechanist
merged commit Nov 7, 2026
98266cf
into
feature/issue-2021-epic-compute-users
25 of 27 checks passed
2 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 D3b of epic #2021 (issue #2024): the COMMAND-LINE half of a person's job submission, built on the server half merged in #2073. Base is the epic branch, not
dev.What it adds
nemar compute submit [path] [--entry --dataset --partition --nodes --cores --mem --gpus --time --name --runtime --image --env --wait --dry-run --json] [-- args],logs <job> [--tail n],results <job> [--download dir] [--renew],cancel <job> [--yes].Exit codes (each command's help has an "Exit codes:" block): 0 done, 1 refused by NEMAR / failed / canceled / not signed in, 2 refused on this machine before any job data was sent, 3
--waitended with the job still live. Failures are on standard error;--jsonstandard output is only the answer.src/lib/compute/header.ts: finds the# /// nemar/% /// nemarblock andnemar-job.toml, merges FLAGS, then HEADER, then FILE, then DEFAULTS key by key. The parser itself is the sharedshared/compute-header.ts(A1), not a second one onBun.TOML.parse.pack.ts: one deterministicbundle.tar.gz(sorted, zeroed owner and times, ustar files and folders,Bun.gzipSync, exec bit kept) and its manifest; caps and rule areshared/contract/compute-bundle.tsonly.secret-scan.ts: 12 rules, names andpath:lineonly, exit 2 before any job data is sent, no override.upload.ts: one PUT with exactly the issued headers andContent-Length, three retries on 5xx or no answer.wait.ts: injectable sleep and clock, 5 to 30 s backoff, five-failure cap, Ctrl-C detaches without cancelling.prepare.ts: everything before the first request (so--dry-runsends nothing about the job and needs no sign-in);fail.ts: exit codes and stderr.src/lib/api/compute.ts:submitComputeJob,finalizeComputeJob,getComputeLogs,getComputeResults,renewComputeResults,cancelComputeJob(pinned inapi-export-surface);requestgained a"text"response mode for the log.shared/contract/, no account-copy key, the compute switch is not read.Differences from the issue and the merged D3a code
Bun.TOML.parse);envandimageare flags only.[email protected]); the A1 contract lets an id alone "resolve" in the CLI, but a job againstlatestcannot be repeated and--dry-runis offline.--dry-run --jsonprints the request that would be sent (there is no Worker answer);logs --jsonwraps the text;submit --jsonprints the finalize answer (the submit answer holds the signed upload address, which is never printed).statusexits 1).Tests
Root
bun test test/<file>one file at a time: compute-header-resolve.unit 22, compute-pack.unit 20, compute-secret-scan.unit 47, compute-wait.unit 20, compute-upload.unit 8, compute-results-download.unit 8, compute-submit-cli 39, compute-pack-worker 13, compute-user-e2e-cli 12; neighbours compute-header.unit 56, api-export-surface.unit 14, help-tiers.unit 12, contract-schemas, completion-candidates, compute-read-cli, compute-submit-contract.unit green.bun run lint,bun run typecheck(both) andbun run migrations:d1-checkpass on this head. Not run: the full suite, CI.The e2e spawns the real CLI against the real compute, admin and webhook routers, Miniflare R2, the local S3 interface and the Tapis stand-in: a person granted through the real admin route submits a script with a header and
--waits tofinished, downloads and verifies, submits and cancels a second job, andbalanceshows the charge and the release. Also: a refused hold writes and sends nothing; a late finalize; a 503 after the hold then the same key; Ctrl-C exits 3 and does not cancel; a tampered download is deleted;--jsonpurity; the debug log holds no signature.Mutation runs (each reverted, each caught): header beats flag; a secret rule skipped; CLI cap +1 (caught by the pack unit test and the Worker parity test); Worker policy default +1; shared cap changed; dry-run falls through to sending; scan skipped in the packer;
cancelconfirmation guard removed; tag-only image accepted;..check removed from result paths; checksum not verified; credential sent to the store; upload retry removed; 403 retried; address expiry not checked; wait cap 6; SIGINT listener removed; 4xx retried; backoff never resets; new Idempotency-Key per retry; bearer link printed in the listing; upload without the issued headers; detach exit code 0.Not verified
R2's enforcement of a signed checksum on a presigned PUT (the S3 interface is a stand-in); a Ctrl-C on a real terminal (the test signals the process); Windows paths; the documentation site's command page (docs repository, not touched). Known and not mine:
test/account-copy-parity.test.tsred until website#494's keys reach dev.Review round 1
Fixes on this branch (new commits): results download hardened (
src/lib/compute/download.ts: FileHandle writes,.partand symlink checks, realpath containment, no overwrite of a different file without--force, https and no redirect, connect and stall timeouts, per-fileFAILEDlines, case collisions); unreadable or vanished files are exit 2 naming the relative path; the credential scan also reads UTF-16 and NUL-stripped views and more credential file names; claims reworded to "no job data left this machine" (the notice poll and update check can still run);--waithas a ceiling (job minutes plus 30), treats 429 as transient withRetry-After, aborts a hung read and exits at once on a second Ctrl-C; the upload address is https-only with no redirect and a 5-minute clock margin; the help and ADR say a rerun makes a second job and hold;downloadOneandpackCollectedreturn discriminated results.