Parent Epic
#11831 — Sub 2 of 6 (parallel after Sub 1).
Scope
Refactor Orchestrator.spec.mjs test-fixture (createTestOrchestrator() helper) for the new config substrate landed in Sub 1. Add invariant tests that catch regression of removed anti-patterns.
Acceptance Criteria
- Refactored
createTestOrchestrator() — no longer uses Neo.create(Orchestrator, {summarySweepIntervalMs: X, ...}) (won't reach the lazy-getter properties). Uses AiConfig.data mutation + env var with try/finally restore + direct instance-field override.
- Config precedence tests prove: env var overrides AiConfig; gitignored
ai/config.mjs overrides template; service override via instance field works; singleton leak prevention between tests (afterEach restore of mutated AiConfig.data).
- Parent-config-propagation tests prove: mutating
orchestrator.taskDefinitions propagates to processSupervisorService.taskDefinitions via afterSetTaskDefinitions hook (NOT via start() context replay).
- Source-level invariants prove anti-patterns are removed:
- No
_-suffix configs in Orchestrator.mjs without corresponding hook (grep test)
- No
configure() method (grep test)
- No
DEFAULT_X_INTERVAL_MS exports in TaskDefinitions.mjs (grep test)
- No
parseInterval / parseEnabledFlag call sites in Orchestrator.mjs (grep test)
- No
processSupervisorService.set({...this...}) block in start() (grep test)
Files (touched)
test/playwright/unit/ai/daemons/Orchestrator.spec.mjs (refactor createTestOrchestrator() + add invariant tests)
Authored by: [Claude Opus 4.7] (Claude Code)
Parent Epic
#11831 — Sub 2 of 6 (parallel after Sub 1).
Scope
Refactor
Orchestrator.spec.mjstest-fixture (createTestOrchestrator()helper) for the new config substrate landed in Sub 1. Add invariant tests that catch regression of removed anti-patterns.Acceptance Criteria
createTestOrchestrator()— no longer usesNeo.create(Orchestrator, {summarySweepIntervalMs: X, ...})(won't reach the lazy-getter properties). Uses AiConfig.data mutation + env var with try/finally restore + direct instance-field override.ai/config.mjsoverrides template; service override via instance field works; singleton leak prevention between tests (afterEach restore of mutated AiConfig.data).orchestrator.taskDefinitionspropagates toprocessSupervisorService.taskDefinitionsviaafterSetTaskDefinitionshook (NOT viastart()context replay)._-suffix configs inOrchestrator.mjswithout corresponding hook (grep test)configure()method (grep test)DEFAULT_X_INTERVAL_MSexports inTaskDefinitions.mjs(grep test)parseInterval/parseEnabledFlagcall sites inOrchestrator.mjs(grep test)processSupervisorService.set({...this...})block instart()(grep test)Files (touched)
test/playwright/unit/ai/daemons/Orchestrator.spec.mjs(refactorcreateTestOrchestrator()+ add invariant tests)Authored by: [Claude Opus 4.7] (Claude Code)