Internal · Architecture Reference

Viewer Component Model

The browser viewer's JavaScript, drawn the way you'd read a section through a building — each stratum sits on the one below it and never reaches back down. Derived from the actual call graph, not the folder tree.

128 modules 95,756 lines 5 strata 0 circular dependencies viewer/ · measured 2026-08-19

How to read this

A module's stratum is the longest dependency chain beneath it. Stratum 0 modules import nothing from their siblings — they are the bedrock. Nothing in a lower stratum ever calls upward.

4entry
navigate.js61
1 module61 lines
3composition
panels.js2,459 grid_overlay.js1,933 grid_scissors.js707 print_sheet.js618 grid_door_arcs.js543 navigate_engine.js474 +1 more
7 modules7,145 lines
2orchestration
time_machine.js9,244 navigate_find.js5,453 cinema_path_editor.js3,669 scene.js3,065 measure.js1,902 tools.js1,694 schedule_engine.js141 +5 more
12 modules28,763 lines
1services
effects.js8,804 streaming.js2,734 tour.js2,282 doc_canvas.js2,116 dlod_nav.js2,030 schedule_author.js1,704 cpm_schedule.js651 +31 more
38 modules37,208 lines
0bedrock
routewalker.js1,294 schedule_gate.js1,223 import_worker.js1,047 cpe_room_title.js883 import.js854 schedule_editor_ui.js786 nlp.js687 +63 more
70 modules22,579 lines
Datum — loader.js (THREE, OrbitControls) carries 43 of the 128

The headline, and it is not what the bug reports suggest

Two numbers from the same codebase, measured the same afternoon.

Circular dependencies between modules 0

No module pair imports each other. The 5 strata resolve cleanly, so the architecture is sound as drawn.

Largest cycle in the scheduling data 49,436

Elements in one strongly-connected component on Hospital — 78% of the building — inside a dependency graph the engine builds at runtime.

ReadingThe structure is clean; the model inside it is not

An IDE's component view would show you the left-hand number and give this codebase a clean bill of health. The problem this project is actually chasing lives in data the engine constructs at load time — roughly 2.46 million inferred "supports before" relations on Hospital, about 39 per element — which no static tool can see. Worth knowing before investing in tooling that only reads source.

Scheduling subsystem

Thirteen modules, 16,084 lines. This is where 4D lives, and it is the only cluster spanning three strata.

ModuleStratumLinesDepends onRole
schedule_gate.js01,223Physics gates and the generative pass. Depends on nothing — the true bedrock of 4D.
schedule_read_4d.js0268Reads the IFC-native task tables.
foreign_schedule.js0548Imports P6 / MS Project.
export_5d.js0466Cost export.
schedule_diff.js0284Baseline comparison.
schedule_author.js11,704schedule_gateBuilds schedule elements from the DB. Declares the IFC-native tables the source of truth.
cpm_schedule.js1651schedule_gateThe critical-path solver. Where the 49,436-element cycle forms and gets contracted.
schedule_engine.js2141cpm_schedule, schedule_gateZero callers. Built as stage 1 of the current refactor and never wired in.
time_machine.js29,2446 modulesThe Gantt drawer, the 4D clock, the editing surface. 58% of the subsystem in one file.

Call path, load to bar

building .db schedule_author schedule_gate cpm_schedule time_machine Gantt bar

ConsequenceScheduling happens per element; display and measurement happen per group

Hospital schedules 63,182 elements individually, then draws them as roughly 54 bars. One outlier element stretches its whole bar — the effect the code itself calls "one pile, full project length." The same hulls are what the acceptance metric measures, so a stray element registers as a phase-ordering failure. Three symptoms, one cause: the unit of scheduling is not the unit anyone looks at.

Load-bearing modules

Fan-in — how many of the 128 modules call into each. These are the ones where a change reaches furthest.

ModuleExportsCallersBlast radius
loader.jsTHREE, OrbitControls43The 3D datum. A third of the codebase.
kernel_ops.jsKernelOps14Op-log write path — every mutation.
universal_history.jsUniversalHistory8Undo / redo / time travel.
section_cut.jsSectionCut5Clipping planes.
schedule_gate.jsScheduleGate4All of 4D, plus the audit judges.
grid_dims.jsGridDims3Grid geometry.
cpm_schedule.jsCpmSchedule2The live solver.

What an IDE would and would not tell you