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

MGS1024: workspace provider project shadowed by a magusfile

A spell wired with magus\workspace.provider(...) reported a project at a directory that discovery already registered from its own magusfile:

[MGS1024] workspace provider "nx" reported "libs/foo", which already has a
magusfile; the magusfile wins and the provider's configuration for it is ignored

The magusfile wins. This is the same precedence that makes a magusfile target shadow a same-named spell op: the magusfile is the workspace's own definition, so it decides what that directory means.

Why this is a warning, not an error

This is what a migration looks like. You adopt a provider to map a foreign tool's projects, then convert them to real magusfiles one at a time, and every converted directory warns until the provider stops reporting it. Failing the load would make that path unusable.

magus still says it out loud, because the shadowed half is invisible. The project is present and nothing looks wrong, while the sources, outputs and dependencies the provider computed are not the ones in effect.

Resolution

Pick which one owns the directory.

Keep the magusfile (the usual answer during a migration) and stop the provider from reporting that path. For an nx-backed provider, that is an exclude in the provider spell, not a change to the repo:

// skip directories that carry their own magusfile: they have graduated
if (fs\exists("{{root}}/{{p}}/magusfile.buzz")) { continue; }

Keep the provider's model and delete the magusfile, if it was a stub that only existed to make the directory discoverable.

To layer magus-local-development policy onto a provided project without a magusfile in it, use the central form from the root magusfile instead; it applies AFTER the fold, so it composes rather than shadows:

import "magus";

magus\project("libs/foo", { "targets": { "test": { "slots": 4 } } });

See also

MGS1024magusfileworkspace-providersprojectsprecedence
Last updated (895d94e4)
Earlier changes on this page (4)

Full history ↗ · Blame source ↗

Glossary

Workspace

The magus root directory that owns a set of projects and shared config; the unit magus operates over. Workspace in full.

Project

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

Magusfile

The magusfile.buzz that declares a project's targets (as export funs) and binds its spells. Magusfile in full.

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. Target in full.

Op

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

Spell

A language/runtime adapter (e.g. go, md) that maps generic targets onto a toolchain's real commands. Spell in full.

Buzz

The language magusfiles are written in (the .buzz engine). Buzz in full.

CI

An ordinary target you compose yourself with ctx.needs; magus does not hardcode its stages. It is the anchor magus affected ci keys off, and ci strips the rw charm. CI in full.

Slot

One unit of the pool's capacity. A target acquires the slots it needs to run (most take one) and releases them when it finishes; the pool tracks capacity (total slots), running (acquired), and queued (blocked). Slot in full.

Tool

An action a model can call through its host: a name, a description, a typed input and a result. magus serves its tools over MCP, each a read of the workspace model or a run of the CLI it already has. Tool in full.

Conventions

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