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

feature: Evolve an API by Adding a Field #2489

Open
1 task
stevekuznetsov opened this issue Dec 14, 2022 · 3 comments
Open
1 task

feature: Evolve an API by Adding a Field #2489

stevekuznetsov opened this issue Dec 14, 2022 · 3 comments
Labels
area/apiexports kind/feature Categorizes issue or PR as related to a new feature.

Comments

@stevekuznetsov
Copy link
Contributor

stevekuznetsov commented Dec 14, 2022

Feature Description

As a service provider exposing an API through an export,
I would like to add a new field to my API
In order to evolve the features I support

Proposed Solution

We need to make sure that:

  • the API author owns the storage version
  • if the storage version is newer, the field is pruned when clients request older versions
  • if the storage version is older, the field is defaulted when clients request newer versions
  • we need lossless round-tripping

Note: it is possible (and likely) that new fields which impact behavior for the object will cause old clients to have ill-defined behavior, as the pruned version of the schema may make two objects appear identical when their only difference is in new fields, but the client will observe behavioral differences between them.

Alternative Solutions

No response

Want to contribute?

  • I would like to work on this issue.

Additional Context

Extracted from this design doc.

@stevekuznetsov stevekuznetsov added the kind/feature Categorizes issue or PR as related to a new feature. label Dec 14, 2022
@stevekuznetsov stevekuznetsov moved this to New in kcp Dec 14, 2022
@stevekuznetsov stevekuznetsov moved this from New to Backlog in kcp Dec 14, 2022
@stevekuznetsov
Copy link
Contributor Author

@sttts it's not clear how, specifically, the "pruned objects appear identical but aren't" case impacts acceptance criteria for this task - can you expand on that?

@stevekuznetsov stevekuznetsov moved this from Backlog to New in kcp Dec 14, 2022
@stevekuznetsov
Copy link
Contributor Author

From discussion: if it's technically feasible, we should try to detect situations where the default behavior from a new field is not the same as the previous behavior and flag that for the API author.

@stevekuznetsov
Copy link
Contributor Author

We need to consider the flow:

  1. sever has version v1, updates to v1 (no change) but adds a backwards-compatible field
  2. client has naive deserialization, drops new field
  3. client does update, loses field

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/apiexports kind/feature Categorizes issue or PR as related to a new feature.
Projects
Status: New
Development

No branches or pull requests

2 participants