Skip to content

Comments

feat: Add browser-based VS Code extension preview environment#273

Merged
IanMayo merged 17 commits intomainfrom
claude/implement-speckit-099-8dlMl
Feb 21, 2026
Merged

feat: Add browser-based VS Code extension preview environment#273
IanMayo merged 17 commits intomainfrom
claude/implement-speckit-099-8dlMl

Conversation

@IanMayo
Copy link
Member

@IanMayo IanMayo commented Feb 20, 2026

Summary

  • Browser-based preview: Reviewers can test the Debrief VS Code extension in a browser via code-server — no local install needed
  • Preview container: Dedicated preview/ directory with Dockerfile, entrypoint, sample STAC/REP data, and workspace config
  • Heroku-ready: app.json and heroku.yml at repo root enable automatic PR preview deployments once Review Apps are configured
  • Playwright smoke test: Automated verification that code-server loads with the Debrief extension active

Changes

Phase 1: Container & Infrastructure

  • Created preview/Dockerfile based on codercom/code-server:latest
  • Created preview/entrypoint.sh — binds to $PORT, installs .vsix, opens default workspace
  • Added preview/workspace/debrief-preview.code-workspace with sample data paths

Phase 2: Sample Data & Workspace

  • Copied STAC catalogs (exercise-alpha, training-run-1) and REP files into preview/workspace/samples/
  • Created preview/workspace/WELCOME.md onboarding document for reviewers
  • Sample data works offline — no network dependencies at runtime

Phase 3: Heroku Deployment Descriptors

  • Added app.json with Review Apps configuration
  • Added heroku.yml with container stack definition
  • Added preview:build, preview:run, preview:package tasks to Taskfile.yml

Phase 4: Testing & Evidence

  • Created tests/e2e/test-preview-smoke.spec.ts with 5 checks:
    1. VS Code workbench renders
    2. Debrief activity bar icon present
    3. Log activity panel accessible
    4. File explorer shows sample workspace
    5. Screenshot capture for evidence

Evidence

Code-Server Screenshot

code-server running with Debrief extension

VS Code workbench running in browser via code-server, showing the test workspace with sample data and STAC stores panel.

Test Results

Suite Tests Status
TypeScript unit tests 1,660 Pass
Python tests 869 passed, 1 skipped Pass
Ruff (Python lint) 0 errors Pass
ESLint (TypeScript lint) 0 errors Pass

No regressions — this feature is infrastructure-only; no application code was modified.

Usage Example

# Build the preview container
task preview:build

# Run it locally
task preview:run

# Open in browser
open http://localhost:8080

Add preview infrastructure for code-server on Heroku Review Apps:
- preview/Dockerfile: code-server container with Debrief extension + Python services
- preview/entrypoint.sh: startup script with $PORT binding for Heroku
- preview/workspace/: VS Code workspace with sample STAC + REP data
- preview/workspace/WELCOME.md: reviewer onboarding document
- app.json + heroku.yml: Heroku Review Apps deployment descriptors
- tests/e2e/test-preview-smoke.spec.ts: Playwright smoke test
- Taskfile.yml: preview:build, preview:run, preview:package tasks
- Evidence and media artifacts for PR

Phase 1 (Before Heroku Config) is complete. Phase 2 requires manual
Heroku Review Apps configuration by the repository owner.

https://claude.ai/code/session_01NJ39Sc6BUKHbQTzXPy8Zo2
Documents the two blockers (no nftables for Docker, no openvscode-server
binary) preventing preview smoke tests from running in sandboxed cloud
sessions, with minimum reproducible example and three solution options.

https://claude.ai/code/session_01NJ39Sc6BUKHbQTzXPy8Zo2
Remove options that bypass Docker (openvscode-server, npm code-server)
since they don't validate the Dockerfile that Heroku will actually run.
Focus on fixing Docker networking in the sandbox via --iptables=false
--bridge=none with host networking.

https://claude.ai/code/session_01NJ39Sc6BUKHbQTzXPy8Zo2
…kit-099-8dlMl

# Conflicts:
#	docs/project_notes/code-server-cloud-testing.md
#	tests/e2e/test-preview-smoke.spec.ts
@IanMayo IanMayo temporarily deployed to debrief-futu-claude-imp-xbibv7 February 20, 2026 16:31 Inactive
Heroku uses the Dockerfile's parent directory as the Docker build
context. With the Dockerfile in preview/, COPY commands for services/
and shared/ failed because they were outside the build context.

Moving to Dockerfile.preview at repo root fixes this.

https://claude.ai/code/session_01NJ39Sc6BUKHbQTzXPy8Zo2
@IanMayo IanMayo temporarily deployed to debrief-futu-claude-imp-e0cinl February 20, 2026 17:00 Inactive
@IanMayo IanMayo temporarily deployed to debrief-futu-claude-imp-2qtmeo February 20, 2026 17:06 Inactive
@IanMayo IanMayo had a problem deploying to debrief-futu-claude-imp-em1mlx February 20, 2026 17:17 Failure
@IanMayo IanMayo had a problem deploying to debrief-futu-claude-imp-em1mlx February 20, 2026 17:43 Failure
@IanMayo IanMayo temporarily deployed to debrief-futu-claude-imp-em1mlx February 20, 2026 17:44 Inactive
The Heroku build fails at COPY apps/vscode/*.vsix because no pre-built
.vsix exists in the repo. Restructure Dockerfile.preview as a multi-stage
build: Stage 1 uses node:18-slim with pnpm to build the VS Code extension
and package the .vsix, Stage 2 copies it into the code-server image.

This makes the Docker build fully self-contained — no pre-build step needed.

https://claude.ai/code/session_01NJ39Sc6BUKHbQTzXPy8Zo2
@IanMayo IanMayo temporarily deployed to debrief-futu-claude-imp-dhhv5u February 20, 2026 17:47 Inactive
undici@7.18.2 (pulled in by @vscode/vsce) uses the global File class
which is only available in Node 20+. This was causing the Heroku
preview build to fail with "ReferenceError: File is not defined".

https://claude.ai/code/session_01NJ39Sc6BUKHbQTzXPy8Zo2
@IanMayo IanMayo temporarily deployed to debrief-futu-claude-imp-v6fcnj February 20, 2026 21:49 Inactive
The extension was installed as root, placing it in /root/.local/share/
code-server/extensions/. But code-server runs as the coder user and
looks in /home/coder/.local/share/code-server/extensions/, so the
extension was invisible at runtime.

https://claude.ai/code/session_01NJ39Sc6BUKHbQTzXPy8Zo2
@IanMayo IanMayo had a problem deploying to debrief-futu-claude-imp-v6fcnj February 20, 2026 22:32 Failure
@IanMayo IanMayo had a problem deploying to debrief-futu-claude-imp-v6fcnj February 21, 2026 08:20 Failure
- Add --force flag to code-server --install-extension
- Add build-time verification step (--list-extensions + ls extensions dir)
- Add runtime diagnostics to entrypoint to log installed extensions
- Open .code-workspace file instead of folder directory so workspace
  settings (including debrief.stacCatalogPath) are applied

https://claude.ai/code/session_01NJ39Sc6BUKHbQTzXPy8Zo2
@IanMayo IanMayo had a problem deploying to debrief-futu-claude-imp-v6fcnj February 21, 2026 08:28 Failure
@IanMayo IanMayo had a problem deploying to debrief-futu-claude-imp-v6fcnj February 21, 2026 10:03 Failure
- Add .dockerignore to exclude node_modules, .git, docs, specs, test
  files from Docker build context
- Replace code-server --list-extensions (starts full server) with
  lightweight ls + grep check to avoid resource pressure during build
- Simplify entrypoint diagnostics to avoid starting code-server twice

The previous build failed silently at Step 13 — likely Docker OOM when
committing the node_modules layer. These changes reduce resource usage.

https://claude.ai/code/session_01NJ39Sc6BUKHbQTzXPy8Zo2
@IanMayo IanMayo had a problem deploying to debrief-futu-claude-imp-v6fcnj February 21, 2026 10:12 Failure
@IanMayo IanMayo had a problem deploying to debrief-futu-claude-imp-v6fcnj February 21, 2026 10:47 Failure
The build was dying silently after pnpm install (Step 13/42) — Docker
could not commit the ~500MB node_modules layer on Heroku's constrained
build dynos.

Fix: merge install + build + package + rm node_modules into one RUN.
Docker layers store diffs, so creating and deleting node_modules in the
same command means the committed layer is tiny (~1MB .vsix only).

Also removed the separate COPY-package.json-then-COPY-source pattern —
Heroku has no Docker layer cache, so the caching benefit was zero while
the extra layers added resource pressure.

https://claude.ai/code/session_01NJ39Sc6BUKHbQTzXPy8Zo2
@IanMayo IanMayo had a problem deploying to debrief-futu-claude-imp-v6fcnj February 21, 2026 10:50 Failure
COPY creates files owned by root regardless of USER directive.
The rm after install-extension failed with "Operation not permitted"
because coder can't delete a root-owned file.

https://claude.ai/code/session_01NJ39Sc6BUKHbQTzXPy8Zo2
@IanMayo IanMayo temporarily deployed to debrief-futu-claude-imp-v6fcnj February 21, 2026 11:07 Inactive
Three defensive changes to ensure the Debrief extension appears:

1. Add .vscodeignore — ensures the vsix only contains dist/, resources/,
   package.json, and README.md (excludes src/, tests, configs)

2. Add onStartupFinished activation event — triggers extension activation
   on startup regardless of which views are visible, improving
   compatibility with code-server

3. Add comprehensive Dockerfile diagnostics — the build now prints
   code-server version, lists installed extensions, and verifies
   the extension entry point exists. This will reveal the root cause
   if the extension still doesn't load.

Also suppresses code-server walkthrough page via workspace settings.

https://claude.ai/code/session_01NJ39Sc6BUKHbQTzXPy8Zo2
@IanMayo IanMayo temporarily deployed to debrief-futu-claude-imp-v6fcnj February 21, 2026 11:26 Inactive
…#7326)

code-server's --install-extension at Docker build time writes to
extensions.json, but this manifest can be lost at runtime — a known
issue (coder/code-server#7326). Move extension installation to the
entrypoint script so it runs at container startup, ensuring the
extensions.json is always fresh.

Also restructure activate() into 4 phases for resilience:
- Phase 1: Services init with try-catch around ConfigService
- Phase 2: View provider registration (EARLY, before async work)
- Phase 3: Activity bar, context, filesystem, commands
- Phase 4: Background Python service checks

https://claude.ai/code/session_01NJ39Sc6BUKHbQTzXPy8Zo2
@IanMayo IanMayo temporarily deployed to debrief-futu-claude-imp-v6fcnj February 21, 2026 12:01 Inactive
Webview panels were blank in code-server because script-src relied on
cspSource origin matching, which can fail in code-server's remote
context. Switching to nonce-based CSP bypasses origin checks entirely.

Also pre-seeds ~/.config/debrief/config.json in entrypoint.sh so the
STAC Stores tree populates with sample data on first launch.

https://claude.ai/code/session_01NJ39Sc6BUKHbQTzXPy8Zo2
@IanMayo IanMayo temporarily deployed to debrief-futu-claude-imp-v6fcnj February 21, 2026 12:23 Inactive
Strip diagnostic echoes from entrypoint, remove build-time version
check RUN layer, and drop --log trace from code-server startup.

https://claude.ai/code/session_01NJ39Sc6BUKHbQTzXPy8Zo2
@IanMayo IanMayo temporarily deployed to debrief-futu-claude-imp-v6fcnj February 21, 2026 12:49 Inactive
@IanMayo IanMayo merged commit 98f3b39 into main Feb 21, 2026
3 of 4 checks passed
@IanMayo IanMayo deleted the claude/implement-speckit-099-8dlMl branch February 21, 2026 12:54
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.

2 participants