fix(lifecycle): reject contradictory zombie history - #180
Conversation
|
Warning Review limit reached
Next review available in: 28 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughLifecycle recovery now validates quarantine history, resource classes, policy approval, timestamps, and elapsed waits. Contradictory evidence returns human-intervention results. Tests cover rejected mutations and valid delayed deletion. ChangesLifecycle recovery validation
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant LifecycleService
participant Registry
participant Provider
LifecycleService->>Registry: compare history-derived record
Registry-->>LifecycleService: registry evidence
LifecycleService->>Provider: validate resource class and zombie evidence
Provider-->>LifecycleService: provider observation
LifecycleService->>LifecycleService: validate quarantine timestamp and wait
LifecycleService->>Provider: quarantine and delete after wait
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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/resource_lifecycle/service.py`:
- Around line 413-422: Validate the quarantine wait at the start of
LifecycleService.run and reject values below timedelta(), before any lifecycle
processing or fresh-observation guard runs. Add a regression test covering a
negative wait and assert that neither quarantine nor delete is called.
In `@src/odoo_forge/resource_lifecycle/types.py`:
- Around line 126-127: Update the QuarantineHistory model’s quarantined_at field
to enforce timezone-aware datetimes, using AwareDatetime or an equivalent
Pydantic v2 validator. Ensure model construction rejects naive datetime values
while preserving valid timezone-aware timestamps.
In `@tests/resource_lifecycle/test_service.py`:
- Around line 667-669: Update the history event selection in the relevant test
to choose the last event with a non-None history, ensuring it validates the
quarantine event emitted by the service rather than the input appended by
_history_journal(qa_history). Keep the existing resource_class assertion against
that selected event.
🪄 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: f2035eba-027e-4237-af3e-e2e4732b1014
📒 Files selected for processing (3)
src/odoo_forge/resource_lifecycle/service.pysrc/odoo_forge/resource_lifecycle/types.pytests/resource_lifecycle/test_service.py
Closes #176
PR type
Summary
Changes
src/odoo_forge/resource_lifecycle/types.pysrc/odoo_forge/resource_lifecycle/service.pytests/resource_lifecycle/test_service.pyChain context
Follow-up to merged PR #179. PR4 production authority and PR5 composition remain out of scope.
Test plan
uv run pytest tests/resource_lifecycle/test_service.py— 49 passeduv run pytest— 1863 passed, 46 deselecteduv run mypy --no-incremental— 300 files, no issuesgit diff --checkpassedContributor checklist
Summary by CodeRabbit
Bug Fixes
Tests