DC-045: fix WorkflowEngine init — new (require(...))() precedence bug
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.
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user