Skip to content

e-stepper: work out the store at a step from the steps before it - #185

Open
martin-henz wants to merge 1 commit into
mainfrom
estepper-store-from-history
Open

martin-henz wants to merge 1 commit into
mainfrom
estepper-store-from-history

Conversation

@martin-henz

Copy link
Copy Markdown
Member

Plugin side of source-academy/py-slang#611 (py-slang PR #612). Idea from @martin-henz: what is unreachable stays unreachable, so it need not be repeated in the steps after it.

Protocol. EStepperStep.frames / .heap are now documented (common-e-stepper) as the reachable frames and objects plus those that become unreachable in this step. A host works out the store at a step from that step and the ones before it: the latest version of every frame and object, those the step itself does not have being unreachable. An evaluator that still repeats them in every step gives exactly the same store, so the change is compatible both ways.

Plugin. storeAt(steps, index) (src/web/e-stepper/src/store.ts) does this, incrementally (moving on by one step adds that step's items only) and in creation order, the global frame first. EStepperView uses it for the diagram, the frame colours, the object lookup and the availability of "Clear Unreachable Objects". When the frontend lends its CSE diagram nothing changes: that one already takes the unreachable frames from the earlier snapshots.

Rollout. Release this first: with the new py-slang and the old plugin the older unreachable frames would be missing from the plugin's own diagram (the frontend's diagram is not affected).

Two changesets, one per package (web-e-stepper is ignored, common-e-stepper is not, so they are not mixed): patch for each (the common one is the documentation of the type).

Checked: prettier, eslint (no errors), yarn vitest run src/web/e-stepper src/common/e-stepper (94 tests), including store.test.ts and a view test for a frame that became unreachable in an earlier step.

🤖 Generated with Claude Code

…nes before it

An evaluator can then put a frame or an object that has become unreachable in the step
where it does, and in none after it, instead of repeating all of them in every step
(py-slang#611: the steps of a loop that makes a frame in each iteration grew with the
square of their number). An evaluator that does repeat them gives the same store.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Oct 19, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b55d4f8

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

This branch has not been deployed

No deployments
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