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

MGS3020: preflight failed

magus run and magus affected take --preflight <target>[,<target>...]. The named targets run first, as a separate pass across every selected project, before the invoked target starts anywhere. One of them failed, so nothing else ran and the command exits 3.

The first line names the target, the failing projects and the command to run next. Each failure's own first line follows it:

[MGS3020] preflight generate failed in docs, proto; fix with `magus run generate:rw docs`; reproduce with `magus run generate proto`
  docs:generate: docs: generate left declared output stale; re-run with the rw charm (generate:rw) and commit:
  proto:generate: generate failed in proto: buzz: uncaught error: ...
  see: https://eli.gladman.cc/magus/reference/codes/sandbox/MGS3020/

A project whose failure is drift (the target left declared output stale) gets the rw form, magus run <target>:rw <projects>, because regenerating and committing is the fix. Any other failure gets the plain form, which reproduces it.

What stops, and when

The pass admits steps with a failure budget of one, the same mechanism max_failures: 1 uses. The first failure stops admission and cancels the preflight steps still in flight; none of the invoked target is admitted afterwards. The per-target lines above the error are each failing step's own report, with its captured output.

With magus affected <target> --plan, the pass runs across the planned projects before the plan prints, and a failure prints no plan at all, so a workflow that fans shards out from it starts none.

Exit 3 is kept apart from 1 so a CI script can tell the cheap check failing from the fan-out failing.

Resolution

  1. Run the command the first line names. For drift, commit what it regenerated.
  2. Re-run the original command. A green preflight pass is cached like any other run, so the second attempt pays only for what changed.

See also

  • MGS3021: a --preflight target the invoked target never reaches.
  • Targets: using --preflight before a CI fan-out.
MGS3020preflightcifail fastdriftgenerateexit 3
Last updated (f41fc67b)
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.

Ward

A coded diagnostic that inspects a resolved op and nudges or blocks an anti-pattern before it runs. See wards.

Buzz

The language magusfiles are written in (the .buzz engine). See engines.

Cache

The content-addressed store magus consults before running a target, so unchanged work is skipped. See cache.

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.

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.