Skip to content

feat(core): report scenario override outcomes - #6

Open
92Infinitus92 wants to merge 5 commits into
developfrom
feat/scenario-override-outcomes
Open

feat(core): report scenario override outcomes#6
92Infinitus92 wants to merge 5 commits into
developfrom
feat/scenario-override-outcomes

Conversation

@92Infinitus92

@92Infinitus92 92Infinitus92 commented Aug 14, 2026

Copy link
Copy Markdown
Collaborator
  • Return a typed outcome for every scenario override.
  • Report whether each override was applied or skipped, including the reason.
  • Add outcome-aware time travel for pending overrides.
  • Preserve RPC error classification and expose the new contract through the Node SDK.

Greptile Summary

The PR adds typed applied/skipped outcomes for scenario overrides, outcome-aware time travel, atomic schedule batching, and Node SDK bindings.

  • Reports an outcome and skip reason for each materialized override.
  • Adds RPCs for outcome-aware time travel and override cancellation.
  • Stages account mutations and batches persistent schedule updates.
  • Preserves invalid-parameter versus internal RPC error classification.

Confidence Score: 3/5

The PR is not yet safe to merge because failed materialization can advance the clock and a double failure during commit recovery can permanently remove a scheduled override.

Time travel confirms and advances one slot before fallible materialization, while materialization recovery removes the schedule before account commit and cannot preserve it if the separate restoration write also fails.

Files Needing Attention: crates/core/src/surfnet/svm.rs

Important Files Changed

Filename Overview
crates/core/src/surfnet/svm.rs Adds override outcomes, staged materialization, schedule replacement/cancellation, and time-travel sequencing; recovery can still lose a dequeued override, and failed travel can leave an intermediate clock advance.
crates/core/src/storage/sqlite.rs Adds transactional batch application with rollback coverage.
crates/core/src/storage/postgres.rs Adds transactional batch application for schedule and overlay commits.
crates/core/src/rpc/surfnet_cheatcodes.rs Exposes typed registration and time-travel outcomes plus override cancellation.
crates/types/src/scenarios.rs Defines the typed override-outcome contract used by core and SDK consumers.
crates/sdk-node/surfpool-sdk/kit/generated/OverrideOutcome.ts Exposes the generated override-outcome shape to Node SDK callers.

Sequence Diagram

sequenceDiagram
    participant RPC
    participant SVM
    participant Schedule
    participant Accounts
    RPC->>SVM: materialize_overrides_for_slot(slot)
    SVM->>SVM: Apply overrides to staged clone
    SVM->>Schedule: take(slot)
    SVM->>Accounts: apply_batch(staged delta)
    Accounts-->>SVM: commit error
    SVM->>Schedule: store(slot, original batch)
    alt restoration succeeds
        Schedule-->>SVM: restored
        SVM-->>RPC: commit error, retryable
    else restoration fails
        Schedule-->>SVM: restore error
        SVM-->>RPC: combined error, override lost
    end
Loading

Fix all with Greploop

Fix All in Claude Code Fix All in Codex Fix All in Cursor

Prompt To Fix All With AI
### Issue 1
crates/core/src/surfnet/svm.rs:2690-2695
**Restore failure loses override**

When the staged account commit fails and the schedule backend also rejects the subsequent restore, the override has already been removed at line 2682, causing the account changes to be discarded while the scheduled override is permanently lost and unavailable on retry.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (5): Last reviewed commit: "fix(core): cancel scheduled overrides at..." | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

@92Infinitus92 92Infinitus92 self-assigned this Aug 14, 2026
Comment thread crates/core/src/surfnet/svm.rs
Comment thread crates/core/src/surfnet/svm.rs Outdated
Comment thread crates/core/src/surfnet/svm.rs Outdated
Comment thread crates/core/src/surfnet/svm.rs
Comment thread crates/core/src/surfnet/svm.rs Outdated
Comment thread crates/core/src/surfnet/svm.rs Outdated
Comment thread crates/core/src/surfnet/svm.rs Outdated
Comment on lines +2690 to +2695
if let Err(restore_error) =
self.scheduled_overrides.store(target_slot, scheduled_batch)
{
return Err(SurfpoolError::internal(format!(
"Failed to commit staged account overrides: {commit_error}; failed to restore their schedule: {restore_error}"
)));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Restore failure loses override

When the staged account commit fails and the schedule backend also rejects the subsequent restore, the override has already been removed at line 2682, causing the account changes to be discarded while the scheduled override is permanently lost and unavailable on retry.

Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/core/src/surfnet/svm.rs
Line: 2690-2695

Comment:
**Restore failure loses override**

When the staged account commit fails and the schedule backend also rejects the subsequent restore, the override has already been removed at line 2682, causing the account changes to be discarded while the scheduled override is permanently lost and unavailable on retry.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Fix in Claude Code Fix in Codex Fix in Cursor

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.

1 participant