Skip to content

Parse lock file leniently - #4685

Closed
anuraaga wants to merge 1 commit into
bufbuild:mainfrom
anuraaga:lenient-lock-parse
Closed

anuraaga wants to merge 1 commit into
bufbuild:mainfrom
anuraaga:lenient-lock-parse

Conversation

@anuraaga

Copy link
Copy Markdown
Contributor

When looking at #4683 (comment) I noticed buf.lock is parsed strictly, so an older buf would fail to run any command with a newer lock file format. Maybe buf.lock should be managed with a .proto :-)

But anyways as there was no test verifying failure with unknown fields, I feel it's probably unintentional, and being able to additively update the lockfile seems useful. I left v1 unchanged since it seems best to keep that behavior frozen. What do you think?

@emcfarlane emcfarlane left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Makes sense to me, but introducing any field is still going to be a breaking change upto this versions release.

Comment thread CHANGELOG.md
Comment on lines +11 to +12
- Parse v2 `buf.lock` files non-strictly, ignoring unknown fields. A `buf.lock` written by a
newer `buf` that records additional fields no longer fails to parse on an older `buf`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe doens't need a changelog as not user facing.

@doriable

Copy link
Copy Markdown
Member

So I think this was intentional behaviour, tbh, to push folks towards updating to later CLI versions when the lock file updates. I'm not sure we want to change that behaviour right now...

@anuraaga

Copy link
Copy Markdown
Contributor Author

Thanks for the notes - I think either way either we stick to encouraging CLI update, or we should do the opposite and consider the leniency change breaking and potentially a v3. I think this PR doesn't help with either so will avoid it for now.

@anuraaga anuraaga closed this Sep 16, 2026
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