docs: standards cleanup — single front-door CONTRACTS.md + archive stale plan artifacts

Establish CONTRACTS.md at the EVOLV root as the canonical map of where every
contract, rule, and standard lives. Surface it from CLAUDE.md so every fresh
agent or colleague lands there first.

Reshape .claude/refactor/ to reflect that the platform refactor is done:
live standards stay at the top level; the plan artifacts (CONTINUE_HERE.md,
TASKS.md) move into Archive/ with WARNING banners.

Drop content that drifted out of date or duplicated the new standards stack:
- docs/DEVELOPER_GUIDE.md (pre-refactor walkthrough; superseded by
  wiki/Architecture, wiki/Getting-Started, .claude/rules/node-architecture,
  .claude/refactor/MODULE_SPLIT + per-node CONTRACT.md + src/commands/).
- .agents/decisions/ (15 DECISION files): load-bearing decisions belong in
  commit messages and PR descriptions; live open items in OPEN_QUESTIONS.md.
- .agents/improvements/TOP10_*.md: moved to Archive/.

Bump generalFunctions to 49c77f2 — adds CONTRACT.md inside the library:
different shape from per-node CONTRACT.md files (library API, not msg.topic),
with stability tags and pointers to .claude/refactor/CONTRACTS.md §N.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rene De Ren
2026-05-18 15:48:46 +02:00
parent 560cc2f39a
commit 253ac93896
26 changed files with 210 additions and 1278 deletions

View File

@@ -0,0 +1,53 @@
# Top 10 Production Priorities (Round 2, Availability-First)
Context:
- Generated after implementing the first top-10 and follow-up items `IMP-20260219-011/012/013`.
- Focus remains: keep runtime up, prefer degraded/null outputs over hard failures.
## Priority List
1. Fix measurement outlier toggle corruption.
- Why: toggling replaces the outlier config object with a boolean, breaking later config reads.
- Evidence: `nodes/measurement/src/specificClass.js:509`.
2. Fix rotating machine pressure-difference unit request API mismatch.
- Why: `difference('Pa')` no longer matches container API; requested unit is ignored, risking incorrect efficiency basis.
- Evidence: `nodes/rotatingMachine/src/specificClass.js:856`, `nodes/generalFunctions/src/measurements/MeasurementContainer.js:436`.
3. Guard reactor PFR state indexing at boundary conditions.
- Why: known edge behavior can overrun index mapping near exact reactor length and destabilize updates.
- Evidence: `nodes/reactor/src/specificClass.js:326`.
4. Make dashboard template resolution fail-soft.
- Why: missing template currently throws and aborts dashboard generation path.
- Evidence: `nodes/dashboardAPI/src/specificClass.js:91`.
5. Make dashboard input path skip invalid children instead of throwing.
- Why: missing child source/config currently throws; should warn and continue in availability-first mode.
- Evidence: `nodes/dashboardAPI/src/nodeClass.js:55`.
6. Harden shared config merge semantics for arrays/types.
- Why: recursive merge mutates destination and treats arrays as objects, risking config drift.
- Evidence: `nodes/generalFunctions/src/helper/configUtils.js:77`.
7. Fix machineGroupControl child position source path.
- Why: reads `positionVsParent` from `general` instead of `functionality`, causing inconsistent routing metadata.
- Evidence: `nodes/machineGroupControl/src/specificClass.js:53`.
8. Accept numeric-string measurement payloads safely.
- Why: measurement node currently ignores numeric strings common in PLC/edge integrations.
- Evidence: `nodes/measurement/src/nodeClass.js:167`.
9. Fix reactor editor save wiring mismatch.
- Why: editor save hook references the wrong node helpers, risking mis-saved position settings.
- Evidence: `nodes/reactor/reactor.html:133`.
10. Replace raw `structuredClone` usage with compatibility-safe clone strategy.
- Why: runtime portability risk across constrained Node-RED deployments.
- Evidence: `nodes/settler/src/specificClass.js:34`, `nodes/settler/src/specificClass.js:45`.
## Implementation Status
- Implemented on 2026-02-19 in current session.
- Verification: tests passed for `generalFunctions`, `measurement`, `reactor`, `rotatingMachine`, `dashboardAPI`, `machineGroupControl`, `settler`, `pumpingStation`, `valve`, `valveGroupControl`, `monster`.
- Follow-up architectural items are tracked in `.agents/improvements/IMPROVEMENTS_BACKLOG.md`.

View File

@@ -0,0 +1,63 @@
# Top 10 Production Priorities (Availability-First)
Context:
- Scope reviewed: all nodes under `nodes/*` plus shared `nodes/generalFunctions/*`.
- Target posture: keep runtime alive; emit `null`/degraded outputs instead of crashing.
## Priority List
1. Remove import-time executable code from machine group runtime module.
- Why: `makeMachines()` runs at module load and can execute demo logic in production runtime.
- Evidence: `nodes/machineGroupControl/src/specificClass.js:1294`, `nodes/machineGroupControl/src/specificClass.js:1399`.
- Availability target: no side effects on `require`; test/demo code must be isolated from runtime path.
2. Guard `registerChild` in node wrappers to prevent null dereference crashes.
- Why: multiple wrappers dereference `childObj.source` without checking child existence.
- Evidence: `nodes/reactor/src/nodeClass.js:54`, `nodes/settler/src/nodeClass.js:39`, `nodes/valve/src/nodeClass.js:256`, `nodes/valveGroupControl/src/nodeClass.js:178`, `nodes/machineGroupControl/src/nodeClass.js:215`.
- Availability target: if child missing, log warning and continue.
3. Harden shared child registration utility contract checks.
- Why: shared helper destructures `child.config.*` without validation.
- Evidence: `nodes/generalFunctions/src/helper/childRegistrationUtils.js:9`, `nodes/generalFunctions/src/helper/childRegistrationUtils.js:10`.
- Availability target: reject invalid child payload with warning, no throw.
4. Add global input-handler error boundary pattern across nodes.
- Why: many handlers do work without `try/catch`; one thrown error can bubble and destabilize node behavior.
- Evidence: `nodes/measurement/src/nodeClass.js:156`, `nodes/valve/src/nodeClass.js:250`, `nodes/valveGroupControl/src/nodeClass.js:169`, `nodes/settler/src/nodeClass.js:32`.
- Availability target: wrap topic routing; map failures to warning + safe `done(err)`/`done()` handling.
5. Normalize `done` callback handling for Node-RED compatibility.
- Why: several nodes call `done()` unguarded; older/inconsistent runtime callbacks can fail.
- Evidence: `nodes/measurement/src/nodeClass.js:167`, `nodes/valve/src/nodeClass.js:280`, `nodes/valveGroupControl/src/nodeClass.js:201`, `nodes/machineGroupControl/src/nodeClass.js:257`.
- Availability target: `if (typeof done === 'function') done();` everywhere.
6. Fix reactor runtime routing and setup defects.
- Why: `Temperature` topic routes to missing setter path and default reactor warning references wrong variable.
- Evidence: `nodes/reactor/src/nodeClass.js:46`, `nodes/reactor/src/nodeClass.js:140`.
- Availability target: unknown/unsupported control topics fail soft with warning; setup path cannot throw from bad references.
7. Fix valve mode-selection bug using undefined config source.
- Why: `setMode` references `defaultConfig` instead of instance config; can throw or silently break mode changes.
- Evidence: `nodes/valve/src/specificClass.js:142`.
- Availability target: invalid mode inputs are rejected safely, valid mode changes deterministic.
8. Replace hard-throw chain semantics in measurement container with safe-return options.
- Why: chain API currently throws for sequence misuse; upstream callers can crash control loops.
- Evidence: `nodes/generalFunctions/src/measurements/MeasurementContainer.js:99`, `nodes/generalFunctions/src/measurements/MeasurementContainer.js:109`.
- Availability target: invalid chain usage logs and returns no-op/null path in production mode.
9. Remove noisy console/debug/test logging from runtime paths.
- Why: heavy `console.log/error` in control and shared code adds noise and can hide real failures.
- Evidence: `nodes/reactor/src/nodeClass.js:58`, `nodes/measurement/src/nodeClass.js:90`, `nodes/pumpingStation/src/nodeClass.js:87`, `nodes/valve/src/specificClass.js:207`.
- Availability target: use structured logger with levels; disable debug by default.
10. Standardize output contract for unchanged state to explicit `null` output.
- Why: `formatMsg` returns `undefined` when no change; behavior differs by node send implementation.
- Evidence: `nodes/generalFunctions/src/helper/outputUtils.js:37`, `nodes/generalFunctions/src/helper/outputUtils.js:62`.
- Availability target: unchanged outputs always return `null` to keep port contract deterministic.
## Implementation Status
- Implemented on 2026-02-19 in current session.
- Verification: node test suites passed for modified runtime nodes (`measurement`, `reactor`, `valve`, `valveGroupControl`, `machineGroupControl`, `settler`, `pumpingStation`, `dashboardAPI`, `monster`, `rotatingMachine`).
- Remaining follow-up items are tracked in `.agents/improvements/IMPROVEMENTS_BACKLOG.md`.