docs: plan orchestrator and engine cleanup tasks
This commit is contained in:
parent
700ee09c4c
commit
7481d02c6c
13 changed files with 869 additions and 4 deletions
60
docs/development/backlog/tasks/CL16.md
Normal file
60
docs/development/backlog/tasks/CL16.md
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
# CL16 — Give orchestrator composition an explicit shutdown owner
|
||||
|
||||
Parent epic: E11. Priority/severity: P1 / High. Complexity: M. Specialist: TypeScript lifecycle and failure recovery.
|
||||
|
||||
Scheduling and commit evidence: [manifest](../manifest.json). Scope baseline: `700ee09c`. Owner authorized planning, implementation and one commit per completed task on 2026-10-26; CL21 remains conditional. Follow [quality gates](../../QUALITY-GATES.md) and [agent instructions](../../agents/implementation.md).
|
||||
|
||||
## Outcome and evidence
|
||||
|
||||
simple-container.ts:46 initializes DB clients then :58 registers app services without enclosing rollback and returns only services at :68. index.ts:159 drains app work but not database/cache clients; termination uses process.exit. builder.ts:76 keeps lifecycle owner only locally.
|
||||
|
||||
The concrete benefit is a smaller supported execution surface with unchanged financial behavior. Findings are verified at the baseline; recheck caller/module evidence before edits. This does not imply active financial corruption.
|
||||
|
||||
## Scope
|
||||
|
||||
- Expose an explicit owned runtime/shutdown handle while preserving compatible createContainer callers where needed.
|
||||
- Reuse existing lifecycle cleanup to roll back application-registration and HTTP-bind failures after successful shared-service startup.
|
||||
- Stop admission, drain durable runner/paper/queue work, then close borrowed adapters exactly once. Preserve initiating errors and attempt cleanup even if another closer fails.
|
||||
- Remove now-irrelevant ModeManager cleanup from the canonical entrypoint; avoid broad app lifecycle migration.
|
||||
|
||||
Likely files/modules:
|
||||
|
||||
- `apps/stock/orchestrator/src/simple-container.ts`
|
||||
- `apps/stock/orchestrator/src/container.ts`
|
||||
- `apps/stock/orchestrator/src/index.ts`
|
||||
- `libs/core/di/src/container/builder.ts`
|
||||
- `libs/core/di/src/utils/lifecycle.ts`
|
||||
- `test/integration/service-startup-rollback.test.ts`
|
||||
|
||||
## Exclusions
|
||||
|
||||
No changes to paper activation, account recovery, financial semantics, job lease policy, other application startup flows or readiness feature O02. Preserve retained strategy packages/datasets/results, useful algorithms, reviewed calculations, durable recovery and the existing .env files. No pushes, PRs or paper/live activation.
|
||||
|
||||
## Dependencies and ownership
|
||||
|
||||
Prerequisites: None; inspect existing integrated baseline rather than reopening earlier cleanup tasks.
|
||||
|
||||
Write locks: `orchestrator-composition`, `di-container`, `di-service-lifecycle`.
|
||||
|
||||
Parallelism: Can be prepared independently; serialize container.ts with CL14 and shared DI edits with any other owner.
|
||||
|
||||
## Acceptance criteria
|
||||
|
||||
1. Registration failure, HTTP bind failure, normal shutdown and repeated shutdown each close every owned resource once.
|
||||
2. Runner terminal writes finish before PostgreSQL closure; one cleanup failure cannot skip remaining resources or mask original startup error.
|
||||
3. Successful startup behavior, explicit paper composition and research isolation remain unchanged.
|
||||
|
||||
## Mandatory verification
|
||||
|
||||
- bun test libs/core/di/test/lifecycle.test.ts test/integration/service-startup-rollback.test.ts test/integration/paper-composition.test.ts test/integration/research-runtime-isolation.test.ts test/integration/canonical-worker-lifecycle.test.ts
|
||||
- Add controlled orchestrator composition/startup tests for all acceptance failures; no development DB
|
||||
- Build changed DI workspace; bun run typecheck
|
||||
|
||||
Use isolated worktrees/build outputs and disposable safety databases/Redis only. Never rebaseline financial fixtures to hide changed behavior. Integrator runs repository checks on the combined source. Performance work remains deferred; no speed claims are part of acceptance.
|
||||
|
||||
## Risks and definition of done
|
||||
|
||||
Double shutdown, early database closure, swallowed failures, unowned late initialization.
|
||||
|
||||
Done requires scoped tests, independent reviewer acceptance, integration verification, and a focused commit. The manifest owns status and evidence; implementers do not edit it. Root records each completed commit in the next bookkeeping update; the task completion commit includes its tests/reviewer evidence, avoiding self-referential hashes. Unrelated prior CL01–CL13 review status remains unchanged.
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue