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

Inferred optional fields for msggen schema evolution #6142

Merged

Conversation

cdecker
Copy link
Member

@cdecker cdecker commented Apr 3, 2023

This implements the solution described in #5988

Closes #5988

@cdecker
Copy link
Member Author

cdecker commented Apr 3, 2023

You can see two examples of changed optionality here and here:

  • ListFunds.channels[].channel_id was introduced as required in v23.05, however it is inferred to be optional because we support versions that predate its introduction
  • ListPeers.pees[].num_channels was introduced as required in v23.02, but again it is inferred to be optional because we support older versions

The same would be true for deprecated required fields, they'd end up as optional in the interface because we presumably want to support versions after the deprecation.

The current range of versions supported is

  • v0.10.1
  • v0.10.2
  • v0.11.0
  • v0.12.0
  • v0.12.1
  • v22.11
  • v23.02
  • v23.05

Including various hotfixes. If you are wondering why there aren't any deprecations having effect at the moment that is because old deprecations have been removed and the remaining ones are on non-required fields anyway, hence they don't result in a change in optionality.

@cdecker cdecker force-pushed the 20230403-msggen-inferred-optional branch 2 times, most recently from 3f586c4 to b0288be Compare April 3, 2023 17:56
@rustyrussell
Copy link
Contributor

I like this, and would love it within the current release of possible @ShahanaFarooqui ?

@cdecker cdecker force-pushed the 20230403-msggen-inferred-optional branch from b0288be to 46f121b Compare April 4, 2023 10:27
The patching system allows us to enrich the raw schema with some
additional information. In this specific case we want to backfill the
`added` and `deprecated` fields for the multiversion support.
This patch annotates the fields with a new `optional` attribute which
determines whether the field should be considered an inferred optional
due to being added or deprecated.
Changelog-Changed: msggen: The generated interfaces `cln-rpc` anc `cln-grpc` can now work with a range of versions rather than having to match the CLN version
This is a visitor that ensures every new field has at least an `added`
field, and that we don't change the `added` or `deprecated` annotation
after the fact.
@cdecker cdecker force-pushed the 20230403-msggen-inferred-optional branch from b1a2223 to 6b3cc28 Compare April 5, 2023 14:08
@rustyrussell rustyrussell added this to the v23.05 milestone Apr 5, 2023
@rustyrussell
Copy link
Contributor

Ack 6b3cc28

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.

rs: Backwards and Forwards compatibility story for cln-rpc and cln-grpc
2 participants