fix: compute server release versions from tags#1938
Conversation
|
There was a problem hiding this comment.
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
ENOENTwhengit diffincludes 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.ymland.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
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}" |
There was a problem hiding this comment.
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>
| 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}" |
| 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}" |
There was a problem hiding this comment.
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>
| 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}" |
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.
.changeset/*.mdsince the laststagehand-server-v3/v*orstagehand-server-v4/v*tag to find the highest bump for@browserbasehq/stagehand-server-v3and@browserbasehq/stagehand-server-v4.0.0.0if no tag, removechangeset status/changeset-status.json, and outputrelease,version, and tag.Written for commit aebfc6c. Summary will update on new commits. Review in cubic