Skip to content

Unify inoperable handling and add recoverable FAILED state#753

Open
vfusco wants to merge 2 commits intofeature/ci-improvementsfrom
feature/refactor-inoperable
Open

Unify inoperable handling and add recoverable FAILED state#753
vfusco wants to merge 2 commits intofeature/ci-improvementsfrom
feature/refactor-inoperable

Conversation

@vfusco
Copy link
Collaborator

@vfusco vfusco commented Mar 10, 2026

No description provided.

@vfusco vfusco added this to the 2.0.0 milestone Mar 10, 2026
@vfusco vfusco requested a review from Copilot March 10, 2026 12:55
@vfusco vfusco self-assigned this Mar 10, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 FAILED to 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 FAILED on 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.

@vfusco vfusco force-pushed the feature/refactor-inoperable branch from 4a71214 to ce06d6f Compare March 10, 2026 15:33
@vfusco vfusco marked this pull request as ready for review March 10, 2026 15:38
@vfusco vfusco requested review from mpolitzer and renatomaia March 10, 2026 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

2 participants