Skip to content

feat(lifecycle): compose the lifecycle service behind an opt-in scheduler gate - #184

Merged
aparragithub merged 3 commits into
mainfrom
feat/sp-resource-lifecycle-composition
Aug 8, 2026
Merged

feat(lifecycle): compose the lifecycle service behind an opt-in scheduler gate#184
aparragithub merged 3 commits into
mainfrom
feat/sp-resource-lifecycle-composition

Conversation

@aparragithub

@aparragithub aparragithub commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Closes #182

Final slice of the SP-RESOURCE-LIFECYCLE chain, after #177/#179/#180/#181. Recreated against main because #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 LocalOwnershipAuthority rather than standing up parallel state, and backs it with the durable JSONL journal.

Execution stays manual. EnvLifecycleSchedulerGate is 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

Gate Result
uv run pytest -q 1897 passed, 46 deselected, 13 subtests passed — 97% coverage
uv run mypy src no issues in 154 source files
uv run ruff check . passed
uv run ruff format --check . 306 files already formatted
uv run lint-imports 10 contracts kept, 0 broken

327 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

  • New Features
    • Added lifecycle management support to production deployments.
    • Lifecycle scheduling can now be enabled through the ODOO_FORGE_LIFECYCLE_SCHEDULER_ENABLED=1 configuration setting.
    • Lifecycle execution remains available for manual operation when scheduling is disabled.
    • Added consistent resource ownership and lifecycle state tracking across application components.
    • Production reporting now reflects lifecycle activity and resource status more reliably.

…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.
@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 5ed61874-58d3-472e-819c-bff8d605c243

📥 Commits

Reviewing files that changed from the base of the PR and between a245089 and cf6dd9e.

📒 Files selected for processing (1)
  • src/odoo_forge_server/composition.py

📝 Walkthrough

Walkthrough

The 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.

Changes

Lifecycle runtime composition

Layer / File(s) Summary
Scheduler gate and application dependencies
src/odoo_forge_server/composition.py, tests/odoo_forge_server/test_composition.py
create_production_app accepts lifecycle dependencies. EnvLifecycleSchedulerGate enables scheduling only when ODOO_FORGE_LIFECYCLE_SCHEDULER_ENABLED equals "1".
Shared lifecycle service wiring
src/odoo_forge_server/composition.py, tests/odoo_forge_server/test_composition.py
The app shares one resource authority and registry with LifecycleService. The default service uses the Docker/PostgreSQL adapter and JSONL journal.
Lifecycle execution and outcome validation
tests/odoo_forge_server/test_composition.py
Tests cover production reporting, contradictory lineage, and confirmed zombie quarantine. The composition adds no non-read-only routes.

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
Loading

Possibly related PRs

Suggested labels: type:feature

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the lifecycle service composition and opt-in scheduler gate, which are the main changes.
Linked Issues check ✅ Passed The changes satisfy issue #182 by composing the lifecycle adapter, shared authority, journal, manual execution, and disabled-by-default scheduler gate.
Out of Scope Changes check ✅ Passed The reported changes and tests remain within issue #182 and do not indicate excluded portfolio, wizard, migration, or backfill work.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/sp-resource-lifecycle-composition

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2cc27c3 and a245089.

📒 Files selected for processing (2)
  • src/odoo_forge_server/composition.py
  • tests/odoo_forge_server/test_composition.py

Comment thread src/odoo_forge_server/composition.py
… defaults

The docstring asserted shared authority unconditionally, but a caller that
supplies custody_adapter or lifecycle_service owns the authority behind it.
@aparragithub
aparragithub merged commit 1f21983 into main Aug 8, 2026
6 checks passed
@aparragithub
aparragithub deleted the feat/sp-resource-lifecycle-composition branch August 8, 2026 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Resource lifecycle: live authority, durable journal, and runtime composition

1 participant