← Back to journal

Shared State Can Make Two Declarations One Unit

How atomic closure follows writers and callers without merging every shared helper.

Evidence basisKalu, Korpus, and frozen Ushman source/docs snapshot reviewed September 17, 2026; no new runtime qualification performed
DisclosureEngineering or methodology note based on a September 17, 2026 snapshot. Source-level behavior is not a public availability or universal compatibility claim. Any scenarios are illustrative, not customer outcomes.
Published by Kalu KodeRequest a KodeBack assessment →

Scope: Engineering or methodology note based on a September 17, 2026 snapshot. Source-level behavior is not a public availability or universal compatibility claim. Any scenarios are illustrative, not customer outcomes.

Two declarations can look independent in a bundle while depending on the same mutable module state. Moving one without the other can change the meaning of the program even when both declarations remain syntactically valid.

Kalu’s atomic-state analysis addresses this by following state touches through declaration references. The purpose is not to guess the original file layout. It is to identify units that cannot be separated under the supported static model without leaving unresolved obligations.

Follow the state through the call chain

Consider a synthetic counter, a function that updates it, and another function that calls the updater. Looking only for direct writes in the final function would miss the relationship. State ownership can propagate through callers.

The current implementation computes that propagation to a fixed point and groups declarations that share the relevant state touches. This is a conservative static model. It does not execute arbitrary JavaScript to discover every possible effect, and unknown effects can remain blockers.

A shared pure helper is different

Now imagine two independent stateful units that both call a pure formatting helper. The shared helper does not, by itself, mean the two state domains must be merged. Treating every common dependency as shared mutable state would create unnecessarily large, unusable units.

The Ushman harvest notes preserve both lessons: propagate real state relationships and avoid merging independent units merely because they use the same pure helper. Negative examples are important on both sides of the boundary.

The unit is not yet a package

Even a complete atomic selection does not establish that the unit belongs to a particular dependency. It does not create an install pin or authorize publication. Ownership evidence, source rederivation, certification, and the applicable product workflow remain separate.

For a recovery assessment, this helps explain why a visually small extraction may be blocked while a larger one is admissible. The meaningful boundary follows state and effects, not the number of lines highlighted in an editor.

This article describes bounded source-level analysis, not a general proof of arbitrary JavaScript behavior. The value is making the hidden relationship explicit enough to review. A recovered module boundary should be justified by what the declarations must preserve together, not by how tidy the resulting folder would look.