You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug(core): composite propagate() mutates in place — repeat build() of one tree duplicates tags #1032
Found by the #1025 fold-vs-run differential (epic #1019), unrelated to fold — reported separately per that issue's instruction not to paper over real findings.
Symptom
Calling build() on the same source directory more than once in a single process produces different output on the second run — duplicated tags. It reproduces with two build(dir, {fold:false}) calls back to back (no fold involved).
Cause
propagate() in packages/core/src/composite.ts mutates its instance in place rather than returning a copy, so the mutation compounds across repeated builds of the same tree in one process.
Impact
Latent for the normal one-shot CLI (one build per process).
The #1025 differential self-defends: it detects the mismatch via a cheap control comparison and retries only the affected entry with vi.resetModules() (1 of 98 corpus entries needed it — lexicons/aws/examples/docs-snippets). That's a harness band-aid, not a fix.
Fix
Make propagate() (and audit sibling composite methods) copy rather than mutate in place, so build() is idempotent on repeated calls. Add a regression test that builds one tree twice and asserts identical output.
Activity
fix(core): importModule remembers an evaluation failure, so a second …