Skip to content

CSE machine: StreamViz arrow drawing#3747

Open
of89p wants to merge 30 commits intomasterfrom
streamVis
Open

CSE machine: StreamViz arrow drawing#3747
of89p wants to merge 30 commits intomasterfrom
streamVis

Conversation

@of89p
Copy link
Copy Markdown

@of89p of89p commented Apr 6, 2026

Description

Created new panel in CSE machine for Stream Visualization (pairs and nullary functions belonging to streams).

Displays results from streamViz js-slang PR (source-academy/js-slang#1939). Specifically, we use results from streamLineage from the Context object to draw dotted arrows from a nullary function to the pair(s) it returns.

The map streamLineage (Found in context object, types.ts) that maps the ID of nullary functions to the pairs it returns.

Everytime a CALL0 is called in the control, we push a tuple (nullaryFnID, controlStackHeight) to the pendingStreamFnStack[]. Within generateCSEMachineStateStream, we check the whether the height of the control stack has reached the height of i-1, where i is the controlStackHeight when we pendingStreamFnStack.peek(). If so, we pop pendingStreamFnStack.pop() and we add the pair that is at the top of the stash to the array of pairs that the nullaryFnID maps to, using streamLineage.

See also frontend issue: #3727

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Code quality improvements

How to test

Checklist

  • I have tested this code
  • I have updated the documentation

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a "Pair Visualisation" feature to the CSE Machine, enabling stream lineage visualization through a new toggleable mode. The changes include state management for streamsPointSteps, new arrow components, and logic to link array values to their originating functions. Feedback focuses on removing non-portable local file paths in package.json, deleting an accidentally committed build artifact, and cleaning up leftover debug logs, commented-out code, and redundant logic in the FnValue component.

Comment thread package.json Outdated
Comment thread package.json Outdated
Comment thread tsconfig.tsbuildinfo Outdated
Comment thread src/features/cseMachine/CseMachineLayout.tsx Outdated
Comment thread src/features/cseMachine/components/arrows/ArrowFromStreamNullaryFn.tsx Outdated
Comment thread src/features/cseMachine/components/values/ArrayValue.tsx
Comment thread src/features/cseMachine/components/values/FnValue.tsx
Comment thread src/features/cseMachine/CseMachine.tsx
Comment thread src/features/cseMachine/components/values/FnValue.tsx
Comment thread package.json Outdated
Comment thread src/features/cseMachine/CseMachineLayout.tsx Outdated
Comment thread src/features/cseMachine/components/values/FnValue.tsx Outdated
Comment thread src/commons/sideContent/content/SideContentCseMachine.tsx Outdated
@martin-henz martin-henz marked this pull request as ready for review April 10, 2026 01:10
@martin-henz martin-henz added the blocked Something else needs pass review first label Apr 13, 2026
@martin-henz martin-henz mentioned this pull request Apr 13, 2026
7 tasks
@martin-henz martin-henz changed the title StreamViz arrow drawing CSE machine: StreamViz arrow drawing Apr 13, 2026
@martin-henz martin-henz removed the blocked Something else needs pass review first label Apr 17, 2026
@coveralls
Copy link
Copy Markdown

Coverage Report for CI Build 24557419822

Coverage decreased (-0.1%) to 40.688%

Details

  • Coverage decreased (-0.1%) from the base build.
  • Patch coverage: 73 uncovered changes across 6 files (24 of 97 lines covered, 24.74%).
  • 1 coverage regression across 1 file.

Uncovered Changes

File Changed Covered %
src/features/cseMachine/components/arrows/ArrowFromStreamNullaryFn.tsx 27 0 0.0%
src/features/cseMachine/components/values/FnValue.tsx 25 5 20.0%
src/features/cseMachine/CseMachine.tsx 19 7 36.84%
src/commons/sideContent/content/SideContentCseMachine.tsx 9 1 11.11%
src/features/cseMachine/components/values/ArrayValue.tsx 7 3 42.86%
src/features/cseMachine/components/arrows/DottedArrow.tsx 2 0 0.0%

Coverage Regressions

1 previously-covered line in 1 file lost coverage.

File Lines Losing Coverage Coverage
src/features/cseMachine/CseMachine.tsx 1 48.79%

Coverage Stats

Coverage Status
Relevant Lines: 13916
Covered Lines: 6117
Line Coverage: 43.96%
Relevant Branches: 7041
Covered Branches: 2410
Branch Coverage: 34.23%
Branches in Coverage %: Yes
Coverage Strength: 28.67 hits per line

💛 - Coveralls

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.

6 participants