Skip to content

fix(build): self-heal stale build.ninja + bump 0.0.58#142

Merged
Sunrisepeak merged 2 commits into
mainfrom
fix/build-graph-stale-selfheal
Jun 21, 2026
Merged

fix(build): self-heal stale build.ninja + bump 0.0.58#142
Sunrisepeak merged 2 commits into
mainfrom
fix/build-graph-stale-selfheal

Conversation

@Sunrisepeak

Copy link
Copy Markdown
Member

Problem

After a dependency package under ~/.mcpp/registry/data/xpkgs/ is
reinstalled/moved but keeps the same version string, mcpp build fails:

ninja: error: '.../cmdline-0.0.1/src/parse.cppm', needed by 'obj/parse.m.o',
       missing and no known rule to make it

The file actually exists — the cached build.ninja is stale. The build
fingerprint doesn't cover registry dep state (dependencyLockHash is empty),
so fp.hex/outputDir are unchanged and try_fast_build reuses the old
graph. That ninja error isn't recognized as "stale", so it hard-fails and the
user has to run mcpp clean by hand.

Fix

Add "missing and no known rule to make" to is_stale_ninja_failure
(src/build/execute.cppm). On that signature, try_fast_build returns
nullopt → the same mcpp build invocation drops to a full graph
regeneration, rewrites build.ninja against the current dep state, and
proceeds. No more manual mcpp clean.

Folding registry dep state into the fingerprint (to skip the regen entirely)
is a larger, riskier follow-up — tracked in
.agents/docs/2026-06-22-mcpp-followups-design.md §T-j.

Version bump → 0.0.58

This is the last PR of the 5-PR follow-up batch, so it carries the version
bump (fingerprint.cppm MCPP_VERSION + mcpp.toml) for the release that
ships:

Merge this PR last.

Test

mcpp build + mcpp test green (22 passed), v0.0.58 compiles clean.

When a dependency package under the registry is reinstalled/moved but keeps
the same version string, the build fingerprint (which does not yet cover
registry dep state) is unchanged, so the cached build.ninja is reused.
Ninja then aborts with 'missing and no known rule to make it' and the build
hard-fails, forcing the user to run `mcpp clean` by hand.

Add that signature to is_stale_ninja_failure so try_fast_build drops to a
full graph regeneration (same invocation) instead of failing — the stale
graph is rewritten against the current dep state and the build proceeds.

(Folding registry dep state into the fingerprint to avoid the regen entirely
is a larger follow-up; see .agents/docs/2026-06-22 §T-j.)
Release carrying the follow-up batch: scanner raw-string fix (#138),
first-run progress (#139), toolchain effective-resolution (#140),
doctor runtime-dep check (#141), and the build.ninja self-heal above.
@Sunrisepeak Sunrisepeak merged commit 49d6cbc into main Jun 21, 2026
3 checks passed
@Sunrisepeak Sunrisepeak deleted the fix/build-graph-stale-selfheal branch June 21, 2026 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant