Bind startup migrations to module schema search path

This commit is contained in:
master
2026-03-10 01:37:02 +02:00
parent 1df79ac75e
commit 6b7168ca3c
4 changed files with 176 additions and 5 deletions

View File

@@ -0,0 +1,75 @@
# Sprint 20260309-006 - Platform Rebuild Runtime Contract Repairs
## Topic & Scope
- Repair the post-rebuild JobEngine startup failure where shared startup migrations execute unqualified SQL on PostgreSQL's default search path instead of the module schema.
- Repair the gateway container binding drift where compose publishes explicit HTTP ports but the gateway container only comes up on the opportunistic HTTPS listener.
- Keep this iteration limited to runtime contract correctness exposed by the full-stack rebuild before the next Playwright sweep.
- Working directory: `src/__Libraries/StellaOps.Infrastructure.Postgres`.
- Allowed coordination edits: `src/__Libraries/__Tests/StellaOps.Infrastructure.Postgres.Tests/**`, `src/Router/StellaOps.Gateway.WebService/**`, `src/Router/__Tests/StellaOps.Gateway.WebService.Tests/**`, `docs/modules/jobengine/architecture.md`, `docs/modules/router/architecture.md`, `docs/implplan/SPRINT_20260309_006_Platform_rebuild_runtime_contract_repairs.md`.
- Expected evidence: focused Postgres migration-host integration tests, focused gateway binding tests, rebuilt/redeployed affected services, and direct live probes before returning to Playwright.
## Dependencies & Concurrency
- Depends on `SPRINT_20260309_001_Platform_scratch_setup_bootstrap_restore.md` for the rebuilt stack baseline and `SPRINT_20260309_005_JobEngine_live_scratch_reset_and_ops_scope_repair.md` for the previously restored JobEngine startup-migration registration.
- Safe parallelism: avoid the dirty JobEngine migration SQL files already being edited elsewhere; this pass must solve the current failure in shared runtime code and gateway container binding only.
## Documentation Prerequisites
- `AGENTS.md`
- `docs/code-of-conduct/CODE_OF_CONDUCT.md`
- `docs/qa/feature-checks/FLOW.md`
- `docs/modules/jobengine/architecture.md`
- `docs/modules/router/architecture.md`
## Delivery Tracker
### PLATFORM-RUNTIME-006-001 - Bind startup migrations to the module schema
Status: DOING
Dependency: none
Owners: Developer, Test Automation
Task description:
- Align `StartupMigrationHost` with the shared migration runner so startup-applied SQL executes with the target module schema on PostgreSQL's search path.
- Prove the fix with focused integration coverage that reproduces a collision in `public` while asserting the startup host still creates and mutates schema-local objects.
Completion criteria:
- [ ] `StartupMigrationHost` sets the search path to the module schema before applying embedded SQL.
- [ ] Focused shared-library integration tests fail without the fix and pass with it.
- [ ] JobEngine no longer crashes on startup because `001_initial.sql` is applied against `orchestrator`, not `public`.
### PLATFORM-RUNTIME-006-002 - Honor compose HTTP bindings in gateway container mode
Status: TODO
Dependency: PLATFORM-RUNTIME-006-001
Owners: Developer, Test Automation
Task description:
- Repair the container binding helper in `StellaOps.Gateway.WebService` so explicit compose HTTP/HTTPS bindings are actually listened on when the gateway runs in-container with local certificates enabled.
- Add focused gateway tests for the binding-resolution logic instead of relying on manual container inspection only.
Completion criteria:
- [ ] The gateway container binding helper derives listeners from `ASPNETCORE_URLS` and/or port env vars when present.
- [ ] Focused gateway tests cover explicit URL and port-env resolution.
- [ ] The live gateway container exposes the expected HTTP listener and reaches healthy state after redeploy.
### PLATFORM-RUNTIME-006-003 - Redeploy and reverify the repaired stack slice
Status: TODO
Dependency: PLATFORM-RUNTIME-006-002
Owners: QA
Task description:
- Rebuild the affected runtime images, redeploy the live compose slice, verify container health and direct service reachability, then resume the browser-based defect sweep from a clean baseline.
Completion criteria:
- [ ] Updated runtime images are rebuilt and redeployed without touching unrelated dirty work.
- [ ] `jobengine` and `gateway` both reach healthy running state in the live compose stack.
- [ ] Direct probes for JobEngine summary and gateway frontdoor reachability succeed before the next Playwright pass.
## Execution Log
| Date (UTC) | Update | Owner |
| --- | --- | --- |
| 2026-03-09 | Sprint created after the full rebuild exposed two runtime contract failures: JobEngine startup migrations were executing unqualified SQL on the default PostgreSQL search path, and the gateway container was not honoring explicit compose HTTP bindings. | Developer |
## Decisions & Risks
- Decision: fix the JobEngine failure in the shared startup migration host instead of rewriting active module SQL files owned by another agent. The runtime contract is that startup migrations target the declared module schema.
- Decision: repair gateway listener resolution in code instead of papering over the symptom with a healthcheck-only change. The compose contract already declares the intended container ports.
- Risk: the gateway still force-redirects browser traffic to HTTPS; after the binding repair, live route checks must confirm this does not break any frontdoor route that still proxies through the gateway service.
## Next Checkpoints
- 2026-03-09: land shared startup-migration search-path fix with focused tests.
- 2026-03-09: land gateway container binding fix with focused tests.
- 2026-03-09: rebuild/redeploy affected services and resume Playwright verification.