Repository navigation
Description
Since 2026.11.19.1 (#953 D5) a package instance's objects lie in obj/<package>/<digest>/. The design record (.agents/docs/2026-11-19-ecosystem-rule-convergence-design.md §11.1) says that the digest covers the factors that decide a unit's command: the package's active features and defines, the declarations of the members that are roots, and the digests of the packages it depends on. The implementation also hashes each unit's object path (src/build/plan.cppm, own[cu.packageName] += cu.object.generic_string() + "\n" + flags_text(cu)), so the digest also depends on which units the package has.
mcpp test keeps a package's base sources that an inactive feature gates (features.cpp, the gtest case: "an inactive gate must not make it vanish"), and mcpp build drops them. Under mcpp test the package therefore has more units, its digest differs, and every unit is compiled again in a second directory, including the units whose command is the same in both plans apart from that directory.
Minimal reproduction (mcpp 2026.11.20.1, Linux x86_64, gcc 16.1.0)
mcpp.toml
src/a.cppm
src/b.cppm
tests/t.cpp
app/mcpp.toml
app/src/main.cpp
mcpp.toml:
[package]
name = "lib"
version = "0.1.0"
[build]
sources = ["src/a.cppm", "src/b.cppm"]
[features]
b = { sources = ["src/b.cppm"] }
[targets.lib]
kind = "lib"
[workspace]
members = ["app"]src/a.cppm: export module lib.a; export int a() { return 1; }
src/b.cppm: export module lib.b; export int b() { return 2; }
tests/t.cpp: import lib.a; int main() { return a() == 1 ? 0 : 1; }
app/mcpp.toml depends on the root with lib = { path = ".." }, and app/src/main.cpp imports lib.a. Without a workspace the root's units keep obj/ and the effect does not occur.
$ mcpp build # .ninja_log: the compiled objects
obj/lib/50ad061f/src/a.m.o
$ mcpp test
obj/lib/dba9c925/src/a.m.o <- compiled again
obj/lib/dba9c925/src/b.m.o <- the gated unit test keeps
obj/lib/dba9c925/tests/t.o
$ mcpp build && mcpp test # 0 edges: both instances are kept, as #953 intendsThe two commands for src/a.cppm (ninja -t commands on build.ninja and test.ninja) differ only in paths that are derived from the instance:
< obj/lib/50ad061f/src/a.m.o > obj/lib/dba9c925/src/a.m.o
< "gcm.cache/lib/50ad061f/lib.a.gcm" > "gcm.cache/lib/dba9c925/lib.a.gcm"
< -fmodule-mapper=modmap/lib-0e2927eb.map > -fmodule-mapper=modmap/lib-435b4120.map
Control: remove the [features] table and the gate is gone. mcpp build then compiles obj/lib/dba9c925/src/a.m.o and b.m.o, and mcpp test afterwards compiles only tests/t.o. The same instance serves both commands.
Why it matters
mcpplibs/boost-m (Boost 1.92.0 as modules, mcpp 2026.11.20.1). Its [build].sources lists every library, and each library's sources are gated by its feature, so that mcpp test on a CI leg builds every library's tests while mcpp build --features <group> builds only the group. On one leg (gcc 16.1.0, x86_64 Linux, MCPP_JOBS=4):
mcpp build --features <group A>: 352 objects of the package, in one instance;mcpp test --features <group A>: 359 objects, in another instance. The 7 extra units are the module interfaces of the libraries outside group A. All 352 others are compiled again, with the same commands. The test step takes 920 s in all, and the package's share of it is the part that could have been reused.
Workspace members that depend on the package with the group's features forwarded (mcpp test -p <member> --features lib/<f>,...) get the mcpp build instance and compile nothing of the package (10 s and 5 s). The duplicate is only between the root's two commands.
Expected
As the design record states the digest: a unit's object path depends on what decides its command. A package whose commands are equal in two plans keeps one instance whatever units each plan adds or drops, so mcpp test here compiles only src/b.cppm and tests/t.cpp. Two possible ways:
- leave the object paths out of the digest, so that it covers the units' flags and include directories (
flags_text, as a set rather than per unit), the features and the dependencies' digests; - or compute the directory from the per-unit command, so that only units whose command differs move.
The first one keeps a package's units in one directory per configuration, which clean --stale and clean --report read.
Activity
fix: a package's instance is a function of its configuration, not of …
feat: a package whose sources are named runs its build program in the…
2026.11.21.1: the test and CI design (mtest 0.11), the home's unit ca…
speak-agent commentedon Nov 22, 2026
Released in mcpp 2026.11.21.1 (#984): a package's instance is a function of its configuration, not of its units, so a test build after
mcpp buildno longer compiles the package again, and each refusal of the cache names its reason. A path enters a cache key by its role, and a cacheable package's build program runs into the home'sbuild-cache/v1/out. The cache key carries the instance, so a dependency an earlier release cached is compiled once more after the upgrade and served from then on.