magus v0.4.3 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.
import "magus";

// 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 (8b20a199)
Earlier changes on this page (6)

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. 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.

Buzz

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

Cache

The content-addressed store magus consults before running a target, so unchanged work is skipped. Cache 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.

Conventions

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