Skip to content

Rewrite dependency version check as Go tool, extend to main branch#9816

Merged
chaptersix merged 2 commits intomainfrom
validate-api-version
Apr 22, 2026
Merged

Rewrite dependency version check as Go tool, extend to main branch#9816
chaptersix merged 2 commits intomainfrom
validate-api-version

Conversation

@chaptersix
Copy link
Copy Markdown
Contributor

@chaptersix chaptersix commented Apr 3, 2026

Rewrites the release dependency check as a Go tool and extends it to cover the main branch.

The original check was a shell script using grep/awk to extract versions from go.mod. Moving to Go lets us use golang.org/x/mod/modfile (proper AST parsing), module.IsPseudoVersion/PseudoVersionRev (pseudo-version decomposition), and semver.IsValid — none of which are feasible to replicate reliably in shell. Using a Go tool is also consistent with the pattern in cmd/tools/.

The rewrite also extends validation: the original script only enforced tagged releases on release/* and cloud/* branches. The new tool adds a main branch policy: pseudo-versions are allowed on main, but the referenced commit must be on the dependency's default branch (not a feature branch or a fork).

Policies enforced

  • release/* and cloud/*: must be tagged semver releases
  • main: tagged releases accepted; pseudo-versions must reference a commit on the dependency's default branch
  • other branches: skipped

Why

If an API or SDK references a commit that's not on the main branch or a tag, it creates problems when bumping the version later on. There was a recent occurrence of this.

Running locally

go run ./cmd/tools/check-dependencies --base-branch main

Pass the branch you're targeting as --base-branch. For example, to simulate a PR against a release branch:

go run ./cmd/tools/check-dependencies --base-branch release/v1.31

Comment thread cmd/tools/validate-api-go-version/main.go Outdated
@chaptersix chaptersix force-pushed the validate-api-version branch 5 times, most recently from 1558a44 to fdafcf2 Compare April 3, 2026 20:51
@chaptersix chaptersix marked this pull request as ready for review April 3, 2026 20:51
@chaptersix chaptersix requested review from a team as code owners April 3, 2026 20:51
@chaptersix chaptersix marked this pull request as draft April 3, 2026 22:03
@chaptersix chaptersix force-pushed the validate-api-version branch from fd8d10d to e1cb26d Compare April 3, 2026 22:08
@chaptersix chaptersix marked this pull request as ready for review April 4, 2026 20:21
@chaptersix chaptersix changed the title Replace shell-based dependency validation with Go tool Add check-dependencies CI tool Apr 4, 2026
@chaptersix chaptersix requested review from spkane31 and stephanos April 6, 2026 19:30
Comment thread cmd/tools/check-dependencies/main.go Outdated
Comment thread cmd/tools/check-dependencies/main.go Outdated
@chaptersix chaptersix changed the title Add check-dependencies CI tool Rewrite dependency version check as Go tool, extend to main branch Apr 10, 2026
@chaptersix chaptersix marked this pull request as draft April 13, 2026 18:13
@chaptersix
Copy link
Copy Markdown
Contributor Author

need to add some integration tests.

@chaptersix chaptersix marked this pull request as ready for review April 15, 2026 21:16
@chaptersix chaptersix force-pushed the validate-api-version branch from 68eb426 to 08cf62c Compare April 17, 2026 01:12
Comment thread cmd/tools/check-dependencies/main.go
Comment thread cmd/tools/check-dependencies/main.go Outdated
Comment thread cmd/tools/check-dependencies/main.go Outdated
Replaces shell-based dependency validation with a Go tool that checks
temporal API and SDK dependency versions. On release branches, requires
tagged semver releases. On main, verifies pseudo-version commits are on
the upstream default branch.
- Add 2-minute context timeout for main branch validation
- Change validateMainModule to return error instead of string
- Add success print statement in validateMainBranch
@chaptersix chaptersix force-pushed the validate-api-version branch from 7a96d6a to 8994770 Compare April 22, 2026 15:47
@chaptersix chaptersix enabled auto-merge (squash) April 22, 2026 15:48
@chaptersix chaptersix merged commit 76ccaa1 into main Apr 22, 2026
46 checks passed
@chaptersix chaptersix deleted the validate-api-version branch April 22, 2026 16:35
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