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

MGS1005: redundant footprint glob

magus doctor found a per-target ctx.writesFiles(...) glob already declared in the project's outputs option. The per-target copy adds nothing.

[MGS1005] 1 per-target magus.outputs glob(s) duplicate a project-wide
declaration; drop the duplicate (see
.../MGS1005.md)
  build: ctx.writesFiles("dist/**") already in project outputs

Why

Outputs are always additive: the project owns its declared outputs, and a target declaring the same glob does not make that output more precise. This is usually copy-paste from a project-wide declaration.

This is a warning, not a load error: a duplicate is a no-op, not a fault.

Resolution

Keep the output declaration in exactly one place, chosen by scope:

  • if the glob is relevant to every target, keep the project-wide sources/outputs and drop the per-target copy;
  • if it is relevant to one target, drop the project-wide declaration and keep ctx.writesFiles(...) in that target's body.
// Before: "dist/**" declared twice - the per-target copy is a no-op.
magus\project({outputs = ["dist/**"]});
export fun build(ctx: magus\Context, args: [str]) > void {
    ctx.writesFiles("dist/**");
    go["go-build"]();
}

// After: one home. Here it affects every target, so keep it project-wide.
magus\project({outputs = ["dist/**"]});
export fun build(ctx: magus\Context, args: [str]) > void { go["go-build"](); }

What this is NOT

  • Not a hard error. The duplicate is a no-op; nothing blocks the build.
  • Not about inputs. An explicit ctx.readsFiles(...) list narrows the target's cache footprint, so repeating a project source there is valid.
  • Not subsumption-aware. This check matches globs exactly. A per-target glob that is subsumed by a broader project-wide pattern (src/config.go under **/*.go) is also redundant but is not flagged here.

See also

  • cache: the three footprint layers and the union model.
  • cache: choosing project-wide vs per-target declarations.
MGS1005magusfilecacheoutputsdoctor
Last updated (3da15dc9)
Earlier changes on this page (4)

Full history ↗ · Blame source ↗

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.

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.

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.

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.

Conventions

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