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
CommonJS model: loops, switch, short-circuit and try writes are modelled as straight-line #30
Found in the PR #29 round-14 review. The CommonJS value model walks top-level code as straight-line, so a write that may never run replaces the real export, and the file stays modelled with a wrong answer. Only if and logical assignment fork the graph.
Repro: m.js function run(){} exports.run = run; for (const k of []) exports.run = 42; with c.js const {run} = require('./m'); const lib = require('./m'); function go(){ run(); lib.run(); }.
Pre-PR: go → m.js:run (x2).
PR29: no edge, because run is modelled as data 42.
Same with switch arms, cond && (exports.run = 1), ?: and try bodies written after the real write.
Fix direction: fork the graph for these constructs, or treat an exports write inside them as an unmodelled use (Rule 1), which makes the file resolve as pre-PR.
Activity