[Bug]: typespec-ts modular-unit snapshots stale after ARM doc changes in #4494 — CI red on main
bugemitter:typescript
### Describe the bug
`packages/typespec-ts` `unit-modular` scenario snapshots are stale on `main`, causing the **typespec-ts / CI → Run unit tests** job to fail for any PR that touches `packages/typespec-ts/**` (the `pull_request` build merges `main`, so the stale snapshots are exercised against the current ARM library).
Root cause: #4494 ("Improve documentation for ARM library decorators, interfaces, and models") changed the ARM operation templates in `packages/typespec-azure-resource-manager/lib/*.tsp` — the human-facing operation docs (e.g. `A long-running resource action.`) were moved to `@dev` and the public doc set to `@doc("")`. As a result ARM LRO operations now emit **no** public doc comment. The checked-in typespec-ts `modular-unit` scenario snapshots still expect the old doc text, so the generated output no longer matches.
Because #4494 did not touch `packages/typespec-ts/**`, `ci-typescript.yml` never ran on it, so the snapshot drift landed on `main` unnoticed. The `merge_group` runs for pr-4494 and pr-4547 show the same failure on the queue.
Example diffs from the failing job:
```
- /** A long-running resource action. */ export function backup(
+ export function backup(
```
```
- /** * This sample demonstrates how to a long-running resource action. * * @summary a long-running resource action. ...
+ /** * This sample demonstrates how to * * @summary * ...
```
Affected scenarios include (at least) the ARM samples/operations that use `ArmResourceActionAsync`-style templates, e.g. `test/modular-unit/scenarios/samples/parameters/bodyOptionalParameterName.md` and `test/modular-unit/scenarios/operations/lroPaging.md`.
Suggested fix: regenerate the affected `modular-unit` snapshots against current `main` by running the unit tests with the update flag, then commit the updated `.md` scenario files:
```
cd packages/typespec-ts
SCENARIOS_UPDATE=true pnpm unit-test
```
Broader follow-up to consider: ARM library (`typespec-azure-resource-manager`) changes can alter typespec-ts emitted output but do not currently trigger `ci-typescript.yml`, so this class of drift can recur. Consider widening the `ci-typescript.yml` `paths` triggers to include the emitter's TypeSpec library dependencies (e.g. `typespec-azure-resource-manager`, `typespec-client-generator-core`) and/or reconsidering which suites run in the repo-wide vitest run.
Context: found while working on #4788 (enabling typespec-ts unit tests in the repo-wide run). That PR is currently red solely due to this pre-existing drift, not its own changes.
### Reproduction
Not a spec/playground bug — this is a repo CI / snapshot drift issue reproducible in the repo itself:
1. Check out current `main` (which includes #4494).
2. `pnpm install` and build typespec-ts and its dependencies.
3. `cd packages/typespec-ts && pnpm unit-test`.
4. Observe `AssertionError` snapshot mismatches for ARM LRO operations/samples where the expected output contains doc comments (e.g. `A long-running resource action.`) that the current ARM library no longer emits.
### Checklist
- [x] Follow our Code of Conduct
- [x] Check that this issue is about the Azure libraries for typespec
- [x] Check that there isn't already an issue that request the same bug to avoid creating a duplicate.
- [x] The provided reproduction is a minimal reproducible example of the bug.
0 条评论