Skip to content

feat(debugger): add statement stepping and polish script editor - #292

Open
jrepp wants to merge 5 commits into
mainfrom
feat/script-debugger
Open

feat(debugger): add statement stepping and polish script editor#292
jrepp wants to merge 5 commits into
mainfrom
feat/script-debugger

Conversation

@jrepp

@jrepp jrepp commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a usable, session-scoped HypeTalk debugger with statement breakpoints, Step Into/Step Over semantics, pollable debug-port automation, modal-error inspection/dismissal, and a script editor whose text and controls remain readable, correctly sized, and synchronized with external script changes.

Context

PR #292 establishes the in-process tracing/debugger implementation used by the live Hype debug bridge and the follow-on MCP surface in PR #286. The earlier handler-entry tracing worked, but authoring and external acceptance testing needed executable-line breakpoints, real nested-call stepping, execution scoping, nonblocking automation, and a reliable script-editor UI.

No .hype document shape, persistence, keychain, provider, or stack file-access behavior changes. Debugger and debug-operation state remains process/session-only. The local debug bridge remains a privileged local Unix-socket boundary and all wrapped mutation calls continue through their existing mutation gates.

Changes Made

  • Added structured HypeTalk handler tracing, runtime profiling, scoped variables, watchpoints, pause/resume controls, and live debugger state.
  • Captured executable statement source locations and validated script-editor breakpoints against handler declarations and executable lines; blank/comment/terminator lines are rejected.
  • Scoped stepping and breakpoint-hit bookkeeping by dispatch and handler execution identity so concurrent runtimes cannot consume each other's debugger state.
  • Implemented Step Into across nested handler calls and Step Over at the next statement in the current/calling handler.
  • Excluded nested debugger pause time from caller runtime-budget accounting so external stepping does not create false frame-pressure reports.
  • Added a bounded process-local debug-operation registry and debug/startOperation, debug/pollOperation, and debug/forgetOperation RPCs. Terminal results expire after five minutes; the registry is capped at 128 operations.
  • Refactored hype_wait_for_debugger_pause and hype_step_script_execution_and_wait to return operation UUIDs immediately instead of holding callers open.
  • Routed stdio MCP button clicks and message dispatch through pollable operations so scripts halted at breakpoints cannot block the MCP caller.
  • Added hype_list_alerts and hype_dismiss_alert, including a modal-run-loop-safe socket path that can inspect and clear document-open errors while normal main-actor work is suspended.
  • Scoped script-editor/debugger window and menu automation to the originating stack, including multi-document editor identity and source navigation.
  • Made open script editors adopt external hype_set_script changes and corrected displayed debug-document activation.
  • Reworked debugger/editor split-pane sizing, fixed command-palette header contrast, and preserved readable light/dark AppKit text, selection, gutter, and syntax colors.
  • Updated architecture/debug-bridge documentation and added focused debugger, operation-lifecycle, automation, appearance, hosted-layout, and timing regressions.

Testing & Verification

  • Ran relevant automated tests on the final source:
    • scripts/test.sh focused debugger/MCP operation filters — 24 tests in 3 suites passed.
    • swift test --no-parallel --filter HypeCoreTests --filter HypeCLITests — 3,361 tests in 349 suites passed, including interpreter fuzz/property coverage.
    • node --check Tools/hype-mcp-server/bin/hype-mcp.js passed.
  • Performed live Unix-socket acceptance testing:
    • A debugger wait returned an operation UUID immediately.
    • debug/pollOperation remained responsive while AppKit displayed an application-modal invalid-document error.
    • The modal was enumerated and dismissed through the debug port, then the operation reached a structured terminal result.
    • Generic start/poll/forget completed successfully for debug/getState.
  • Performed live stdio MCP acceptance testing: attach, hype_start_debug_operation, and hype_poll_debug_operation completed successfully against the deployed app.
  • Visually confirmed the debugger/editor layout, external script refresh, correct multi-document scoping, and readable command-palette/editor appearance.
  • Built/deployed/launched the app: ./script/build_and_run.sh --deploy passed; /Applications/Hype.app was relaunched and verified.
  • git diff --check passed.

Screenshots / GIFs

PR #292 script editor verification

Checklist

  • I read the relevant parts of architecture.md and decisions.md.
  • I considered persistence, network, keychain, file-system, script-execution, and AI-tool safety risks.
  • I added or updated tests, or explained why tests are not needed.
  • I updated documentation for behavior, setup, architecture, persistence, or workflow changes.
  • I did not stage or rewrite .hype stack documents unless required by this change.
  • I noted any follow-up work or known limitations.

Known limitations: debugger breakpoints, watchpoints, pauses, trace entries, and pollable operation results are intentionally process/session state and are not persisted into user stacks. Pending operations remain until their underlying work completes; completed and failed results expire after five minutes.

@jrepp
jrepp force-pushed the feat/script-debugger branch from 9a60a0f to 6652e99 Compare June 21, 2026 01:08
@jrepp
jrepp changed the base branch from feat/rendering-canvas-sync to main June 21, 2026 01:08
@jrepp
jrepp force-pushed the feat/script-debugger branch 2 times, most recently from 1c74bff to c26f8f9 Compare June 21, 2026 16:05
jrepp added 4 commits July 30, 2026 15:42
…cing

- Add HypeTalkScriptTraceRecorder for structured execution traces
- Add ScriptDebuggerView for visual script debugging
- Add HypeTraceConfiguration for startup lifecycle tracing
- Wire MessageDispatcher tracing hooks
- Add GoMenuCommands debugger menu items
- Configure HypeApp trace lifecycle (trace once, prevent duplicates)
- Tests: HypeTalkScriptTraceRecorderTests, HypeTraceConfigurationTests
Add script debugger menu automation hooks, window/debugger wait tools, shared step controls, and breakpoint state cleanup coverage. Document handler-entry breakpoint limits and keep debugger teardown centralized through HypeTalkScriptTraceRecorder.resetDebuggerState().
Track dispatch and handler execution identity so Step Into and Step Over remain scoped across nested and concurrent handler runs. Capture parser statement locations for executable line breakpoints and keep the debug bridge, docs, and regression coverage aligned.
Give the script editor stable three-pane sizing and fixed toolbar controls, resolve readable AppKit theme colors, and keep attributed glyphs visible through the hosted scroll-view compositor. Add light/dark and hosted-layout regressions.
@jrepp
jrepp force-pushed the feat/script-debugger branch from c26f8f9 to b2f1eab Compare July 30, 2026 23:04
@jrepp jrepp changed the title feat(debugger): add HypeTalk script trace recording and lifecycle tracing feat(debugger): add statement stepping and polish script editor Jul 30, 2026
@jrepp
jrepp requested a review from mweingartner July 30, 2026 23:15
Return operation handles for debugger waits and script-dispatch hooks so external acceptance clients remain responsive across breakpoints and AppKit modal loops. Include editor/window scoping, visual refresh, alert automation, timing remediation, regression coverage, and protocol documentation from the live QA pass.
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