Skip to content

[typespec-java] post-release regenerate SDK #4818

Closed

Description

Followup issue after #4721

In autorest.java, after each emitter release, we have pipeline regenerating all released SDKs in azure-sdk-for-java repository:
https://dev.azure.com/azure-sdk/internal/_build?definitionId=6270&_a=summary

Generated SDK PR: Azure/azure-sdk-for-java#48598

We need parity in migrated typespec-java.

Tried a test pipeline (the pipeline name is auto-generated), worked fine:
https://dev.azure.com/azure-sdk/internal/_build?definitionId=8250
It will need permission to push to azure-sdk-for-java repository. Setting AuthToken: false does the trick. Agent told me the reason it works is that it'll trigger login-to-github.yml.

Timothee Guerin (@timotheeguerin) Can we add the pipeline in typespec-java? Definition: https://github.com/Azure/typespec-azure/blob/4d876f7d4cc21935637cecaabed7ee2c11895057/packages/typespec-java/eng/pipelines/post-publish-sdk.yaml

Alternative be placing this pipeline in azure-sdk-for-java repository.

Activity

  1. XiaofeiCao commented on Jul 7, 2026

    @XiaofeiCao
    MemberAuthor

    Timothee Guerin (@timotheeguerin) Could you help take a look? Where should we put the regen pipeline, in typespec-azure or SDK repo?

  2. XiaofeiCao commented on Jul 8, 2026

    @XiaofeiCao
    MemberAuthor

    offline discussed with Timothee. we should place the pipeline in SDK repo.

    will use ADO for now, to align with original autorest.java

    Timothee suggested using GitHub Actions. we could leverage dev packages that PR already built for us, e.g. #4721 (comment)
    , then there's no external repo usages. Will investigate further.

  3. XiaofeiCao commented on Jul 17, 2026

    @XiaofeiCao
    MemberAuthor

    Post-migration work tracker

    Pipeline & regeneration script (azure-sdk-for-java PR #49762)

    • Port the post-publish regeneration pipeline from autorest.java to azure-sdk-for-java (eng/pipelines/post-publish-emitter.yaml + eng/pipelines/scripts/sync_emitter.py), adapted for the emitter's new home in Azure/typespec-azure. Supports a published route (regenerate with a released @azure-tools/typespec-java) and a dev route (build the emitter from a typespec-azure PR / main).
    • Generate eng/emitter-package.json without adding libraries to the emitter's own peer deps (per PR 4866 review). Both routes seed via tsp-client generate-config-files; the published route uses --use-npm-pinning against the npm view --json manifest, the dev route extracts the dev tarball's resolved package.json and points the emitter dependency at the tarball via --overrides.
    • Pin TypeSpec dependencies to exact versions. generate-config-files leaves caret ranges, so every @azure-tools/* / @typespec/* entry is resolved to its latest published version via npm view <pkg>@latest (preferred over ncu -u, which may be unavailable post-CFS).
    • Inject "designated" libraries the emitter does not declare but specs depend on: openai-typespec + typespec-liftr-base from the azure-rest-api-specs package.json; typespec-azure-portal-core + openapi3 from npm latest (same release group as the emitter's deps).
    • Fix stale-merge ERESOLVE. generate-config-files merges into the existing file and only overwrites emitter peers, so a stale non-peer entry (e.g. openapi3) survived and broke the lock npm install. Designated entries are now removed before seeding, then re-added.

    Emitter bug found during regeneration (microsoft/typespec PR #11286)

    • Fix per-client ServiceVersion regression. Multi-client packages that share the same api-versions were emitting a separate <ClientName>ServiceVersion enum per client (e.g. SearchIndexServiceVersion, SearchIndexerServiceVersion). Root cause: the "same api-versions" check compared ApiVersion object references (===) instead of version strings, after lodash.isEqual was replaced in #11134. Fixed to compare .version strings.
    • Add e2e regression coverage for the case of multiple clients sharing one api-version set (the only prior multi-client spec used different versions per service, so the bug was invisible).

    Spec-side generation failures

    • Bump tsp-location.yaml for the 7 modules that failed to generate (override-parameters-mismatch / invalid-schema under TCGC 0.70.0): cognitiveservices, face, iothub, recoveryservicesbackup, quota, storage, security — pointed at latest azure-rest-api-specs main.
    • Re-run generation to confirm the override-parameters-mismatch errors are resolved at the newer spec commit; where they persist, file spec/@override fixes upstream.

    Follow-ups

    • Once the emitter drops openai-typespec / typespec-liftr-base from its peerDependencies, they are already handled as specs-sourced designated libs (no longer skipped).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

emitter:javaIssues for @azure-tools/typespec-java emitter

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions