Skip to content

fix(studio): play a scenario one column per produced slot - #31

Merged
92Infinitus92 merged 10 commits into
feat/scenarios/override/scenario-playback-supportfrom
feat/studio/play-modes
Nov 2, 2026
Merged

92Infinitus92 merged 10 commits into
feat/scenarios/override/scenario-playback-supportfrom
feat/studio/play-modes

Conversation

@92Infinitus92

@92Infinitus92 92Infinitus92 commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

What

Play no longer sends the whole scenario to the surfnet. It registers the first column only (scenarioRelativeSlot: 0), pauses the clock and advances one slot so the column lands. Step forward registers the next column and advances one slot. Stop and Complete are unchanged.

Why

With the whole plan registered at Play, every later column was already in the surfnet's schedule. If the clock ran during the register call (the call itself takes a mainnet round trip per fetchBeforeUse account) the next block landed the second column before the pause arrived, measured at 1 ms after the first; and after Stop the remaining columns still landed as soon as the clock resumed. Registering a column only when the user reaches it leaves nothing scheduled ahead, so nothing lands early and Stop has nothing pending.

The one-slot advance after Play goes with the engine change LimeChain/surfpool#38 (feat/scenarios/apply-on-block): the first column now lands when its slot is produced, and with a paused clock Studio produces it.

Changes

apps/studio/src/components/svm/scenario-editor.tsx

  • registerColumn(slot): builds the overrides of one column, relative slot 0, name " · column N/M" so the surfnet log tells the columns apart. It reports a failed registration, and Play and Step stop there.
  • advanceOneSlot(): the one-slot time travel from the processed slot, extracted from Step forward and shared with Play. It reports a failed time travel.
  • startPlay: register column 1 -> pause -> advance; upstream's handlePlay keeps the Play button locked while it runs. handleStepForward: register the next column -> advance.
  • registeredColumnRef: a step retried after a failed time travel only advances, without registering its column a second time. After a Play that could not advance, the next Play registers the first column again, with any edits made since.
  • handleStepForward ignores a second Step while one is running (a ref, so it holds even before React renders again), and Step and Stop are disabled meanwhile. A double click used to register the same column twice and move past the next one without registering it, and a Stop during a step let the step finish after it.
  • The "pause BEFORE registering ... race" comment is gone with the race.

apps/studio/src/components/svm/scenario-editor.test.tsx

  • The RPC order at Play and Step (fails against the previous editor); a rejected first column never pauses the clock; a retried step registers its column once; a Play that cannot advance registers the first column again next time; a second Step while one runs is ignored and Stop stays disabled.

The branch is merged with web-ui main 237d1e6, which brought the double-click guard (isStartingPlay) and the processed getEpochInfo with the Phoenix presets (solana-foundation#56).

Verification

Not in this PR

Play with a running clock (Micaiah's "Continue") and the warning for timestamp-sensitive templates: #32.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CkgCK6kr7c138a1U8kmaN4

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary

Play now registers only column 1 (relative slot 0), pauses, then advances one slot. Step forward registers the next column and advances one slot. Because nothing is scheduled ahead of the current column, the early-landing problem and the leftover columns after Stop both go away. The refactor (registerColumn, advanceOneSlot) is clean, and the new test pins the RPC order.

Concerns

  • Requires the engine change. Play relies on surfpool's feat/scenarios/apply-on-block, where a relative-slot-0 override lands when the next slot is produced. Against a released surfpool this may misbehave. Consider gating it on a version or capability check, or at least noting the required surfpool version in the release notes.
  • The same scenario id is re-registered for every column. Behaviour depends on what surfnet_registerScenario does when the id already exists. If it replaces, a column whose time travel failed is silently dropped. If it appends or merges, earlier entries can pile up. Worth confirming and documenting which one the engine does.
  • "Stop has nothing pending" only holds when the advance succeeded. registerColumn and advanceOneSlot swallow their errors, so a failed time travel leaves the registered column pending. It then lands whenever the clock next runs (e.g. Complete → resumeClock), while the UI has already moved to the next column. The PR lists error reporting as out of scope, but this case undercuts the stated guarantee.

Overall the direction looks right. The main thing I'd change is the Play ordering (see inline comment).

const handlePlay = async () => {
const [firstSlot] = slots;
if (firstSlot) {
await registerColumn(firstSlot);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Column 1 is registered before the clock is paused. Since registration can take a mainnet round trip (fetchBeforeUse), a running clock will usually produce a block in the meantime. Column 1 then lands in that clock-driven slot, and advanceOneSlot() afterwards produces an empty slot. Nothing lands early any more, but the column is no longer guaranteed to land in the slot Studio produces, which is the intent stated in the PR.

Is there a reason not to keep the old order (pause → register → advance)? With the engine change it is fully deterministic and costs nothing. If the order is intentional, a short comment explaining why would help, since the previous comment explicitly argued for pausing first.

if (currentPlaybackSlot < slots.length - 1) {
setIsExecuting(false);
await registerColumn(slots[currentPlaybackSlot + 1]);
await advanceOneSlot();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

advanceOneSlot() runs even when registerColumn failed, because the error is only logged. The surfnet then produces an empty slot, but the UI still moves to the next column as if it had been applied. Consider having registerColumn return a success boolean and skipping the advance and setCurrentPlaybackSlot when it fails. That would be a small change, even if proper error reporting is left for later.

const scenario = {
id: scenarioId,
name: scenarioName,
name: `${scenarioName} · column ${slots.indexOf(slot) + 1}/${slots.length}`,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

slots.indexOf(slot) relies on object identity. That is fine here, but the callers already know the index (0 and currentPlaybackSlot + 1). Passing the index in, or using slot.height + 1 if heights are contiguous, would avoid the lookup and the dependency on identity.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Overview: Play now registers only column 1 (relative slot 0), then pauses the clock and moves forward one slot. Step forward registers the next column and moves forward one slot. The PR pulls out registerColumn and advanceOneSlot, which now return a boolean and also check JSON-RPC error payloads, not just HTTP status. Two tests are added: one checks the RPC order, the other checks that a rejected registration leaves the editor in read mode.

Assessment: The change does what the PR says and removes the "whole plan scheduled ahead" problem. Error handling is better than before. The remaining problems are all about partial failure. Both Play and Step register a column before the step that makes it land, so a failure after registration leaves an override pending. That override fires the next time the clock runs, which is the problem this PR is meant to fix. Details are in the inline comments. Double-click guards are listed as out of scope, but the steps that can't be rolled back are worth noting here, because the new booleans already make a clean rollback possible.

Minor point: a column with no actions still sends surfnet_registerScenario with overrides: []. Consider skipping the registration for empty columns and only moving forward one slot.


const handlePlay = async () => {
const [firstSlot] = slots;
if (firstSlot && !(await registerColumn(firstSlot))) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Registering before pausing brings back a version of the race this PR removes. If the clock is running, column 1 (relative slot 0) lands in whichever slot is produced next, and that may come before the pause arrives. advanceOneSlot then produces an extra, empty slot. Pausing first gives the guarantee the PR describes (column 1 lands in the slot Studio produces). If the order is required by the engine (the 'base slot already produced' error in the new test hints at that), please explain why in a comment.

}
} catch (error) {
console.error('❌ Error registering scenario:', error);
console.error('Error pausing clock:', 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.

A failed pause is only logged. Play then goes on to advanceOneSlot with the clock still running, so column 1 can land in a slot Studio didn't produce, and the next columns are stepped on a live clock. Consider stopping here (return) when pauseResponse is not ok or has a JSON-RPC error, the same way registerColumn and advanceOneSlot now do.

}

if (firstSlot && !(await advanceOneSlot())) {
return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If the time travel fails here, column 1 is already registered. The clock may be paused, but the UI stays in read mode and the header shows it as paused. The pending column 1 then lands when the user resumes the clock, which is exactly the 'something scheduled ahead' case this PR removes. Consider unregistering the scenario (or resuming the clock and telling the user) when the advance fails after a successful register.

const handleStepForward = async () => {
if (currentPlaybackSlot < slots.length - 1) {
setIsExecuting(false);
const landed = (await registerColumn(slots[currentPlaybackSlot + 1])) && (await advanceOneSlot());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same partial-failure problem for Step. If registerColumn succeeds and advanceOneSlot fails, the next column stays registered but the playback position doesn't move. Clicking Step again registers the same column again under the same scenario id and override ids. Depending on the engine, the column then either applies twice or replaces the pending copy. In either case, Stop followed by resuming the clock will land it. Consider rolling back the registration on failure, or tracking that this column is already registered so a retry only does the advance.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary

Play now registers only the first column (scenarioRelativeSlot: 0), pauses the clock, and advances one slot. Each Step registers the next column and advances one slot. When the time travel fails, registeredColumnRef records that the column is already registered, so a retry only advances the clock. This removes the "later columns land early / still pending after Stop" problem from the old design. The tests cover the RPC order, a rejected first column, and the retry path.

Assessment

The approach is sound and the code reads clearly. The weak spot is the retry state: registeredColumnRef only knows which column index was registered, not what was registered. It also lives only on the client, so it can drift from what the surfnet actually holds (see the inline comments). That partly undercuts the PR's claim that "Stop has nothing pending".

Other notes:

  • Scope: .github/workflows/claude-review.yml (commit f165aee) is part of this PR but isn't mentioned in the description. Consider splitting it out or at least listing it.
  • Duplication: the per-action OverridePayload builder in registerColumn is a near copy of the one in syncWithBackend (~L305-330). Only scenarioRelativeSlot differs. Extracting a toOverridePayload(action, slot, relativeSlot) helper would keep the two from drifting apart.
  • Silent failure: advanceOneSlot returns false without logging when getEpochInfo is non-OK or returns an error. The failure then looks the same as success apart from the UI not moving.


const handlePlay = async () => {
const [firstSlot] = slots;
if (firstSlot && registeredColumnRef.current !== 0 && !(await registerColumn(firstSlot))) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If Play's advanceOneSlot fails, registeredColumnRef.current stays 0 and the editor stays in read mode, so the user can still edit, reorder or delete columns. On the next Play, registration is skipped and the surfnet applies the old column-1 overrides, not what's on screen. Consider re-registering on every Play attempt (registering the same scenario id should replace it), or clearing the ref whenever slots change.

};

const handleStop = () => {
registeredColumnRef.current = null;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resetting the ref doesn't unregister anything on the surfnet. If a step's (or Play's) time travel failed, that column is still registered with relative slot 0. After Stop it lands on the next block once the clock resumes, which is the exact behaviour the PR says it removes. Consider calling an unregister RPC here (or re-registering an empty scenario under the same id) when registeredColumnRef.current !== null.

registeredColumnRef.current = firstSlot ? 0 : null;

// Register scenario with surfnet (clock is now paused, no race condition)
try {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pausing now happens after registering. If the clock is running, column 1 (relative slot 0) can land on the next natural block during the register → pause window. advanceOneSlot then produces a second, empty slot, so Play consumes two slots and column 1 isn't in the slot Studio produced. That may be acceptable, but it contradicts the PR description. Pausing first and then registering would avoid it, since nothing is scheduled ahead now that only one column is registered.

logger.log('✅ Scenario registered:', registerData);
} else {
console.error('❌ Failed to register scenario:', await registerResponse.text());
if (pauseResponse.ok) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

A failed pause (non-OK response, or a JSON-RPC error in the body) is ignored, and Play goes on to time-travel with the clock possibly still running. Since the whole design relies on a paused clock, consider treating a failed pause like a failed registration, and checking error in the body as registerColumn already does.

// One column is registered at a time, when the user reaches it, so the surfnet never holds
// overrides for a slot it has not produced yet.
const registerColumn = async (slot: Slot) => {
const overrides = slot.actions.map((action) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Empty columns (e.g. the default { height: 0, actions: [] } slot) still send surfnet_registerScenario with overrides: []. If the engine rejects an empty scenario, Play or Step fails on that column. Even if it doesn't, the round trip is wasted. Consider skipping registration when slot.actions.length === 0 and only advancing the slot.

if (currentPlaybackSlot < slots.length - 1) {
setIsExecuting(false);
const next = currentPlaybackSlot + 1;
const registered = registeredColumnRef.current === next || (await registerColumn(slots[next]));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

registeredColumnRef.current === next only compares the column index. That works for the retry path within one play session, but it carries the same stale-content risk as Play if a column can change between attempts. Storing a key such as slots[next].id plus a hash of its actions, rather than a bare index, would make the cache safer.

# Conflicts:
#	apps/studio/src/components/svm/scenario-editor.test.tsx
#	apps/studio/src/components/svm/scenario-editor.tsx

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Overview

Play now registers only column 1 (scenarioRelativeSlot: 0), pauses the clock and advances one slot. Step forward registers the next column and advances one slot. The time-travel code moves into advanceOneSlot(), which now also treats a JSON-RPC error as a failure. registeredColumnRef lets a retry skip registering a column again when only the time travel failed.

Registering columns one at a time is a clean way to remove the early-landing race, and the tests cover the RPC order and both failure paths.

Issues

  • A column can be left registered after a failure. If advanceOneSlot() fails in Play or Step, the column stays registered on the surfnet. In Play's case the clock is also already paused. Stop only clears the local ref. When the clock resumes (header toggle or Complete), that column still lands, which is the "Stop has nothing pending" behaviour the PR sets out to remove. Either unregister the scenario on Stop or failure, or document the gap.
  • A retry can skip registration with stale data. The retry check only looks at the column index (see inline comment).
  • Play with a running clock. Column 1 is registered before the pause. If a block is produced in between, column 1 lands on that block and advanceOneSlot() then produces an extra empty slot. Nothing lands early, but the slot that gets column 1 is no longer certain. This is acceptable if it's intended, but the old comment that warned about ordering is gone, so a short note explaining why register comes before pause would help.
  • Empty columns. registerColumn sends a scenario with overrides: [] for a column with no actions. Skipping the RPC (returning true) would avoid an extra round trip and noise in the surfnet log, and avoids depending on the engine accepting an empty scenario.
  • Unrelated file. The diff also adds .github/workflows/claude-review.yml. This looks unrelated to the PR's purpose, so confirm it's meant to be in this PR.


const startPlay = async () => {
const [firstSlot] = slots;
if (firstSlot && registeredColumnRef.current !== 0 && !(await registerColumn(firstSlot))) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The ref only records which column index is registered, not what it contained. Here's a failing sequence: Play → register succeeds → advanceOneSlot() fails → editor stays in read mode with registeredColumnRef.current === 0 → user edits column 1 → Play again skips registration, so the old overrides land. Clear the ref whenever slots/overrides change, or clear it on the early returns in startPlay. The same applies to the === next check in handleStepForward (L907), though editing is less likely in play mode.

}

if (firstSlot && !(await advanceOneSlot())) {
return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If the advance fails here, the clock has already been paused and column 1 is still registered on the surfnet, but the UI goes back to read mode with no feedback. If the user then resumes the clock, column 1 lands without Play having "started". Consider unregistering or resuming the clock, or at least showing an error.

};

const handleStop = () => {
registeredColumnRef.current = null;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This only resets local state. A column that was registered but never advanced (because a step's time travel failed) is still scheduled on the surfnet and lands the next time the clock runs. If an unregister/clear RPC exists, call it here.

}
// One column is registered at a time, when the user reaches it, so the surfnet never holds
// overrides for a slot it has not produced yet.
const registerColumn = async (slot: Slot) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

For a column with no actions, this registers a scenario with overrides: []. Consider returning true early when slot.actions.length === 0, so the call doesn't add an RPC round trip and doesn't rely on the engine accepting an empty scenario.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary

Play now registers only the first column (relative slot 0), pauses the clock and advances one slot. Each Step registers the next column and then advances. This fixes columns landing early and columns that were still pending after Stop. Splitting the code into registerColumn and advanceOneSlot makes it clearer, and both now check JSON-RPC error bodies instead of only response.ok.

Overall this looks right to me. A few things to look at:

  • Stop during an in-flight Step. The Stop button stays enabled while isStepping is true. When the step finishes, it sets registeredColumnRef, increments currentPlaybackSlot and calls setIsExecuting(true) after Stop has already reset all three. The column also lands, so after Stop the editor's state no longer matches the surfnet.
  • Columns left pending after a failed advance. If Play or Step registers a column and the time travel then fails, the column stays scheduled at relative slot 0 on the surfnet. Stop only clears the local ref, so that column lands as soon as the clock resumes. The PR says "Stop has nothing pending", which doesn't hold on this path. Either document it or deregister the column on Stop.
  • Same id for every column. Every column is registered under the same scenarioId. Please confirm the engine adds each registration rather than replacing one with the same id. This matters most after the failed-advance-then-re-Play path, where column 1 is registered twice.
  • Minor: in startPlay, registeredColumnRef.current !== 0 can never be false. Both exits reset the ref to null, and Stop resets it as well. The check and the = firstSlot ? 0 : null assignment can be dropped.

setIsExecuting(true);
return;
}
registeredColumnRef.current = next;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The Stop button is still clickable while this step is running. If Stop runs during registerColumn or advanceOneSlot, this line puts the ref back after handleStop cleared it. Lines 923–925 then move currentPlaybackSlot past 0 and turn isExecuting back on in read mode, and the column still lands. Either disable Stop while isStepping, or keep a run/generation ref and stop here if Stop ran in the meantime.


// A second Step before the first one finishes would register the same column and skip the next one
const handleStepForward = async () => {
if (isStepping || currentPlaybackSlot >= slots.length - 1) return;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

isStepping is React state, so this guard relies on a re-render happening between two clicks. A useRef flag (the same pattern as registeredColumnRef) would guarantee it, including when the step is triggered programmatically or two clicks are handled before a re-render.


const startPlay = async () => {
const [firstSlot] = slots;
if (firstSlot && registeredColumnRef.current !== 0 && !(await registerColumn(firstSlot))) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Every path that leaves startPlay resets registeredColumnRef.current to null, and so does handleStop, so !== 0 is always true here. Removing the check, and the firstSlot ? 0 : null assignment on line 1005, would make it clear that Play always registers column 1 again.

}

if (firstSlot && !(await advanceOneSlot())) {
// The failed column still lands with the next slot, so the next Play registers it again with any edits

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

After a failed advance, the registered column stays pending on the surfnet and lands on the next produced slot, for example when the clock resumes from the header widget. Re-Play then registers it a second time. Consider deregistering the column, or tell the user in the UI that it is still pending, rather than relying only on console output.

};

const handleStop = () => {
registeredColumnRef.current = null;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Resetting the ref doesn't cancel a column that is already registered on the surfnet. After a Step whose time travel failed, that column still lands when the clock resumes, which goes against the PR's claim that Stop has nothing pending.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary

Play now registers only column 1 at relative slot 0, then pauses the clock and advances one slot. Step registers the next column and advances one slot. advanceOneSlot and registerColumn are pulled out as shared helpers, and both now catch JSON-RPC error bodies as well as HTTP failures. A ref plus state guard stops a double-clicked Step from registering a column twice. The tests check the RPC order at Play and Step, and they cover the retry and failure paths.

Registering columns one at a time is a clean fix for the early-landing race, and the code is easy to follow. The main gap is the failure paths: a column can be registered on the surfnet and never applied in the slot it was meant for. After that, the surfnet still holds an override the UI no longer tracks, so "Stop has nothing pending" no longer holds. Details are inline.

A minor point: column 1 is still registered while the clock is running. With apply-on-block it can land on a clock-produced slot before the pause arrives. advanceOneSlot then produces an extra empty slot. That's harmless, but the log line "paused after scenario registration" and the PR text imply the column always lands in the advanced slot.

logger.log('✅ Scenario registered:', registerData);
} else {
console.error('❌ Failed to register scenario:', await registerResponse.text());
if (pauseResponse.ok) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

A failed pause is only logged, then advanceOneSlot() runs anyway. Two kinds of failure get through: a non-OK HTTP response, and an HTTP 200 whose body carries a JSON-RPC error (that body is never parsed). In both cases playback starts in step mode while the clock keeps running, so Step no longer controls which slot each column lands in. Other paths in this PR now check data.error, so the pause should too. It should probably abort Play on failure, like a failed registration does.

console.error('Error pausing clock:', error);
}

if (firstSlot && !(await advanceOneSlot())) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If the advance fails, Play returns early with column 1 already registered and the clock paused. The UI stays in read mode, so nothing shows that the clock is paused or that an override is pending. Two problems follow:

  1. Column 1 lands on the next produced slot, e.g. when the user resumes the clock, without being in play mode.
  2. The next Play registers column 1 again. That's intended, but if the engine appends rather than replaces by scenario id, the first registration may still be pending and both apply.

Possible fixes: remove or deregister the scenario on failure, or resume the clock and tell the user what happened.

};

const handleStop = () => {
registeredColumnRef.current = null;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Clearing registeredColumnRef only resets local state. Take a Step whose register succeeded but whose time travel failed, followed by Stop: the surfnet still holds that column, and it lands on the next produced slot once the clock resumes. That's the exact "Stop with pending columns" case this PR is meant to remove. When registeredColumnRef.current !== null, Stop should deregister or clear the scenario on the surfnet, or at least say that the column is still pending.

try {
setIsExecuting(false);
const next = currentPlaybackSlot + 1;
const registered = registeredColumnRef.current === next || (await registerColumn(slots[next]));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Every column is registered under the same scenarioId. This is safe only if the engine (surfpool#38) treats each surfnet_registerScenario as a new registration, or replaces the old one only after it has been applied. If registering again with the same id replaces a pending registration, or is rejected as a duplicate, a retried or stale column could be dropped. Add a short comment on the contract this relies on, or use a per-column id (e.g. ${scenarioId}:${slot.height}).

@92Infinitus92
92Infinitus92 merged commit f214a3e into feat/scenarios/override/scenario-playback-support Nov 2, 2026
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