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

Monitor @typespec/compiler dev version build #2709

Closed
wants to merge 5 commits into from

Conversation

v-jiaodi
Copy link
Member

@v-jiaodi v-jiaodi commented Jul 26, 2024

Monitor @typespec/compiler dev version build
https://dev.azure.com/azure-sdk/public/_build/results?buildId=3993520&view=logs&j=830f3c89-f0a6-536d-4907-0d5f5b592ed8&t=df42c93f-8bab-5640-0499-96898203e019&l=33

step:
1.run npm install -g @typespec/compiler@next
2. common/config/rush run npx @azure-tools/typespec-bump-deps@latest pnpm-config.json --add-rush-overrides
3. packages/typespec-test run npx @azure-tools/typespec-bump-deps@latest package.json
4. packages/typespec-test run npx @azure-tools/typespec-bump-deps@latest package.json
5. run rush update && rush build
6. packages/typespec-test/test/loadtesting_modular run npx tsp compile ./spec/client.tsp

error log:

Diagnostics were reported during compilation:

D:/Js-sdk-sync/pr/2266/packages/typespec-test/test/loadtesting_modular/spec/client.tsp:69:3 - error @typespec/versioning/incompatible-versioned-reference: 'Customizations.TestProfileAdministrationOperations.createOrUpdateTestProfile' is referencing type 'Microsoft.LoadTestService.TestProfile' added in version 'v2024_05_01_preview' but version used is 2022-11-01.
> 69 |   createOrUpdateTestProfile is TestProfileAdministration.createOrUpdateTestProfile;
     |   ^^^^^^^^^^^^^^^^^^^^^^^^^
D:/Js-sdk-sync/pr/2266/packages/typespec-test/test/loadtesting_modular/spec/client.tsp:70:3 - error @typespec/versioning/incompatible-versioned-reference: 'Customizations.TestProfileAdministrationOperations.deleteTestProfile' is referencing type 'Microsoft.LoadTestService.TestProfile' added in version 'v2024_05_01_preview' but version used is 2022-11-01.
> 70 |   deleteTestProfile is TestProfileAdministration.deleteTestProfile;
     |   ^^^^^^^^^^^^^^^^^
D:/Js-sdk-sync/pr/2266/packages/typespec-test/test/loadtesting_modular/spec/client.tsp:71:3 - error @typespec/versioning/incompatible-versioned-reference: 'Customizations.TestProfileAdministrationOperations.getTestProfile' is referencing type 'Microsoft.LoadTestService.TestProfile' added in version 'v2024_05_01_preview' but version used is 2022-11-01.
> 71 |   getTestProfile is TestProfileAdministration.getTestProfile;
     |   ^^^^^^^^^^^^^^
D:/Js-sdk-sync/pr/2266/packages/typespec-test/test/loadtesting_modular/spec/client.tsp:72:3 - error @typespec/versioning/incompatible-versioned-reference: 'Customizations.TestProfileAdministrationOperations.listTestProfiles' is referencing type 'Microsoft.LoadTestService.TestProfile' added in version 'v2024_05_01_preview' but version used is 2022-11-01.
> 72 |   listTestProfiles is TestProfileAdministration.listTestProfiles;
     |   ^^^^^^^^^^^^^^^^
D:/Js-sdk-sync/pr/2266/packages/typespec-test/test/loadtesting_modular/spec/client.tsp:80:3 - error @typespec/versioning/incompatible-versioned-reference: 'Customizations.TestProfileRunOperations.createOrUpdateTestProfileRun' is referencing type 'Microsoft.LoadTestService.TestProfileRun' added in version 'v2024_05_01_preview' but version used is 2022-11-01.
> 80 |   createOrUpdateTestProfileRun is TestProfileRunAdministration.createOrUpdateTestProfileRun;
     |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
D:/Js-sdk-sync/pr/2266/packages/typespec-test/test/loadtesting_modular/spec/client.tsp:81:3 - error @typespec/versioning/incompatible-versioned-reference: 'Customizations.TestProfileRunOperations.deleteTestProfileRun' is referencing type 'Microsoft.LoadTestService.TestProfileRun' added in version 'v2024_05_01_preview' but version used is 2022-11-01.
> 81 |   deleteTestProfileRun is TestProfileRunAdministration.deleteTestProfileRun;
     |   ^^^^^^^^^^^^^^^^^^^^
D:/Js-sdk-sync/pr/2266/packages/typespec-test/test/loadtesting_modular/spec/client.tsp:82:3 - error @typespec/versioning/incompatible-versioned-reference: 'Customizations.TestProfileRunOperations.getTestProfileRun' is referencing type 'Microsoft.LoadTestService.TestProfileRun' added in version 'v2024_05_01_preview' but version used is 2022-11-01.
> 82 |   getTestProfileRun is TestProfileRunAdministration.getTestProfileRun;
     |   ^^^^^^^^^^^^^^^^^
D:/Js-sdk-sync/pr/2266/packages/typespec-test/test/loadtesting_modular/spec/client.tsp:83:3 - error @typespec/versioning/incompatible-versioned-reference: 'Customizations.TestProfileRunOperations.listTestProfileRuns' is referencing type 'Microsoft.LoadTestService.TestProfileRun' added in version 'v2024_05_01_preview' but version used is 2022-11-01.
> 83 |   listTestProfileRuns is TestProfileRunAdministration.listTestProfileRuns;
     |   ^^^^^^^^^^^^^^^^^^^
D:/Js-sdk-sync/pr/2266/packages/typespec-test/test/loadtesting_modular/spec/client.tsp:86:3 - error @typespec/versioning/incompatible-versioned-reference: 'Customizations.TestProfileRunOperations.stop' is referencing type 'Microsoft.LoadTestService.TestProfileRun' added in version 'v2024_05_01_preview' but version used is 2022-11-01.
> 86 |   stop is TestProfileRunAdministration.stop;
     |   ^^^^

Found 9 errors.

@MaryGao
Copy link
Member

MaryGao commented Jul 29, 2024

@timotheeguerin our smoke testing for load testing is failing with latest dev version and we re-produced this issue in spec repo: Azure/azure-rest-api-specs#30001. Could you take a look?

One follow-up question is if the versioning information could propagate to is operation, e.g with below example if we can scope the test2 to Versions.l2 also?

@versioned(Versions)
namespace VersionedLib {
  enum Versions {l1, l2}
  @added(Versions.l2)
  model Foo {}

 @added(Versions.l2)
  op test(): VersionedLib.Foo;
}

@useDependency(VersionedLib.Versions.l1)
@useDependency(VersionedLib.Versions.l2)
namespace TestService {
  op test2() is VersionedLib.test;
}

@timotheeguerin
Copy link
Member

Fix for those specs are here in the spec repo Azure/azure-rest-api-specs#30005. Problem is the client namespace is saying to use an older version of the service

@timotheeguerin
Copy link
Member

Regarding the example above

@useDependency(VersionedLib.Versions.l1)
@useDependency(VersionedLib.Versions.l2)

this doesn't what you think, this sets the version of the library used to l1 it overrides the previous one.

You can version the client in the same way and add @added/@removed on the operations there

@MaryGao
Copy link
Member

MaryGao commented Jul 30, 2024

Offline confirmed with @tadelesh we could control the versioning information for client.tsp like below:

@service({
  title: "Widget Service",
})
@versioned(Versions)
namespace VersionedLib {
  enum Versions {
    l1,
    l2,
  }
  @added(Versions.l2)
  model Foo {}
  @added(Versions.l1)
  @removed(Versions.l2)
  model Bar {}

  @added(Versions.l2)
  @route("/test")
  op test(): VersionedLib.Foo;

  @added(Versions.l1)
  @removed(Versions.l2)
  op bar(): VersionedLib.Bar;
}

@versioned(Versions)
namespace TestService {
  enum Versions {
    @useDependency(VersionedLib.Versions.l1)
    l1,

    @useDependency(VersionedLib.Versions.l2)
    l2,
  }

  @added(Versions.l1)
  @removed(Versions.l2)
  op test2 is VersionedLib.bar;
  op test is VersionedLib.test;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants