Skip to content

feat: add interactive Python execution stepper and notional machine state visualizer - #92

Open
editor-shannu wants to merge 10 commits into
vicharanashala:mainfrom
editor-shannu:main
Open

feat: add interactive Python execution stepper and notional machine state visualizer#92
editor-shannu wants to merge 10 commits into
vicharanashala:mainfrom
editor-shannu:main

Conversation

@editor-shannu

Copy link
Copy Markdown

Summary

This PR adds PyBe TraceLab, an interactive code execution and state inspection interface that allows learners to step through Python code line-by-line, observe live memory state changes, and engage in Socratic state prediction before code executes.

Problem Statement

When learning Python, beginners often encounter the "hidden state illusion" where code on screen is static, but runtime memory state is actively mutating. Previously, PyBe only generated code without an interactive way to inspect memory registers, variable lifetimes, or step-by-step branch evaluations.

Key Features

  • Interactive Execution Stepper: Step forward/backward line-by-line with play/pause and adjustable playback speed (0.5x, 1x, 2x).
  • Variable Memory Watch: Displays active variable names, data types (int, float, str, list, dict, bool), current values, and mutation highlights showing previous vs. updated values.
  • Socratic State Prediction: Micro-checkpoints pause execution at critical decision points and ask learners to predict variable values or condition results before stepping forward.
  • Real-World Context Anchors: Connects abstract memory state updates back to the scenario's physical domain.
  • Misconception Detection: Identifies common novice errors (e.g., assignment in condition, range upper bound exclusion, accumulator reset inside loop) with actionable remediation tips.
  • Interactive Sandbox: Allows testing arbitrary Python code with real-time step-by-step state tracing.
  • Cognitive Analytics: Tracks prediction accuracy and concept mastery metrics.

Verification & Testing

  1. Tested client production build: npm run build --prefix client (passed with 0 errors).
  2. Seeded curriculum data: npm run seed --prefix server (seeded 30 scenarios).
  3. Verified API endpoints:
    • POST /api/tracer/trace returns structured execution steps and variable snapshots.
    • POST /api/tracer/predict accurately scores prediction answers.
  4. Tested in browser: verified stepper navigation, playback controls, variable mutation highlights, and sandbox trace generator.

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