@@ -288,6 +288,45 @@ std::string canonical_package_build_metadata(
288288 s += pkg.manifest .package .version ;
289289 s += " source=" ;
290290 s += pkg.manifest .package .sourceProvenance ;
291+ // ⭐⭐ WHAT THIS PACKAGE IS BUILT WITH, AND NOT ONLY WHAT IT ASKS THE
292+ // RUNTIME FOR.
293+ //
294+ // Only the root's compile inputs used to reach the fingerprint, through
295+ // `canonical_compile_flags` on the root manifest. A DEPENDENCY's
296+ // `[build] cflags` / `defines` / `sources` / per-glob flags reached
297+ // nothing — so editing one left the fingerprint unchanged, the consumer
298+ // kept the same output directory, and the fast path replayed a
299+ // build.ninja generated before the edit.
300+ //
301+ // ⚠️ AND THE WAY THAT SHOWS IS THAT THE EDIT APPEARS TO HAVE HAD NO
302+ // EFFECT. Measured 2026-08-23 on a path dependency: a flag added to
303+ // `[build] cflags` was absent from the generated `unit_cflags` after a
304+ // rebuild, absent after touching the sources, and present the moment
305+ // `target/` was removed. The first two observations are what a reader
306+ // uses to conclude the flag is being filtered, and one was concluded
307+ // and written down before the third measurement was taken.
308+ //
309+ // The comment beside the root-flag tail merge in prepare.cppm has said
310+ // "canonical_package_build_metadata folds packages[].manifest.
311+ // buildConfig" since before this fix. It now does.
312+ //
313+ // packages[0] is the root, whose flags `canonical_compile_flags`
314+ // already folds; serialising it twice is harmless and keeps this loop
315+ // one rule rather than one rule and an exception.
316+ s += ' ' ;
317+ s += canonical_compile_flags (pkg.manifest );
318+ for (auto const & src : pkg.manifest .buildConfig .sources ) {
319+ s += " src:" ;
320+ s += src;
321+ }
322+ for (auto const & dir : pkg.manifest .buildConfig .includeDirs ) {
323+ s += " inc:" ;
324+ s += dir.generic_string ();
325+ }
326+ for (auto const & dir : pkg.manifest .buildConfig .includeDirsAfter ) {
327+ s += " inca:" ;
328+ s += dir.generic_string ();
329+ }
291330 auto const & runtime = pkg.manifest .runtimeConfig ;
292331 for (auto const & requirement : runtime.requirements ) {
293332 s += " runtime-need:" ;
0 commit comments