Unify inoperable handling and add recoverable FAILED state#753
Open
vfusco wants to merge 2 commits intofeature/ci-improvementsfrom
Open
Unify inoperable handling and add recoverable FAILED state#753vfusco wants to merge 2 commits intofeature/ci-improvementsfrom
vfusco wants to merge 2 commits intofeature/ci-improvementsfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Introduces a recoverable FAILED application state and centralizes application inoperable/failed transitions in a new internal/appstatus package, aiming to make failure handling consistent across services while keeping INOPERABLE terminal.
Changes:
- Add
FAILEDto the application state model, DB enum, and JSON-RPC discovery schema; enforce state transitions and reason clearing via a DB trigger. - Centralize status transitions and reason truncation in
internal/appstatus, and refactor services to use it. - Update advancer behavior to mark apps
FAILEDon machine/runtime errors and continue processing other apps; extend repo and unit test coverage.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/validator/validator.go | Uses appstatus.SetInoperablef to unify INOPERABLE transitions. |
| internal/prt/prt.go | Uses appstatus.SetInoperablef to unify INOPERABLE transitions. |
| internal/evmreader/evmreader.go | Uses appstatus.SetInoperablef to unify INOPERABLE transitions. |
| internal/claimer/claimer.go | Refactors setApplicationInoperable signature and delegates to appstatus. |
| internal/appstatus/appstatus.go | New shared helpers for FAILED/INOPERABLE transitions (logging, truncation, persistence). |
| internal/appstatus/appstatus_test.go | Unit tests for appstatus behavior (DB error handling, truncation). |
| internal/advancer/advancer.go | Marks apps FAILED on advance/runtime errors and accumulates per-app errors in Step. |
| internal/advancer/advancer_test.go | Tests that FAILED apps don’t block processing of other apps; updates expected state. |
| internal/model/models.go | Adds ApplicationState_Failed and documents the state machine. |
| internal/manager/manager.go | Clarifies that machines are removed for any non-enabled application. |
| internal/repository/repotest/application_test_cases.go | Adds extensive trigger/state-transition tests (FAILED, terminal INOPERABLE, reason clearing). |
| internal/repository/postgres/schema/migrations/000001_create_initial_schema.up.sql | Adds FAILED to enum, requires reason for FAILED/INOPERABLE, adds transition/terminal enforcement trigger. |
| internal/repository/postgres/db/rollupsdb/public/enum/applicationstate.go | Updates generated enum mapping to include FAILED. |
| internal/jsonrpc/jsonrpc-discover.json | Adds FAILED to enum and documents reason semantics. |
| cmd/cartesi-rollups-cli/root/app/status/status.go | Prints reason; adds confirmation prompt for re-enabling FAILED apps (+ --yes). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
internal/repository/postgres/schema/migrations/000001_create_initial_schema.up.sql
Show resolved
Hide resolved
4a71214 to
ce06d6f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.