Dataface Tasks

Open in browser regression coverage and shell-safe serve launch

IDIDE_EXTENSION-OPEN_IN_BROWSER_REGRESSION_COVERAGE_AND_SHELL_SAFE_SERVE_LAUNCH
Statuscompleted
Priorityp1
Milestonem1-ft-analytics-analyst-pilot
Ownerhead-of-engineering
Completed bydave
Completed2026-03-16

Problem

The March 16, 2026 openInBrowser() fix corrected the broken port and project-dir behavior, but it still left two quality gaps. First, the tests only cover buildServeUrl() as a pure helper, so the actual openInBrowser() flow can regress without test failures if terminal launch, workspace-folder resolution, or delayed browser open behavior changes. Second, the terminal command still depends on shell interpolation for the project directory path, which is avoidable and makes path handling more fragile than necessary. Both gaps sit directly on the IDE extension's preview-to-browser workflow, so they should be closed with a narrow follow-up patch and regression coverage.

Context

  • apps/ide/vscode-extension/src/preview/preview-manager.ts owns the openInBrowser() behavior for launching dft serve and opening the rendered dashboard URL.
  • apps/ide/vscode-extension/src/preview/preview-manager.test.ts already uses Vitest and mocks the VS Code surface, so it is the right place to extend coverage to the real browser-open flow.
  • dft serve defaults to port 9876, and the correct usage for this extension is to serve a project root and open the dashboard route derived from the current document path.
  • VS Code terminal creation supports passing cwd via terminal options, which lets the extension avoid embedding the project directory path directly in the shell command string.

Possible Solutions

  • Keep testing only buildServeUrl() and leave shell interpolation in place. This is the smallest change, but it does not cover the actual regression surface and leaves brittle command construction untouched.
  • Add a helper for quoting shell arguments and keep passing projectDir inside the command string. This improves quoting somewhat, but it still relies on shell parsing and is more complex than necessary across terminal environments.
  • Recommended: update openInBrowser() to create the terminal with cwd: projectDir and run dft serve --project-dir ., then add end-to-end unit tests that verify terminal creation, command text, workspace fallback behavior, and delayed browser open. This removes the avoidable projectDir shell interpolation risk while testing the real behavior that matters.

Plan

  • Patch openInBrowser() in apps/ide/vscode-extension/src/preview/preview-manager.ts to use terminal cwd instead of interpolating projectDir into the command string.
  • Extend apps/ide/vscode-extension/src/preview/preview-manager.test.ts with focused tests that exercise the full openInBrowser() flow using mocked VS Code APIs and fake timers.
  • Run the extension unit tests for preview-manager.test.ts, then update this task with implementation notes and validation results.

Implementation Progress

  • Created follow-up task after reviewing merged commit b3e0e2adade7d97dfaba305059ab71eabb408bf0 / PR #594.
  • Confirmed the original fix is valid and that the two remaining gaps are test coverage scope and avoidable shell interpolation of projectDir.
  • Updated openInBrowser() to set the terminal cwd to the resolved project directory and launch dft serve --project-dir ..
  • Added regression tests that verify terminal creation options, command text, browser URL opening, and fallback behavior when no workspace folder exists.
  • just task validate tasks/workstreams/ide-extension/tasks/open-in-browser-regression-coverage-and-shell-safe-serve-launch.md passed.
  • npm run test:unit -- src/preview/preview-manager.test.ts and npm run compile are currently blocked by the local Homebrew Node installation missing libsimdjson.29.dylib, so TypeScript and Vitest could not be executed in this environment.
  • Rebased the follow-up branch onto origin/main and resolved the expected conflict with merged PR #594 by keeping the upstream URL helper changes and retaining the safer terminal cwd launch plus the new openInBrowser() tests.
  • scripts/pr-validate pre now gets through rebase and repo CI startup, but fails in an unrelated docs check: tests/docs/test_tasks_build.py::test_tasks_mkdocs_builds_in_strict_mode due to TemplateNotFound: 'chat/_suggestions.html' in tasks/workstreams/mcp-analyst-agent/tasks/chat-first-home-page-conversational-ai-interface-for-dataface-cloud.md.
  • Fixed the unrelated docs blocker by replacing the live Jinja include snippet in tasks/workstreams/mcp-analyst-agent/tasks/chat-first-home-page-conversational-ai-interface-for-dataface-cloud.md with plain prose, then reran scripts/pr-validate pre successfully.
  • uv run --project libs/cbox cbox review approved the branch with one low-severity recommendation to add a null-CLI-path test, but no blocking issues.

Review Feedback

  • uv run --project libs/cbox cbox review approved the branch. Notes: low-severity recommendation to add an explicit cliPath === null test; not required for approval.

  • [x] Review cleared