[ZDT] set switchToModelVersionAt to 8.10.0 for all types#158267
[ZDT] set switchToModelVersionAt to 8.10.0 for all types#158267pgayvallet merged 5 commits intoelastic:mainfrom
switchToModelVersionAt to 8.10.0 for all types#158267Conversation
| throw new Error('cannot call `registerType` after service startup.'); | ||
| } | ||
| this.typeRegistry.registerType(type); | ||
| this.typeRegistry.registerType(applyTypeDefaults(type)); |
There was a problem hiding this comment.
Doing that directly in the type registry class was too low level, just breaking too many tests. Also I think it makes sense to have this done from the service instead.
| let switchToModelVersionAt = type.switchToModelVersionAt; | ||
| if ( | ||
| !switchToModelVersionAt || | ||
| !Semver.valid(switchToModelVersionAt) || | ||
| Semver.gt(switchToModelVersionAt, globalSwitchToModelVersionAt) | ||
| ) { | ||
| switchToModelVersionAt = globalSwitchToModelVersionAt; | ||
| } | ||
|
|
||
| return { | ||
| ...type, | ||
| switchToModelVersionAt, | ||
| }; |
There was a problem hiding this comment.
The actual logic
There was a problem hiding this comment.
We're adding switchToModelVersionAt on all types, so the associated hashes are changing, had to update the snapshot
|
Pinging @elastic/kibana-core (Team:Core) |
| !Semver.valid(switchToModelVersionAt) || | ||
| Semver.gt(switchToModelVersionAt, globalSwitchToModelVersionAt) |
There was a problem hiding this comment.
I would normally think of these lines as reasons to throw an error, something like:
Invalid version detected: "foobar". Please use SemVer compliant versions. for (1)
Max switch version is 8.10.0, you provided 8.11.0. for (2).
In which case we have more of a classic default behaviour. But I get that we may not want to draw attention/discussion quite yet.
There was a problem hiding this comment.
After thinking about it, I think you're right. It's probably better to throw if the provided version is invalid (bad format) or higher than 8.10.0 (or 8.11.0 if we want to already allow owners to specify a one-version grace period)
jloleysens
left a comment
There was a problem hiding this comment.
Overall looks good, left a comment but I'll defer to @rudolf for final approval!
| it(`sets switchToModelVersionAt to the global version if type version is greater than the global version`, () => { | ||
| const type = createType({ | ||
| switchToModelVersionAt: '9.2.0', | ||
| }); | ||
|
|
||
| const result = applyTypeDefaults(type); | ||
| expect(result.switchToModelVersionAt).toEqual(globalSwitchToModelVersionAt); | ||
| }); |
There was a problem hiding this comment.
should this be allowed as we mentioned we needed a workaround to give teams some extra time?
There was a problem hiding this comment.
We could use a delaySwitchToModelVersionAt and override the default or not apply the forced switch to those. That way, we need to agree on which types we're more lenient with based on the type-owner's justification but that can be done as a follow up.
Given the timing, we do need to force our hand a bit here.
There was a problem hiding this comment.
Let's start by not :) and figure out if we need it then
There was a problem hiding this comment.
IMO, there is no need for an additional property. The way I understood our conversation was:
If not provided, let's set 8.10.0 as the default switchover deadline.
Teams can override that default by either anticipating or postponing the switch. If postponing, we'd discuss it in the PR review.
Basically function registerType({ switchToModelVersionAt = '8.10.0', ...otherOptions }) {...}.
Given the short timeframe we are providing, I'm almost certain that some teams will need to postpone it.
But I don't think this is a blocker, so let's keep it as it is, and we can soften the validation in a follow-up PR if needed.
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Unknown metric groupsAPI count
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
…#158267) ## Summary Sets `switchToModelVersionAt` to `8.10.0` for all registered SO types, forcing them to switch to the model version API once `main` is on version `8.10.0` (~end of june)
Summary
Sets
switchToModelVersionAtto8.10.0for all registered SO types, forcing them to switch to the model version API oncemainis on version8.10.0(~end of june)