Skip to content

Advancer and machine manager reliability improvements#748

Merged
vfusco merged 17 commits intonext/2.0from
feature/advancer-improvements
Mar 5, 2026
Merged

Advancer and machine manager reliability improvements#748
vfusco merged 17 commits intonext/2.0from
feature/advancer-improvements

Conversation

@vfusco
Copy link
Collaborator

@vfusco vfusco commented Mar 5, 2026

No description provided.

@vfusco vfusco added this to the 2.0.0 milestone Mar 5, 2026
@vfusco vfusco requested a review from Copilot March 5, 2026 05:26
@vfusco vfusco self-assigned this Mar 5, 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

This PR improves reliability across the machine runtime, machine manager, and advancer by tightening error handling, adding bounded batching to avoid large in-memory backlogs, and making shutdown/cleanup more robust.

Changes:

  • Introduces a structured AdvanceResponse return type for machine advances and adds a reports-per-input limit with a corresponding completion status.
  • Adds batched input replay/synchronization for machine instances and surfaces a configurable ADVANCER_INPUT_BATCH_SIZE.
  • Improves advancer and manager shutdown semantics (graceful HTTP shutdown, closing machine instances to avoid orphan processes) and snapshot handling safety.

Reviewed changes

Copilot reviewed 21 out of 23 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/machine/machine.go Adds AdvanceResponse; wraps cancel/deadline errors; introduces ErrReportsLimitExceeded; updates Machine.Advance signature.
pkg/machine/implementation.go Enforces report limits; replaces panics with errors; adds context checks in run loop; updates advance return shape.
pkg/machine/machine_test.go Updates tests for new AdvanceResponse API and adds load-path error coverage.
pkg/machine/implementation_test.go Adds coverage for outputs hash proof/checkpoint write and additional run-loop behaviors; updates advance tests to new API.
pkg/machine/libcartesi.go Removes stray println on JSON unmarshal failure.
internal/manager/types.go Extends interfaces: Synchronize now takes batchSize, OutputsProof signature change, and adds MachineProvider.Close.
internal/manager/manager.go Adds instance factory abstraction; adds close semantics; switches synchronization to batched replay; improves snapshot fallback logic.
internal/manager/instance.go Implements batched Synchronize; hardens runtime lifecycle with destroy-on-unrecoverable-error; adds close timeout draining inspects; atomic processed input tracking.
internal/manager/manager_test.go Updates tests for new manager ctor/options and adds new error-path + Close aggregation tests.
internal/manager/instance_test.go Adds extensive coverage for snapshot init, outputs proof/hash behaviors, synchronize batching, and close-timeout behavior.
internal/manager/pmutex/pmutex_test.go Reworks contested lock tests to avoid testify’s Never helper and to ensure cleanup/unblock.
internal/advancer/service.go Adds graceful HTTP server shutdown and machine manager close on Stop; propagates server failure via cancellation; wires batch size into manager creation.
internal/advancer/advancer.go Fetches/processes inputs in batches; triggers shutdown on store-after-advance failure; improves snapshot path join + deletion safety checks.
internal/advancer/advancer_test.go Refactors test setup; adds broad coverage for batching, epoch handling, snapshot lifecycle, and shutdown-triggering scenarios.
internal/config/generated.go Adds CARTESI_ADVANCER_INPUT_BATCH_SIZE config with defaults and loaders for advancer/node.
internal/config/generate/Config.toml Adds config generator entry for CARTESI_ADVANCER_INPUT_BATCH_SIZE.
internal/repository/postgres/schema/migrations/000001_create_initial_schema.up.sql Extends InputCompletionStatus enum with REPORTS_LIMIT_EXCEEDED.
internal/repository/postgres/db/rollupsdb/public/enum/inputcompletionstatus.go Updates generated enum mapping for REPORTS_LIMIT_EXCEEDED.
internal/model/models.go Adds model enum value + scan handling for REPORTS_LIMIT_EXCEEDED.
internal/repository/postgres/repository_error_test.go Minor formatting alignment change.
internal/inspect/inspect_test.go Updates mock interface signatures for Synchronize/OutputsProof.
cmd/cartesi-rollups-cli/root/read/read.go Minor formatting fix for flag setting.
Makefile Exposes MACOSX_DEPLOYMENT_TARGET in make env output when set.

💡 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/advancer-improvements branch from 843d1e9 to ec16956 Compare March 5, 2026 05:51
@vfusco vfusco marked this pull request as ready for review March 5, 2026 14:12
@vfusco vfusco requested review from mpolitzer and renatomaia March 5, 2026 14:13
renatomaia
renatomaia previously approved these changes Mar 5, 2026
@github-project-automation github-project-automation bot moved this from Todo to Waiting Merge in Rollups SDK Mar 5, 2026
mpolitzer
mpolitzer previously approved these changes Mar 5, 2026
Copy link

@mpolitzer mpolitzer left a comment

Choose a reason for hiding this comment

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

added a few comments, mostly nitpicks

@vfusco vfusco dismissed stale reviews from mpolitzer and renatomaia via b2733c5 March 5, 2026 21:51
@vfusco vfusco force-pushed the feature/advancer-improvements branch from ec16956 to b2733c5 Compare March 5, 2026 21:51
@vfusco vfusco force-pushed the feature/advancer-improvements branch from b2733c5 to e69b14d Compare March 5, 2026 21:56
@vfusco vfusco merged commit e69b14d into next/2.0 Mar 5, 2026
6 checks passed
@vfusco vfusco deleted the feature/advancer-improvements branch March 5, 2026 22:04
@github-project-automation github-project-automation bot moved this from Waiting Merge to Done in Rollups SDK Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants