Skip to content

fix(ci): bump both server.json version fields in the Bump Version workflow - #483

Merged
gaurav-singh-9227 merged 1 commit into
browserstack:mainfrom
SavioBS629:fix/bump-version-workflow-server-json
Oct 16, 2026
Merged

gaurav-singh-9227 merged 1 commit into
browserstack:mainfrom
SavioBS629:fix/bump-version-workflow-server-json

Conversation

@SavioBS629

Copy link
Copy Markdown
Collaborator

Fixes the Bump Version workflow, which fails on every dispatch. Most recent failure: run 38398516264.

What happens

package.json=2.2.3 lock=2.2.3 lock.root=2.2.3 server.json=2.2.2
Version mismatch: expected 2.2.3, got 2.2.2

The "Update server.json package version" step did a textual replace of the first "version": "<old>" occurrence, on the assumption — stated in its own comment — that only the nested packages[].version could match, because the top-level version was the schema version pinned at 1.0.0.

That stopped being true in the 2.x line: server.json now carries the release version in both fields, and the top-level one appears first. String.prototype.replace with a string argument replaces only the first match, so the top-level field was updated and packages[0].version was left stale — which is exactly the field the verify step reads.

The fix

  • Parse server.json and assign version and packages[0].version explicitly, instead of string-replacing. No dependency on field order or on how many fields happen to match.
  • Extend the verify step to check the top-level field too, so a partial update cannot pass silently in future.
  • OLD_VERSION is no longer needed by this step and is dropped from its env.

Verification

Ran the new write logic against main's server.json (2.2.2 → 2.2.3): both fields update, and the output is byte-identical to the original apart from the two version strings — the file already uses 2-space indentation with a trailing newline, so the JSON round-trip preserves formatting.

Ran the full verify step over the result:

package.json=2.2.3 lock=2.2.3 lock.root=2.2.3 server.json=2.2.3 server.json.top=2.2.3
VERIFY PASSES

This cycle's bump was done by hand in #482, since the workflow could not produce it.

…kflow

The server.json update step replaced the first `"version": "<old>"` string it
found. Since the 2.x line, server.json carries the version in two places — the
top-level `version` and the nested `packages[].version` — and the top-level one
comes first, so the nested field was never updated. The verify step reads
`packages[0].version`, so every dispatch failed with:

    package.json=X lock=X lock.root=X server.json=<old>
    Version mismatch: expected X, got <old>

Parse server.json and assign both fields explicitly instead of string-replacing,
and extend the verify step to cover the top-level field so a partial update
cannot pass silently.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 13, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Central YAML (base), Organization UI (inherited), Workspace UI (inherited)
  • Review profile: ASSERTIVE
  • Plan: Enterprise
  • Run ID: 53edea6f-61d6-45d5-b6ab-bed81177e06c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@gaurav-singh-9227
gaurav-singh-9227 merged commit e4b9bee into browserstack:main Oct 16, 2026
2 checks passed
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