Skip to content

Add ability to depend on arbitrary upstream commits#310

Open
srikrsna-buf wants to merge 3 commits intomainfrom
sk/depend-on-upstream
Open

Add ability to depend on arbitrary upstream commits#310
srikrsna-buf wants to merge 3 commits intomainfrom
sk/depend-on-upstream

Conversation

@srikrsna-buf
Copy link
Member

@srikrsna-buf srikrsna-buf commented Mar 10, 2026

With bufbuild/protovalidate#470, all commits of protovalidate and protovalidate-testing module will be available on the BSR. This means we can depend on the generated SDK versions of those commits.

This PR adds the ability to depend on an arbitrary upstream commit. This drastically improves the development cycle by letting us review and merge PRs for each individual change in validate.proto, rather than bundling all changes from the previous release into a single PR.

It uses the git commit/tag/branch as the pointer because there are two different BSR modules, and each will have its own BSR commit name.

To avoid merging zeroed versions of the generated SDK, this ensures that only release versions or commits on the main version can be merged. The CI failure is because of this. Once bufbuild/protovalidate#470 is merged and we update the reference here, it should pass.

Because of the version update, there were some errors in the example test. I fixed them in a separate commit.

@github-actions
Copy link

The latest Buf updates on your PR. Results from workflow Buf / validate-protos (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed⏩ skippedMar 10, 2026, 12:30 PM

@srikrsna-buf srikrsna-buf changed the title Sk/depend on upstream Add ability to depend on arbitrary upstream commits Mar 10, 2026
@srikrsna-buf srikrsna-buf marked this pull request as ready for review March 10, 2026 12:41
@@ -0,0 +1,25 @@
name: Check generated SDK dependency
Copy link
Contributor

Choose a reason for hiding this comment

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

I like this idea. One suggestion: instead of exit 1 (which shows a red X and looks like broken CI), consider using the GitHub Checks API with an action_required conclusion. This still blocks merging when set as a required check, but shows as a distinct warning rather than a failure. Making it clear this is "waiting on upstream" not "something is broken."

Rough sketch:

- name: Check for zeroed-out version
  uses: actions/github-script@v7
  with:
    script: |
      const gomod = require('fs').readFileSync('go.mod', 'utf8');
      const zeroed = /buf\.build\/gen\/go\/bufbuild\/protovalidate\/protocolbuffers\/go.*00000000000000/.test(gomod);
      if (zeroed) {
        await github.rest.checks.create({
          owner: context.repo.owner,
          repo: context.repo.repo,
          name: 'Upstream dependency check',
          head_sha: context.sha,
          status: 'completed',
          conclusion: 'action_required',
          output: {
            title: 'Waiting for upstream protovalidate merge',
            summary: '`go.mod` has a zeroed-out pseudo-version. Update `PROTOVALIDATE_VERSION` once the upstream PR is merged and re-run `make sync-upstream`.'
          },
          details_url: 'https://github.com/bufbuild/protovalidate/pulls'
        });
      }

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