Skip to content

Add legacy web renderer debugger bridge - #157

Closed
bjdodson-openai wants to merge 1 commit into
bjd/debugger-inputfrom
bjd/debugger-web-bridge
Closed

Add legacy web renderer debugger bridge#157
bjdodson-openai wants to merge 1 commit into
bjd/debugger-inputfrom
bjd/debugger-web-bridge

Conversation

@bjdodson-openai

Copy link
Copy Markdown
Collaborator

Description

Bridges the debugger to Snap's existing legacy web renderer without requiring the unrelated renderer/runtime rewrite.

  • Uses backing-node traversal with bounded, getter-safe serialization.
  • Keeps embedded pages isolated and retained handles inert after teardown.
  • Adds adversarial liveness, mutation, Unicode, depth, and envelope coverage.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • Documentation improvement
  • Performance optimization
  • Test improvement
  • Other (new debugger capability)

Testing

  • Tests pass locally (bazel test //...)
  • Added/updated tests for changes (if applicable)
  • Tested on multiple platforms (iOS/Android/Web/macOS as applicable)
  • Manual testing performed (describe below)

Testing Details

  • Incremental branch: Focused web-renderer Bazel suite passed 85/85; pinned TypeScript, runtime probes, formatting, and diff checks passed.
  • Assembled debugger stack: npm test passed 436/436; the CLI production build passed.
  • Focused //src/valdi_modules/src/valdi/web_renderer:test passed.
  • bazel query //... passed.
  • The broad Valdi suite reproduced the established 12 unrelated failures; all new debugger specs passed.

Checklist

  • Code follows project style guidelines
  • Documentation updated (if needed)
  • No breaking changes (or documented in description)
  • Commit messages follow conventional format
  • No secrets, API keys, or internal URLs included

Related Issues

Relates to #154

Additional Context

Stack 4/22. Stacked on #156 (bjd/debugger-input). Review this PR as the single incremental commit 6f465ec0 against that base; do not merge it before its parent.

@github-actions

Copy link
Copy Markdown

📊 PR Size: size/XL

Total changes: 2183 lines (7 files)

Top files changed:

  • src/valdi_modules/src/valdi/web_renderer/test/LegacyWebDebuggerAdapter.spec.ts: +909 -0
  • src/valdi_modules/src/valdi/web_renderer/src/ValdiWebRendererDelegate.ts: +626 -4
  • src/valdi_modules/src/valdi/web_renderer/test/WebDebuggerBridge.spec.ts: +314 -0
  • src/valdi_modules/src/valdi/web_renderer/src/debug/WebDebuggerBridge.ts: +275 -0
  • src/valdi_modules/src/valdi/web_renderer/test/LocationQuery.spec.ts: +30 -0
  • src/valdi_modules/src/valdi/web_renderer/src/utils/LocationQuery.ts: +21 -0
  • src/valdi_modules/src/valdi/web_renderer/src/ValdiWebRenderer.ts: +4 -0

Size calculated as additions + deletions. Labels: XS (<10), S (<50), M (<250), L (<1000), XL (1000+)

@github-actions

Copy link
Copy Markdown

⚠️ Bazel & CI Test Results

Test Suite Result
Snapshot Tests ✅ success
Test Coverage Delta ✅ success
Valdi Smoke Tests ✅ success
API Surface Check ✅ success
Linux: C++ Tests ✅ success
Linux: Registry Validation ✅ success
Linux: Build Compiler ✅ success
Linux: Module Tests ✅ success
Linux: Build & Export ✅ success
valdi_web Integration Test ✅ success
Linux: Hotreload Smoke ✅ success
macOS: C++ & Platform Tests ❌ failure

Some tests failed. Please check the workflow logs for details.

🚀 Bazel remote cache is now enabled - future builds will be faster!

Workflow: Valdi CI

@clholgat clholgat left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Review of the legacy web renderer debugger bridge. The serialization is impressively defensive (bounded depth/entries/characters, getter-safe, liveness re-checks), and the bridge is correctly restricted to top-level windows via query flags with no eval / postMessage receiver / injection sink. One medium item is inline; one low is below.

NOTE: This 24-PR stack is being squashed into ~3 PRs — please carry this feedback into the squashed PR(s).

🟢 Low — ValdiWebRendererDelegate.ts onElementDestroyed (~L112-146): changed from single-element destroyElement to a full recursive subtree teardown on the production render path (not debug-gated), to keep backing-node parent/child pointers consistent for the debug traversal. It is idempotent and guarded, but it couples core teardown semantics to a debug-only requirement — a regression here would affect all web rendering, not just debugging. Worth a comment explaining why the subtree walk is required, plus test coverage for the non-debug destroy path.


export interface StandaloneWebDebuggerRuntime {
clearHighlight?(): boolean;
getSnapshot(): StandaloneWebDebuggerSnapshot;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🟠 Med — This bridge exposes only getSnapshot/highlightNode and does not implement the unified ValdiDebuggerInput contract from the input-control PR (tap/focus/text/key/scroll). As a result valdi inspect input tap|text|key|scroll against a legacy-web-renderer target silently returns the "target app did not register the Valdi debugger input handler" fallback — input forwarding works on native but no-ops on web, with no shared abstraction between the two debugger surfaces.

Failure: users driving input through the CLI/panel get silent no-ops on web targets.

Suggested fix: at minimum document the read/highlight-only scope of the web bridge; ideally route web input through the same contract so the two surfaces don't diverge as the stack is unwound.

@bjdodson-openai

Copy link
Copy Markdown
Collaborator Author

Superseded by #180, which consolidates this patch into the reviewed debugger capabilities landing unit. The replacement carries forward the feedback and fixes discussed here. Closing this draft to reduce the active stack; this PR and its discussion remain the historical review record.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants