Skip to content

Hermetic webview HTTP test fixture migration #211

Description

@DrumRobot

Summary

packages/vscode-extension/src/test/suite/webview.test.ts:379-462 (the session-page HTTP test) essentially never runs in automation:

  • CI: skipped via process.env.CI check
  • Local without ~/.claude/projects/ populated: skipped via findFirstSession() === null
  • Local with ~/.claude/projects/ populated: runs, but depends on whichever session happens to be first on disk — non-deterministic

A test that essentially never runs in automation provides regression detection only when a developer happens to run it locally. The risk it's supposed to prevent (a runtime bug in /session/{project}/{id} SSR) goes uncaught.

Origin

Raised by CodeRabbit on PR #163, confirmed valid by Internal Code Review (partial agreement — see PR #163 review comment). Deliberately deferred out of PR #163's scope to avoid a 4-test refactor blast radius.

Proposed fix

CodeRabbit's suggestion: set CLAUDE_SESSIONS_DIR to a fixture directory (e.g. packages/test-fixtures/sessions) in runTest.ts, and update the test to seed a deterministic fixture session so findFirstSession() always finds it, regardless of CI or local environment.

Scope caution: this is not a 1-test change. Changing the CLAUDE_SESSIONS_DIR data source affects:

  • The 3 sibling HTTP tests in the same suite (Web server responds with HTTP 200, Frontend root path responds with HTTP 200, Open Web UI opens external browser)
  • path.test.ts:117-123, which already branches on this env var

A coordinated migration of all 4 HTTP tests to the fixture-based approach is needed, not an isolated fix to the session-page test alone.

Acceptance criteria

  • All 4 HTTP tests in webview.test.ts (and any others sharing the CI-skip/real-data pattern) use a deterministic fixture session directory
  • Tests run in CI (no process.env.CI skip needed once data is deterministic)
  • path.test.ts:117-123's existing branch on CLAUDE_SESSIONS_DIR is verified compatible with the new fixture setup

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions