stock-bot/docs/development/backlog/tasks/CL04.md

71 lines
4 KiB
Markdown

# CL04 — Provide one consistent research startup path and repair stale commands
Parent epic: E10. Priority/severity: P1 / Medium. Complexity: S. Specialization: Bun/Turbo developer tooling.
Scheduling metadata: [manifest](../manifest.json). Read the [cleanup execution contract](../../CLEANUP.md#execution-contract). This story defines planned work; implementation has not been requested.
## User story and outcome
As a developer, I want documented startup commands to launch the required research services on predictable ports, so getting the workbench running does not require debugging obsolete scripts.
Expected benefit: Removes three broken command targets and inconsistent infrastructure startup.
## Verified evidence
- **Verified — CL-F08:** db:setup-ib, db:init and proxy reference files absent at the audit baseline; docker:start and infra:up use different paths. [package.json:55](../../../../package.json#L55).
- **Verified — CL-F08:** docker:start starts Dragonfly, PostgreSQL and QuestDB but omits MongoDB, unlike infra:up. [scripts/docker.sh:93](../../../../scripts/docker.sh#L93).
## Implementation scope
- Offer one clearly named research development command selecting web-api, orchestrator and web-app through existing tooling; reuse the current build dependencies.
- Make the documented infrastructure-start aliases agree on required stores and the supported Docker Compose invocation.
- Remove obsolete missing-file aliases or redirect them only to existing, reviewed equivalents. Preserve migration safeguards; ordinary startup must never execute destructive init/reset scripts.
- Document ports 2003/2004/5173 and required authentication configuration without printing or generating new secrets. Add dry-run/command-target checks to existing tooling tests.
Likely existing files/modules:
- `package.json`
- `scripts/docker.sh`
- `scripts/test/workspace.test.ts`
- `README.md`
- `apps/stock/README.md`
- `apps/stock/web-app/README.md`
## Exclusions
- No new process supervisor, deployment stack or package manager.
- No automatic reset, credential changes, provider ingestion, paper/live activation or startup of optional monitoring/admin services.
## Dependencies and ownership
Implementation prerequisites: None.
Write locks: `root-scripts`, `docker-startup`, `startup-documentation`.
Parallel execution: Ready independently. Can run with CL01/CL03. CL05 uses the existing libs/* workspace glob and must not edit root scripts concurrently.
## Acceptance criteria
1. Every retained script alias resolves to an existing executable target or documented installed tool; the three identified missing-file commands are repaired or removed.
2. The research dev task plan contains exactly the three intended application dev roles plus required build tasks; it does not start ingestion or activate paper/live accounts.
3. Infrastructure aliases agree on their store set and propagate failures instead of printing success after a failed Compose command.
4. Documentation matches actual commands and fixed ports. Existing .env files and contents remain intact.
5. Tests can verify task selection and command targets without starting services or provisioning containers.
## Mandatory verification
Use existing workspace builds. Tests requiring PostgreSQL/Redis must use explicitly disposable safety fixtures.
```sh
bun test scripts/test/workspace.test.ts
bun run build --dry=json
git diff --check
```
Required regression cases: missing command targets, exact dev task selection, startup failure exit propagation, and exclusion of reset/init/activation commands.
## Risks and definition of done
Changing convenience aliases can break local habits. Keep safe compatibility aliases where useful and make intentionally removed aliases explicit in documentation.
Done means the acceptance criteria and relevant checks pass, an independent review accepts the focused diff, and the integrator records exact test results and a commit/reference in the manifest. Preserve the compatibility and financial invariants in the cleanup execution contract.