From 92eb04ada898564d8557bff772f449d29e484291 Mon Sep 17 00:00:00 2001 From: Hermes Date: Mon, 13 Jul 2026 15:47:07 -0700 Subject: [PATCH] =?UTF-8?q?DC-045:=20fix=20WorkflowEngine=20init=20?= =?UTF-8?q?=E2=80=94=20new=20(require(...))()=20precedence=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Documented as done in BACKLOG. Live-verified on dc-contabo-de test server: workflow engine now starts, 90s post-restart shows zero error spam. Combined with DC-044, workflows now actually execute end-to-end. --- BACKLOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/BACKLOG.md b/BACKLOG.md index 95bae89..bda0b62 100644 --- a/BACKLOG.md +++ b/BACKLOG.md @@ -255,6 +255,13 @@ Tickets DC-033 through DC-041 were added after the DNS2 v1.14.4 / v1.14.8 / 0.0. - **impact:** Workflow health checks now actually check container health, instead of silently reporting 0/0 every cycle. Stops the "Health check failed" notification spam. - **result:** Fixed in src/recipes/bundled-workflows.js. New regression test `__tests__/bundled-workflows-health-check.test.js` — 5 cases (uses .read() not .getState(), correct counts, graceful degrade on read() throw, no servicesStateManager on ctx, single-service path). Full suite: 1219/1219 pass (+5 new). +### DC-045: Fix WorkflowEngine init — `new (require(...))()` precedence bug on ES6 classes +- **status:** done +- **owner:** hermes +- **details:** server.js:93 (v1.13.4) instantiated `new (require('./src/managers/notification-manager'))({...})`. V8 parses this as `(new (require('./x')))(opts)` — which invokes the module's exported class AS A FUNCTION (without `new`), triggering `Class constructor NotificationManager cannot be invoked without 'new'` at server startup. Result: workflow engine never initializes on the running test server (dc-contabo-de). Combined with DC-044 (the .getState bug), the workflow feature has been broken since at least v1.13.4 and visible on both DNS2 + test server. +- **impact:** Workflow engine now starts cleanly. Health-check-on-interval workflow now actually runs against real services instead of silently 0/0. +- **result:** Hoisted `const NotificationManager = require(...)` and used `new NotificationManager({...})` in the server.js init block. Verified live on dc-contabo-de: workflow engine now logs `Workflow engine initialized` on startup; 90s of post-restart logs show zero `getState is not a function` errors, zero `WorkflowEngine Action health-check failed` spam, zero error-priority entries. Health check: 200 OK with uptime reporting. + 1. **Always `git pull` before starting work.** 2. **Claim a task by editing BACKLOG.md:** set `status: in-progress` and `owner: hermes` or `owner: krystie`. 3. **Commit BACKLOG.md claim first**, then start coding.