Skip to content

[TECH] Keep VS Code version in sync across package.json, runTest.ts, and e2e workflow cache key #694

Description

@edelauna

Problem

The VS Code version 1.100.0 is hardcoded in 3 separate locations:

Location Line Usage
apps/vscode-e2e/package.json 21 "@types/vscode": "1.100.0"
apps/vscode-e2e/src/runTest.ts 164 version: process.env.VSCODE_VERSION || "1.100.0"
.github/workflows/e2e.yml 44 key: vscode-test-${{ runner.os }}-1.100.0-v1

When @types/vscode is manually updated, all three locations must be updated together. If they drift:

  • Cache misses occur (downloading VS Code binary every run)
  • Version mismatches between types and downloaded binary
  • Potential test failures

Context

  • Renovate is configured to disable automatic updates for @types/vscode (see renovate.json lines 87-90)
  • This is the correct approach for VS Code extensions (types must align with engines.vscode)
  • Manual updates are still expected when intentionally bumping minimum VS Code version

Expected Result

Version should be updated in all locations when @types/vscode changes.

Proposed Solutions

Option 1: Dynamic cache key extraction (Recommended)

# In .github/workflows/e2e.yml
- name: Get VS Code version from package.json
  id: vscode-ver
  run: |
    VERSION=$(node -p 'require("./apps/vscode-e2e/package.json").devDependencies["@types/vscode"]')
    echo "version=$VERSION" >> $GITHUB_OUTPUT

- name: Cache VS Code test binary
  uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
  with:
    path: apps/vscode-e2e/.vscode-test/
    key: vscode-test-${{ runner.os }}-${{ steps.vscode-ver.outputs.version }}-v1

This keeps the cache key in sync with package.json automatically.

Option 2: Documentation reminder

Add a comment in the workflow:

# NOTE: Keep in sync with apps/vscode-e2e/package.json devDependencies["@types/vscode"]
# Update only when intentionally bumping minimum VS Code version
key: vscode-test-${{ runner.os }}-1.100.0-v1

Option 3: Hash-based cache key

key: vscode-test-${{ runner.os }}-${{ hashFiles('apps/vscode-e2e/package.json') }}-v1

Auto-invalidates on package.json changes, but may also invalidate on unrelated changes.

Variations Tried

Researched best practices from:

  • Renovate docs and community discussions
  • GitHub Actions caching documentation
  • Other VS Code extension projects (Markuplint, VS Code DVC, freeCodeCamp)

Relevant Files

  • apps/vscode-e2e/package.json
  • apps/vscode-e2e/src/runTest.ts
  • .github/workflows/e2e.yml
  • renovate.json (already configured to disable @types/vscode auto-updates)

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions