magus v0.4.2 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:

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

See also

MGS1024magusfileworkspace-providersprojectsprecedence
Last updated (9edeede5)
Earlier changes on this page (2)

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.

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.

Spell

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

Buzz

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

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.

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). See daemon.

Conventions

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