feat(lifecycle): compose the lifecycle service behind an opt-in scheduler gate - #184
Conversation
…uler gate The lifecycle adapter shipped dormant and unimported. Wire it into server composition sharing the existing registry and ownership authority, with a durable journal and manual execution only: the scheduler gate stays disabled unless explicitly opted in, so composition adds no automatic mutation path.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe production composition now wires a shared resource authority, lifecycle service, Docker/PostgreSQL adapter, JSONL journal, and environment-based scheduler gate. Tests cover disabled scheduling, manual lifecycle outcomes, lineage contradictions, and zombie quarantine. ChangesLifecycle runtime composition
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Application
participant LifecycleSchedulerGate
participant LifecycleService
participant DockerResourceCustodyAdapter
participant JsonlLifecycleJournal
Application->>LifecycleSchedulerGate: check automated scheduling
LifecycleSchedulerGate-->>Application: allow only for exact "1"
Application->>LifecycleService: execute lifecycle manually
LifecycleService->>DockerResourceCustodyAdapter: inspect resource
DockerResourceCustodyAdapter-->>LifecycleService: return lifecycle evidence
LifecycleService->>JsonlLifecycleJournal: append outcome
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/odoo_forge_server/composition.py`:
- Around line 132-146: Update create_production_app so the composed authority is
shared by both control_plane_authority and any injected lifecycle_service. Do
not retain a lifecycle_service backed by a different authority; either inject
one LocalOwnershipAuthority into both dependencies or construct the lifecycle
service through a factory receiving the composed registry and authority, while
preserving the default lifecycle path.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 68035ecd-9358-441b-a83d-0249a296698b
📒 Files selected for processing (2)
src/odoo_forge_server/composition.pytests/odoo_forge_server/test_composition.py
… defaults The docstring asserted shared authority unconditionally, but a caller that supplies custody_adapter or lifecycle_service owns the authority behind it.
Closes #182
Final slice of the
SP-RESOURCE-LIFECYCLEchain, after #177/#179/#180/#181. Recreated againstmainbecause #183 was auto-closed when its base branch was deleted on merge of #181.What
The PostgreSQL Docker lifecycle adapter shipped in #181 dormant and unimported. This wires it into server composition, sharing the existing instance registry and
LocalOwnershipAuthorityrather than standing up parallel state, and backs it with the durable JSONL journal.Execution stays manual.
EnvLifecycleSchedulerGateis disabled by default and consulted by nothing — opt-in is explicit and exact. Composition therefore adds no automatic mutation path, which is what keeps the manual-default guarantee true rather than merely intended.Coverage
Composed end-to-end tests cover the confirmed-zombie and live-activity paths, PROD report-only, and evidence contradictions, each paired with a zero-prohibited-mutation assertion.
Verification
uv run pytest -quv run mypy srcuv run ruff check .uv run ruff format --check .uv run lint-imports327 insertions / 15 deletions against
main, within the 400-line review budget.SDD verification: 4/4 requirements, 10/10 scenarios covered, 0 critical.
Summary by CodeRabbit
ODOO_FORGE_LIFECYCLE_SCHEDULER_ENABLED=1configuration setting.