Skip to content

Commit

Permalink
Fixes odsp driver compat boundary by bumping the driver-loader bounda…
Browse files Browse the repository at this point in the history
…ry to V2int3 (microsoft#19167)

[AB#6724](https://dev.azure.com/fluidframework/internal/_workitems/edit/6724)

## Description
ODSP no longer supports `2.0.0-internal.2.x.y` and earlier including
`1.4.x`. For generating summaries ODSP.

Updates ODSP loader driver-compat boundary by bumping the driver-loader
boundary to `2.0.0-internal.3.x.y`+.
  • Loading branch information
tyler-cai-microsoft authored Jan 18, 2024
1 parent c75f85e commit 4ae585a
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 12 deletions.
52 changes: 43 additions & 9 deletions packages/test/test-version-utils/src/compatConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ const defaultCompatVersions = {
ltsVersions: ["^1.3.4"],
};

// This indicates the number of versions above 2.0.0.internal.1.y.z that we want to support for back compat.
// Currently we only want to support 2.0.0.internal.3.y.z. and above
const defaultNumOfDriverVersionsAboveV2Int1 = 2;

function genConfig(compatVersion: number | string): CompatConfig[] {
if (compatVersion === 0) {
return [
Expand Down Expand Up @@ -164,7 +168,7 @@ const genLTSConfig = (compatVersion: number | string): CompatConfig[] => {
];
};

const genBackCompatConfig = (compatVersion: number): CompatConfig[] => {
const genLoaderBackCompatConfig = (compatVersion: number): CompatConfig[] => {
const compatVersionStr =
typeof compatVersion === "string"
? `${compatVersion} (N)`
Expand All @@ -177,6 +181,15 @@ const genBackCompatConfig = (compatVersion: number): CompatConfig[] => {
compatVersion,
loader: compatVersion,
},
];
};

const genDriverLoaderBackCompatConfig = (compatVersion: number): CompatConfig[] => {
const compatVersionStr =
typeof compatVersion === "string"
? `${compatVersion} (N)`
: `${getRequestedVersion(baseVersion, compatVersion)} (N${compatVersion})`;
return [
{
name: `compat back ${compatVersionStr} - older loader + older driver`,
kind: CompatKind.LoaderDriver,
Expand All @@ -187,28 +200,40 @@ const genBackCompatConfig = (compatVersion: number): CompatConfig[] => {
];
};

const genFullBackCompatConfig = (): CompatConfig[] => {
// not working with new rc version
const _configList: CompatConfig[] = [];

const getNumberOfVersionsToGoBack = (numOfVersionsAboveV2Int1: number = 0): number => {
const [, semverInternal, prereleaseIndentifier] = fromInternalScheme(codeVersion, true, true);
assert(semverInternal !== undefined, "Unexpected pkg version");

// Here we check if the release is an RC release. If so, we also need to account for internal releases when
// generating back compat configs. For back compat purposes, we consider RC major release 1 to be treated as internal
// major release 9. This will ensure we generate back compat configs for all RC and internal major releases.
const greatestInternalMajor = 8;
const greatestMajor =
const numOfVersionsToV2Int1 =
prereleaseIndentifier === "rc" || prereleaseIndentifier === "dev-rc"
? semverInternal.major + greatestInternalMajor
: semverInternal.major;
: semverInternal.major; // this happens to be the greatest major version
// This allows us to increase our "LTS" support for certain versions above 2.0.0.internal.1.y.z
return numOfVersionsToV2Int1 - numOfVersionsAboveV2Int1;
};

const genFullBackCompatConfig = (driverVersionsAboveV2Int1: number = 0): CompatConfig[] => {
// not working with new rc version
const _configList: CompatConfig[] = [];

const loaderVersionBackCompatCount = getNumberOfVersionsToGoBack(0);

// This makes the assumption N and N-1 scenarios are already fully tested thus skipping 0 and -1.
// This loop goes as far back as 2.0.0.internal.1.y.z.
// The idea is to generate all the versions from -2 -> - (major - 1) the current major version (i.e 2.0.0-internal.9.y.z would be -8)
// This means as the number of majors increase the number of versions we support - this may be updated in the future.
for (let i = 2; i < greatestMajor; i++) {
_configList.push(...genBackCompatConfig(-i));
for (let i = 2; i < loaderVersionBackCompatCount; i++) {
_configList.push(...genLoaderBackCompatConfig(-i));
}

// Splitting the two allows us to still test driver-loader while skipping older loader-driver versions are no longer supported
const driverVersionBackCompatCount = getNumberOfVersionsToGoBack(driverVersionsAboveV2Int1);
for (let i = 2; i < driverVersionBackCompatCount; i++) {
_configList.push(...genDriverLoaderBackCompatConfig(-i));
}
return _configList;
};
Expand Down Expand Up @@ -311,6 +336,9 @@ export const configList = new Lazy<readonly CompatConfig[]>(() => {
if (process.env.fluid__test__backCompat === "FULL") {
_configList.push(...genFullBackCompatConfig());
}
if (process.env.fluid__test__backCompat === "V2_INT_1_Loader_V2_INT_3_Driver") {
_configList.push(...genFullBackCompatConfig(defaultNumOfDriverVersionsAboveV2Int1));
}
} else {
compatVersions.forEach((value) => {
switch (value) {
Expand All @@ -324,6 +352,12 @@ export const configList = new Lazy<readonly CompatConfig[]>(() => {
_configList.push(...genFullBackCompatConfig());
break;
}
case "V2_INT_1_Loader_V2_INT_3_Driver": {
_configList.push(
...genFullBackCompatConfig(defaultNumOfDriverVersionsAboveV2Int1),
);
break;
}
case "CROSS_VERSION": {
_configList.push(...genCrossVersionCompatConfig());
break;
Expand Down
6 changes: 3 additions & 3 deletions tools/pipelines/test-real-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,13 @@ stages:
flags: --compatVersion=0 --tenantIndex=0
- name: N-1
flags: --compatVersion=-1 --tenantIndex=1
- name: LTS
flags: --compatVersion=LTS --tenantIndex=2
- name: Cross-Version
flags: --compatVersion=CROSS_VERSION
# Assumes Non-compat and N-1 scenarios are covered
# Tests N-2 to LTS+1 back compat for loader
# Tests N-2 to LTS+3 back compat for loader + driver
- name: N-2ToLTS+1-back-compat
flags: --compatVersion=FULL --tenantIndex=3
flags: --compatVersion=V2_INT_1_Loader_V2_INT_3_Driver --tenantIndex=3
env:
login__microsoft__clientId: $(login-microsoft-clientId)
login__microsoft__secret: $(login-microsoft-secret)
Expand Down

0 comments on commit 4ae585a

Please sign in to comment.