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

MGS1045: a magus\guard.spawn, command or write registration is unusable

The root magusfile registers a spawn, command or write rule in a way magus cannot use:

[error] [MGS1045] magus\guard.spawn: already registered in this magusfile; a workspace
has one such rule, so fold the second one into the first

Why

magus\guard.spawn, magus\guard.command and magus\guard.write each hand the agent guard one function to call on every spawn, every shell command, or every file write. A registration that is ignored is worse than none: the workspace reads as guarded and nothing is judged. So each of these stops the load instead:

  • the argument is not a function;
  • a second call to the same member in the same load, which would leave it unclear which rule runs;
  • a call from a project's magusfile rather than the workspace root's, since the rule answers for every agent in the workspace.

What to do

Register exactly one function per member, from the root magusfile.buzz. To combine several checks, call them from that one function and return the strictest answer. See magus\guard.spawn and magus\guard.command.

MGS1045magusfileguardagentsspawncommandwrite
Last updated (cc2ee2ea)
Earlier changes on this page (1)

Full history ↗ · Blame source ↗

Glossary

Workspace

The magus root directory that owns a set of projects and shared config; the unit magus operates over. See workspace.

Project

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

Magusfile

The magusfile.buzz that declares a project's targets (as export funs) and binds its spells. 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.

Buzz

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

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

This page uses none of the site's convention markers. The full set is on the conventions page.