Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MESSAGE_NO_DELETE rule is not working #140

Closed
lisette-rz opened this issue Jul 8, 2024 · 3 comments
Closed

MESSAGE_NO_DELETE rule is not working #140

lisette-rz opened this issue Jul 8, 2024 · 3 comments

Comments

@lisette-rz
Copy link

lisette-rz commented Jul 8, 2024

buf-breaking-action passes when I delete a message struct from the protobuf, causing a breaking change further.

Sample:

message Address {
  string city = 1;
  string state = 2;
  int32 zip = 3;
}
message Person {
  string name = 1;
  int32 age =2 ;
  Address address = 3;
}

If I remove the Address message struct, the breaking action still passes, which will provoke a compatibility error with the schema registry in Confluent.

message Person {
  string name = 1;
  int32 age = 2 ;
  reserved "address";
  reserved 3;
}

Expected result:
It should fail

@nicksnyder
Copy link
Member

The behavior you are expecting should work. If you are not seeing this behavior, then it is likely a configuration issue, but we would need more information to help you diagnose what the issue is. A complete, reproducible example would be ideal, but at the very least we would need to know your buf.yaml, and how you have configured this action in your workflow.

@lisette-rz
Copy link
Author

lisette-rz commented Jul 8, 2024

This is the configuration I'm using in buf.yaml:

version: v1
breaking:
  use:
    - FILE
  except:
    - FILE_NO_DELETE
    - FIELD_NO_DELETE

And this is the workflow configuration:

name: Generate

on:
  push:
    branches:
      - test/BackwardsCompatibility
  pull_request:

env:
  BUF_VERSION: 1.34.0
  breaking:
    name: Breaking Change Prevention
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: bufbuild/buf-setup-action@v1
        with:
          version: ${{ env.BUF_VERSION }}
          github_token: ${{ github.token }}

      - name: Determine Base Branch
        id: vars
        run: |
          if [[ "${{ github.base_ref }}" == "" ]]; then
            echo BASE_BRANCH="main" >> $GITHUB_ENV

          else
            echo BASE_BRANCH="${{ github.base_ref }}" >> $GITHUB_ENV
          fi

      - uses: bufbuild/buf-breaking-action@v1
        with:
          against: "https://x-oauth-basic:${{ github.token }}@github.com/myCompany/my-repo.git#branch=${{ env.BASE_BRANCH }},ref=HEAD,subdir=."

The buf version is: 1.34.0 but I also tried downgrading to 1.22.0 without success.
The other rules are working fine.

@nicksnyder
Copy link
Member

I reproduced your setup and the action correctly failed with the error Previously present message "Address" was deleted from file.

Example:
https://github.com/nicksnyder/testbuf/pull/1/files

Going to close this since I am unable to reproduce the error you are reporting given the info you provided. Feel free to re-open if you have a reproducible example that demonstrates incorrect behavior.

@nicksnyder nicksnyder closed this as not planned Won't fix, can't repro, duplicate, stale Jul 8, 2024
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

No branches or pull requests

2 participants