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

MGS1015: cross-project dependency names an unresolvable project

A target declared ctx.needs on a target in another project, and the path the alias came from does not resolve to a path inside this workspace.

[MGS1015] workspace://docs: target "ci": ctx.needs names a target in
"../../elsewhere", which does not resolve to a path in this workspace

Why

ctx.needs(agents\lint) says two things: run that target first, and treat the other project as an input to this one. The second half is the one that decays quietly.

The resolved path is unioned into this project's depends_on, and that record is what the affected set is computed from. magus affected walks the dependency edges in reverse: a change to an upstream project marks every project that depends on it. Drop the edge, and that reverse walk no longer reaches here.

The failure is invisible in exactly the way that matters. The build still runs, the target still passes, and CI still goes green. What stops happening is the invalidation: an edit to the upstream project no longer marks this project dirty, so the next run replays a cache hit built against the older upstream. Nothing reports a problem, because from the cache's point of view nothing changed.

That is the same consequence the cross-project output side raises MGS1011 for, which is why this one is a load error too. The cross-project input side can afford a best-effort drop, because an under-declared input only weakens a cache key and errs toward re-running. An under-declared dependency errs toward not running, which is the direction that serves stale results.

Cause

The path written after project/ in the import does not resolve to a location in this workspace. Import paths are always relative to the directory of the magusfile that writes them, so a path is measured from there, not from the workspace root:

// in docs/magusfile.buzz
import "project/guides/integrations/agents" as agents;  // -> docs/guides/integrations/agents
import "project/../libs/textsearch" as textsearch;      // -> libs/textsearch

An import that climbs above the workspace root, or names an absolute path, has no in-workspace answer and lands here.

Resolution

Check the import "project/..." line the alias comes from, and count the ../ segments from the importing magusfile's own directory. Then confirm the target project is one magus actually discovered:

magus ls

If the path resolves but the project is missing from that list, the import is fine and the directory simply is not a project yet: it needs a marker (magusfile.buzz, magus.yaml, or a language marker) and must not sit under an ignored directory such as gen/ or node_modules/. That case is reported separately when the graph is built, as an unregistered dependency.

If you did not mean to depend on another project, drop the alias and name a same-project target instead:

ctx.needs(build);

See also

  • MGS1011 - the same class of failure on a cross-project output
  • MGS1010 - the affected set becoming uncomputable
MGS1015magusfileneedscross-projectloadaffected
Last updated (3e1b75ad)
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.

Ward

A coded diagnostic that inspects a resolved op and nudges or blocks an anti-pattern before it runs. See wards.

Module

A magus stdlib namespace a magusfile imports for host capabilities: filesystem, exec, vcs, and more. See the module reference.

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.

Affected

The set of projects touched by a change; magus affected <target> runs a target only over them. See affected.

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.