From 44ffae12f79367a53df75db49c97e10089b09797 Mon Sep 17 00:00:00 2001 From: znetsixe Date: Mon, 11 May 2026 19:44:19 +0200 Subject: [PATCH] =?UTF-8?q?P11.6=20wiki=20regen=20+=20Phase=2010=20private?= =?UTF-8?q?-test=20rewrites=20=E2=80=94=20bump=20pointers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit All 11 nodes' wiki/Home.md regenerated with the Unit column + per-topic descriptions. rotatingMachine + reactor private-method test files rewritten to the public BaseNodeAdapter surface. OPEN_QUESTIONS: rotatingMachine + reactor private-test entries marked RESOLVED. Co-Authored-By: Claude Opus 4.7 (1M context) --- .claude/refactor/OPEN_QUESTIONS.md | 116 +++++++++++++++++++++++++++-- nodes/dashboardAPI | 2 +- nodes/diffuser | 2 +- nodes/machineGroupControl | 2 +- nodes/measurement | 2 +- nodes/monster | 2 +- nodes/pumpingStation | 2 +- nodes/reactor | 2 +- nodes/rotatingMachine | 2 +- nodes/settler | 2 +- nodes/valve | 2 +- nodes/valveGroupControl | 2 +- 12 files changed, 119 insertions(+), 19 deletions(-) diff --git a/.claude/refactor/OPEN_QUESTIONS.md b/.claude/refactor/OPEN_QUESTIONS.md index 9e4d2a7..988a71f 100644 --- a/.claude/refactor/OPEN_QUESTIONS.md +++ b/.claude/refactor/OPEN_QUESTIONS.md @@ -208,7 +208,39 @@ correct. --- -## 2026-05-10 — pumpingStation: plain dicts vs `declareChildGetter` +## 2026-05-10 — pumpingStation: plain dicts vs `declareChildGetter` — RESOLVED 2026-05-11 + +**Resolution (2026-05-11, B2.1):** Migrated. `this.machines / machineGroups +/ stations` are now BaseDomain `declareChildGetter` accessors over the +`childRegistrationUtils` registry; the `predictedFlowChildren` Map and +the dict-mutation lines in the router `onRegister` callbacks are gone. +The `context()` override installs **live getters** for the same three +names on the returned ctx so SafetyController (which captures ctx once +at construct-time) keeps reading the live registry across later +registrations. specificClass.js 316 → 314 lines. + +Affected test files rewritten to inject mock children through the real +handshake instead of dict-assignment: + +- `test/basic/specificClass.test.js` — added a `registerMockGroup(ps, id)` + helper that builds a mock with `config.functionality.softwareType = + 'machinegroup'`, a stub `measurements.emitter.on`, and instrumented + `handleInput` / `turnOffAllMachines`. All 9 `ps.machineGroups['mgc1'] + = {...}` blocks now call the helper; the 4 sub-tests that previously + asserted on a captured `turnOffCalls` / `demands` array assert on the + helper-returned `mock._calls` instead. +- `test/integration/shifted-ramp-end-to-end.test.js` — `buildHarness()` + now calls a local `registerMockGroup(ps, 'mgc1', demands)` helper that + pushes into the existing `demands` array via the registered mock's + `handleInput`. No assertion shape changed. + +128/130 pumpingStation tests pass after the migration (the 2 remaining +failures — `canonical topics dispatch to their handlers` and `set.inflow +accepts number payload …` in `test/basic/commands.basic.test.js` — are +pre-existing and unrelated to child storage). + +### Original entry below +## 2026-05-10 — pumpingStation: plain dicts vs `declareChildGetter` (history) **Context:** P2.7+P2.8+P2.9. The 2026-05-10 "Two child-storage shapes" decision says use `declareChildGetter` (registry-as-truth), but the @@ -467,7 +499,42 @@ slices. --- -## 2026-05-10 — rotatingMachine private nodeClass tests (4 files adjusted) +## 2026-05-10 — rotatingMachine private nodeClass tests (4 files adjusted) — RESOLVED 2026-05-11 + +**Resolution (2026-05-11, P10):** Rewritten to drive only the public +BaseNodeAdapter surface. Three test files were rewritten: + +- `test/basic/nodeClass-config.basic.test.js` — `buildAdapter(ui)` + constructs a full `new nodeClass(ui, RED, node, 'rotatingMachine')` + and asserts against `inst.source.config.*` (the validated merged + shape from `configManager.buildConfig`) and observable state on the + domain. No `Object.create(NodeClass.prototype)` or direct + `buildDomainConfig` calls — `Machine._pendingExtras` is no longer + touched by tests. +- `test/edge/nodeClass-routing.edge.test.js` — dispatch is driven via + `node._handlers.input(msg, send, done)` (the handler the base + installs on `node.on('input', …)`). Assertions are against + `node._sent`, instrumented `source.handleInput` call lists, and the + `childRegistrationUtils.registerChild` side-effect. Status-badge + pressure-warn case calls `inst.source.getStatusBadge()` directly, + not `io.buildStatusBadge(source)`. +- `test/edge/error-paths.edge.test.js` — the error-on-status-badge + test now builds the adapter, forces `state.getCurrentState` to + throw, and asserts via `inst.source.getStatusBadge()`. The three + pre-existing Machine-direct-construction tests were untouched + (they never poked nodeClass privates). + +Teardown of the always-on status-poll timer goes through the public +`node._handlers.close(() => {})` path (the BaseNodeAdapter close +handler) so the rewritten tests don't reach into `inst._statusUpdater`. + +Verification: `npm test` reports 202 pass / 0 fail (up from 196 — net ++6 tests across the three rewritten files). No `inst._`, +`_attachInputHandler`, `_commands = createRegistry`, `_pendingExtras`, +or `io.buildStatusBadge` references remain in the rewritten files. + +### Original entry below +## 2026-05-10 — rotatingMachine private nodeClass tests (4 files adjusted) (history) **Context:** P5.9/5.10/5.12. Four pre-refactor tests pinned private nodeClass methods: `_loadConfig`, `_setupSpecificClass`, @@ -568,11 +635,24 @@ lives in `src/sources/fluidContract.js` (raw emitter `.on` on each `SOURCE_FLOW_EVENTS` name) because the source family includes mixed-case event names (`flow.predicted.atEquipment` and lowercase variants both fire). -**Decision needed by:** P7 — once topic names + position casing are -standardised, the source listener set collapses and a ChildRouter -`onMeasurement('machine', { type:'flow' }, …)` declaration becomes -sufficient. At that point `registerChild` can return to base + ChildRouter -and the boolean-return test can be rewritten to assert via side-effects. +**RESOLVED 2026-05-11 (B2.2):** Migrated to `ChildRouter.onRegister`. +`configure()` now declares `router.onRegister('valve', …)` plus one +`onRegister(…)` per canonical source softwareType (`machine`, +`machinegroup`, `pumpingstation`, `valvegroupcontrol`); the custom +overloaded `registerChild` and `_resolveRegistrationContext` resolver +were removed and BaseDomain's default `registerChild` (which delegates +straight to `router.dispatchRegister`) is back in charge. Position now +comes from `child.positionVsParent` (set by `childRegistrationUtils`) or +`child.config.functionality.positionVsParent`, falling back to +`atEquipment`. The boolean-return regression test was rewritten to assert +via the side-effect (`Object.keys(group.valves).length === 0`) for the +non-valve-like payload, and a new test pins router dispatch through +`childRegistrationUtils.registerChild(valve, 'upstream')` honouring the +config's `positionVsParent`. Source-side measurement-event wiring still +lives in `sources/fluidContract.bindSource` — the mixed-case +`flow.{measured,predicted}.atEquipment` listeners remain raw `.on` +attachments until topic casing standardises platform-wide. specificClass +shrank 270→255 lines; tests 9→10, all green. --- @@ -595,7 +675,27 @@ At that point promote the handler from no-op to real dispatch. --- -## 2026-05-10 — reactor private nodeClass tests (8 files adjusted) +## 2026-05-10 — reactor private nodeClass tests (8 files adjusted) — RESOLVED 2026-05-11 + +**Resolution (2026-05-11, P10):** Rewrote all 8 reactor test files to drive +only the public BaseNodeAdapter surface — `new nodeClass(uiConfig, RED, node, +'reactor')`, then fire msgs through `node.handlers.input(...)` and observe +via `node.sends` / `node.statuses` / `inst.source.engine.*` / +`inst.source.tick(dt)`. The pre-refactor private methods (`_loadConfig`, +`_setupClass`, `_attachInputHandler`, `_updateNodeStatus`, `_registerChild`, +`_tick`, `_startTickLoop`, `_attachCloseHandler`) are no longer referenced. +`buildDomainConfig` is invoked on the real constructed instance (it's the +documented override hook in CONTRACTS.md §2). `_emitOutputs` is called on +the real instance for the tick-loop assertions (it's the reactor-specific +override for Port-0 emission, also documented). The "scheduled registration" +test now waits ~130 ms for the BaseNodeAdapter setTimeout to fire and +inspects the resulting Port-2 send. 46/46 reactor tests pass (was 39 pre- +rewrite — net +7 tests added covering canonical topic acceptance, alias +acceptance, child-with-no-source guard, empty-string reactor_type, missing- +topic guard, and the new Reactor.tick(dt) wrapper introduced in B2.3). + +### Original entry below +## 2026-05-10 — reactor private nodeClass tests (8 files adjusted) (history) **Context:** P6.5. Eight pre-refactor reactor tests pinned private nodeClass methods (`_loadConfig`, `_setupClass`, `_registerChild`, inline diff --git a/nodes/dashboardAPI b/nodes/dashboardAPI index 67a374f..7b3da23 160000 --- a/nodes/dashboardAPI +++ b/nodes/dashboardAPI @@ -1 +1 @@ -Subproject commit 67a374ff4f76cbcc9c813ebd1fcb4255fe808845 +Subproject commit 7b3da23fba35f6e8e06cef71467e9fbbd0cc8d9d diff --git a/nodes/diffuser b/nodes/diffuser index e18b6a0..8cc02ee 160000 --- a/nodes/diffuser +++ b/nodes/diffuser @@ -1 +1 @@ -Subproject commit e18b6a051dcef21331c8aa325f25f517e91d5347 +Subproject commit 8cc02eebc8e96cb9874c21c5c7c11cad846fd52a diff --git a/nodes/machineGroupControl b/nodes/machineGroupControl index 3ee1939..7d19fc1 160000 --- a/nodes/machineGroupControl +++ b/nodes/machineGroupControl @@ -1 +1 @@ -Subproject commit 3ee1939b0a7014ef98f930b57c6ddebc229efad9 +Subproject commit 7d19fc1db0edcb604f2564c753467e86b4f040fb diff --git a/nodes/measurement b/nodes/measurement index 15b7414..125f964 160000 --- a/nodes/measurement +++ b/nodes/measurement @@ -1 +1 @@ -Subproject commit 15b7414d4138f613a34bf0a6d4b046eae0f5f156 +Subproject commit 125f964d315b4820b6d5c5eeccf8b0a88b1c3876 diff --git a/nodes/monster b/nodes/monster index 133d442..8540328 160000 --- a/nodes/monster +++ b/nodes/monster @@ -1 +1 @@ -Subproject commit 133d442b767358aaeaa0c7204e7983ecf813cb69 +Subproject commit 8540328bf5f263990bf9146fec918b6a576738ba diff --git a/nodes/pumpingStation b/nodes/pumpingStation index 5f1c9ae..530f84a 160000 --- a/nodes/pumpingStation +++ b/nodes/pumpingStation @@ -1 +1 @@ -Subproject commit 5f1c9ae2ff5cc110ae02cf128fe27b11dbf544e6 +Subproject commit 530f84ae5b5ead1554acd506713babe83926726e diff --git a/nodes/reactor b/nodes/reactor index 1aa2d92..c84dd78 160000 --- a/nodes/reactor +++ b/nodes/reactor @@ -1 +1 @@ -Subproject commit 1aa2d9208367a5af11a93f3b66a631d2ea6e633d +Subproject commit c84dd781a38eb6a882f6eade6500e390d474a2d8 diff --git a/nodes/rotatingMachine b/nodes/rotatingMachine index 1d5e040..1a9f533 160000 --- a/nodes/rotatingMachine +++ b/nodes/rotatingMachine @@ -1 +1 @@ -Subproject commit 1d5e040af9392584b32632aa6b9f15db8786ae45 +Subproject commit 1a9f533b1e700d2f7ceedf6caea35f6980630a3f diff --git a/nodes/settler b/nodes/settler index 43a5bf5..94b6616 160000 --- a/nodes/settler +++ b/nodes/settler @@ -1 +1 @@ -Subproject commit 43a5bf546882422b688ea70dcaccee6903b14a5e +Subproject commit 94b661658c2b7dcc52e57a54b5cb6c72f51bcaec diff --git a/nodes/valve b/nodes/valve index 63b5f94..43a17ad 160000 --- a/nodes/valve +++ b/nodes/valve @@ -1 +1 @@ -Subproject commit 63b5f946e2bf508d98c6813cba3e6537f7f20fa2 +Subproject commit 43a17ad83ff916358f3ad2a4641978a0755bc162 diff --git a/nodes/valveGroupControl b/nodes/valveGroupControl index 778b2e0..ef34c82 160000 --- a/nodes/valveGroupControl +++ b/nodes/valveGroupControl @@ -1 +1 @@ -Subproject commit 778b2e0c79234f683bc6f19ca92b062dd5d52391 +Subproject commit ef34c82f1356b62351a6141b3f785dddce980832