Skip to content

fix: compute server release versions from tags#1938

Merged
monadoid merged 1 commit intomainfrom
fix_server_release_versioning
Mar 31, 2026
Merged

fix: compute server release versions from tags#1938
monadoid merged 1 commit intomainfrom
fix_server_release_versioning

Conversation

@monadoid
Copy link
Copy Markdown
Contributor

@monadoid monadoid commented Mar 31, 2026

Compute server-v3 and server-v4 release versions from the latest server tag plus changeset bumps, instead of recomputing from package.json.


Summary by cubic

Compute next server release versions for v3 and v4 from the latest git tag plus changeset bumps, instead of package.json. This keeps release tags consistent and avoids version drift.

  • Bug Fixes
    • Parse changed .changeset/*.md since the last stagehand-server-v3/v* or stagehand-server-v4/v* tag to find the highest bump for @browserbasehq/stagehand-server-v3 and @browserbasehq/stagehand-server-v4.
    • Increment the tagged version (major/minor/patch), default to 0.0.0 if no tag, remove changeset status/changeset-status.json, and output release, version, and tag.

Written for commit aebfc6c. Summary will update on new commits. Review in cubic

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 31, 2026

⚠️ No Changeset found

Latest commit: aebfc6c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@monadoid monadoid marked this pull request as ready for review March 31, 2026 21:01
@monadoid monadoid merged commit 30b5495 into main Mar 31, 2026
34 checks passed
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

2 issues found across 2 files

Confidence score: 2/5

  • There is a concrete regression risk in release automation: both workflow files can crash release detection with ENOENT when git diff includes deleted changeset files that are then read.
  • The issues are relatively severe (7/10) with high confidence (8/10 and 9/10), so this is more than a minor housekeeping concern and can block publishing flow in real scenarios.
  • Pay close attention to .github/workflows/stagehand-server-v4-release.yml and .github/workflows/stagehand-server-v3-release.yml - both need deleted files filtered out before iterating and reading diff results.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name=".github/workflows/stagehand-server-v4-release.yml">

<violation number="1" location=".github/workflows/stagehand-server-v4-release.yml:49">
P1: Filter deleted files out of the git diff list; otherwise release detection can crash on removed changeset files.</violation>
</file>

<file name=".github/workflows/stagehand-server-v3-release.yml">

<violation number="1" location=".github/workflows/stagehand-server-v3-release.yml:49">
P1: Exclude deleted files from the git diff list before reading each file; otherwise deleted changesets can crash release detection with ENOENT.</violation>
</file>
Architecture diagram
sequenceDiagram
    participant GH as GitHub Workflow
    participant Git as Git Repository
    participant FS as Local Filesystem (.changeset/)
    participant Node as Node.js Script
    participant Out as GITHUB_OUTPUT

    Note over GH, Out: Server Version Computation (v3/v4)

    GH->>Git: CHANGED: Get latest release tag
    Git-->>GH: latest_tag (e.g., stagehand-server-v3/v1.2.3)

    alt Tag exists
        GH->>Git: NEW: git diff --name-only latest_tag..HEAD
    else No tag found
        GH->>FS: NEW: find all .changeset/*.md files
    end
    Git-->>GH: List of changed changeset files
    GH->>FS: Write file list to temp file

    GH->>Node: Execute logic with LATEST_TAG & FILE_LIST env
    
    loop For each changed file
        Node->>FS: NEW: Read changeset markdown content
        Node->>Node: Parse frontmatter for package & bump type (major|minor|patch)
        opt Package matches @browserbasehq/stagehand-server-v*
            Node->>Node: NEW: Update highestReleaseType based on priority
        end
    end

    alt highestReleaseType is not null
        Node->>Node: CHANGED: Increment version from latest_tag (semver)
        Note right of Node: Defaults to 0.0.0 if no tag exists
    else No changes found
        Node->>Node: Set release = false
    end

    Node->>Out: CHANGED: Export 'release', 'version', and 'tag'
    Out-->>GH: Available for downstream build/publish steps
Loading

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

changed_files="$(mktemp)"
if [ -n "${latest_tag}" ]; then
pnpm changeset status --since "${latest_tag}" --output changeset-status.json
git diff --name-only "${latest_tag}"..HEAD -- '.changeset/*.md' > "${changed_files}"
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 31, 2026

Choose a reason for hiding this comment

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

P1: Filter deleted files out of the git diff list; otherwise release detection can crash on removed changeset files.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/stagehand-server-v4-release.yml, line 49:

<comment>Filter deleted files out of the git diff list; otherwise release detection can crash on removed changeset files.</comment>

<file context>
@@ -44,33 +44,88 @@ jobs:
+          changed_files="$(mktemp)"
           if [ -n "${latest_tag}" ]; then
-            pnpm changeset status --since "${latest_tag}" --output changeset-status.json
+            git diff --name-only "${latest_tag}"..HEAD -- '.changeset/*.md' > "${changed_files}"
           else
-            pnpm changeset status --output changeset-status.json
</file context>
Suggested change
git diff --name-only "${latest_tag}"..HEAD -- '.changeset/*.md' > "${changed_files}"
git diff --name-only --diff-filter=ACMRT "${latest_tag}"..HEAD -- '.changeset/*.md' > "${changed_files}"
Fix with Cubic

changed_files="$(mktemp)"
if [ -n "${latest_tag}" ]; then
pnpm changeset status --since "${latest_tag}" --output changeset-status.json
git diff --name-only "${latest_tag}"..HEAD -- '.changeset/*.md' > "${changed_files}"
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot Mar 31, 2026

Choose a reason for hiding this comment

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

P1: Exclude deleted files from the git diff list before reading each file; otherwise deleted changesets can crash release detection with ENOENT.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/stagehand-server-v3-release.yml, line 49:

<comment>Exclude deleted files from the git diff list before reading each file; otherwise deleted changesets can crash release detection with ENOENT.</comment>

<file context>
@@ -44,33 +44,88 @@ jobs:
+          changed_files="$(mktemp)"
           if [ -n "${latest_tag}" ]; then
-            pnpm changeset status --since "${latest_tag}" --output changeset-status.json
+            git diff --name-only "${latest_tag}"..HEAD -- '.changeset/*.md' > "${changed_files}"
           else
-            pnpm changeset status --output changeset-status.json
</file context>
Suggested change
git diff --name-only "${latest_tag}"..HEAD -- '.changeset/*.md' > "${changed_files}"
git diff --name-only --diff-filter=ACMRT "${latest_tag}"..HEAD -- '.changeset/*.md' > "${changed_files}"
Fix with Cubic

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.

3 participants