magus v0.4.3 is out. See what's new
¶ View markdown source · ✎ Suggest an edit
1 min read

MGS3029: saved plan refused

magus run --stdin runs the shards of a plan that magus affected <target> --plan printed, piped in or redirected from a file. The plan decides the target and the projects, so anything that would make the run cover a different set from the one the plan describes is refused before a target starts, and the invocation exits 2, the misuse status.

[MGS3029] --shard 9: the plan has no such shard (it has 0, 1, 2)
  see: https://eli.gladman.cc/magus/reference/codes/sandbox/MGS3029/

It fires for:

  • A malformed plan. Stdin is a terminal, empty or not JSON, or the plan has no target (one printed by a magus older than the key), repeats a shard id, has a shard with no projects, or states a count that disagrees with its matrix.
  • A shard the plan does not have. --shard names a shard id from the plan's matrix. An inherited plan has no shards at all, so every --shard is refused.
  • A different target. magus run test --stdin < plan.json against a plan for ci. The target positional is optional with --stdin; give it only to add charms, as in ci:gha.
  • A different shard count. --n-shards is implied by the plan. A value that disagrees means the caller and the plan describe different matrices.

Each would otherwise run less than the plan, or something other than the plan, and still exit 0.

Resolution

  • Regenerate the plan with the magus that will run it: `magus affected --plan

    plan.json`.

  • Pick a shard id from the plan's matrix. magus run --stdin --dry-run < plan.json prints each shard's command without running it.
  • Drop --n-shards, or the target positional, and let the plan supply them.

See also

MGS3029planshardrun --stdinaffected --planCI matrixexit 2
Last updated (c5971189)
Glossary

Project

A directory magus recognizes as a unit of work (it has a magusfile); the unit of caching, scheduling, and dependency tracking. See workspace.

Target

A named operation (build, test, ...) you invoke with magus run <target>; it may compose a spell's tool-native operations and depend on other targets. See targets.

Op

A single tool-native command a target composes (long form: operation); the middle of the work hierarchy (Spell to Op to Target). See operations.

Charm

An execution modifier attached with : (lint:rw) that changes how a target runs, not which one; the built-in rw flips a check-only target to mutate in place, and ci always strips it. See charms.

Affected

The set of projects touched by a change; magus affected <target> runs a target only over them. See affected.

Sandbox

The restricted filesystem and environment a target runs in, so builds stay reproducible and side-effect-free. See sandbox.

CI

An ordinary magusfile-defined target you compose yourself with magus\needs - magus does not hardcode its stages. Magus.RunCI treats it specially only in that it strips the rw charm, it is the anchor magus affected ci keys off, and a selected scope with no project declaring it is a load error rather than a silent no-op. See targets.

Invocation

One magus process's recorded facts - the targets it finished, their outcomes, the lease it acted as, and the session it ran in when a host delivered one - kept in a repo-scoped store every worktree shares. magus session lists them; the store prunes itself by last-fact age.

Job

The unit of delegated work, and one row of the job store: what an orchestrating agent handed out, with its goal, the checkpoint it was cut against, the paths it may write or must not touch, and the one check it runs. A job's holder is either a session, for work an orchestrator handed out, or the server, for its own maintenance. The store records; the agent guard is what reads those facts back when grading a write. See doctrine.

A job is not a run. magus run build web is a run, and no job exists for it. A job causes runs: its check executes as one, and a server job records the invocation of its last one. Jobs are listed with magus ls jobs and in the console's Jobs view; runs are listed in the Runs view.

Run

One target executing under one magus invocation, such as magus run test web or magus affected ci. A run keeps its captured output behind an output reference. Every magus run is a run whether or not any job asked for it; see Job for how the two relate.

Conventions

Placeholders

Angle brackets mark a value you replace with your own - never type the brackets:

magus run <target>
magus completion <shell>    # e.g. bash, zsh, fish

<target>, <path>, <shell>, <name> and the like are stand-ins, not literal text.