diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index d2875024bb..85af3a9334 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -144,7 +144,7 @@ To regenerate a specific integration test client (faster than regenerating all): ```bash cd packages/typespec-ts -npx tsx ./test/commands/gen-cadl-ranch.js --tag=azure-modular --filter=payload/xml +npx tsx ./test/commands/gen-spector.js --tag=azure-modular --filter=payload/xml ``` Replace `payload/xml` with the path of the specific test you want to regenerate. diff --git a/.github/skills/spector-test-implementer/SKILL.md b/.github/skills/spector-test-implementer/SKILL.md index 1b8294ced3..2fed894a6c 100644 --- a/.github/skills/spector-test-implementer/SKILL.md +++ b/.github/skills/spector-test-implementer/SKILL.md @@ -35,9 +35,9 @@ Read `temp/specs//mockapi.ts`. Extract all scenario names (the `Scenarios. ### Step 3: Check Existing Implementation -Check whether the path already exists in the `azureModularTsps` array in `test/commands/cadl-ranch-list.js`, and whether a `.spec.ts` file already exists in `test/azureModularIntegration/`. +Check whether the path already exists in the `azureModularTsps` array in `test/commands/spector-list.js`, and whether a `.spec.ts` file already exists in `test/azureModularIntegration/`. -**Important:** `cadl-ranch-list.js` has four arrays in order: `azureRlcTsps`, `rlcTsps`, `azureModularTsps`, `modularTsps`. Verify a match is inside `azureModularTsps` by checking line numbers: +**Important:** `spector-list.js` has four arrays in order: `azureRlcTsps`, `rlcTsps`, `azureModularTsps`, `modularTsps`. Verify a match is inside `azureModularTsps` by checking line numbers: 1. Find the line of `export const azureModularTsps = [` (start) 2. Find the line of `export const modularTsps = [` (end boundary) @@ -53,7 +53,7 @@ Then branch: **Case C -- Entry exists but no .spec.ts:** Skip Step 4, go to Step 5. -### Step 4: Add Entry to cadl-ranch-list.js +### Step 4: Add Entry to spector-list.js Add to the `azureModularTsps` array: @@ -78,9 +78,9 @@ This step has two phases: first create the config and generate the client, then 2. Create `test/azureModularIntegration/generated//.gitignore` with the content shown in [.gitignore template](references/naming-and-templates.md#gitignore-template) 3. Generate the client by running: ```bash - npx tsx ./test/commands/gen-cadl-ranch.js --tag=azure-modular --filter= + npx tsx ./test/commands/gen-spector.js --tag=azure-modular --filter= ``` -4. **Verify generation succeeded:** Check that `test/azureModularIntegration/generated//src/index.ts` exists and contains actual client class exports (not empty or placeholder). If the file is missing or empty, **stop** — remove the entry from `cadl-ranch-list.js`, delete the generated directory, and report that generation is not supported for this path. +4. **Verify generation succeeded:** Check that `test/azureModularIntegration/generated//src/index.ts` exists and contains actual client class exports (not empty or placeholder). If the file is missing or empty, **stop** — remove the entry from `spector-list.js`, delete the generated directory, and report that generation is not supported for this path. 5. Read `test/azureModularIntegration/generated//src/index.ts` to discover the client class name, method signatures, and operation groups. **Phase 2 -- .spec.ts file:** @@ -157,10 +157,10 @@ For each new test path, these are the files that should be committed: | File | Action | | -------------------------------------------------------------- | ------------------------------------------ | -| `test/commands/cadl-ranch-list.js` | Modified (new entry in `azureModularTsps`) | +| `test/commands/spector-list.js` | Modified (new entry in `azureModularTsps`) | | `test/azureModularIntegration/generated//.gitignore` | Created | | `test/azureModularIntegration/generated//tspconfig.yaml` | Created | -| `test/azureModularIntegration/generated//src/index.d.ts` | Generated (by gen-cadl-ranch.js) | +| `test/azureModularIntegration/generated//src/index.d.ts` | Generated (by gen-spector.js) | | `test/azureModularIntegration/.spec.ts` | Created | Do **not** commit these files: @@ -177,5 +177,5 @@ Do **not** commit these files: | Constructor mismatch | Read the generated client's `index.ts` for the actual signature | | Assertion mismatch | Re-read `mockapi.ts` for exact expected values | | Formatting CI fails | Run `pnpm format` at repo root before committing | -| Generation produces no output | Remove path from `cadl-ranch-list.js`; emitter doesn't support it | +| Generation produces no output | Remove path from `spector-list.js`; emitter doesn't support it | | Test passes locally but body is undefined | Check generated code for placeholder types like `__PLACEHOLDER_*__` — emitter bug | diff --git a/.scripts/ci.yml b/.scripts/ci.yml index 05ea4a32fa..2c54b0de24 100644 --- a/.scripts/ci.yml +++ b/.scripts/ci.yml @@ -121,7 +121,7 @@ stages: inputs: artifactName: packages path: $(Build.ArtifactStagingDirectory) - - job: HLC_Generation + - job: AutoRest_Generation dependsOn: Build variables: - template: globals.yml @@ -138,7 +138,7 @@ stages: - template: build.yml - script: npm run generate-swaggers workingDirectory: $(Build.SourcesDirectory)/packages/autorest.typescript - displayName: "Generate HLC Test Clients" + displayName: "Generate AutoRest Test Clients" - script: npm run check:tree workingDirectory: $(Build.SourcesDirectory)/packages/autorest.typescript displayName: "Check git Tree" diff --git a/.scripts/nightly.yml b/.scripts/nightly.yml index 5e7f13d68d..571a2aa0bb 100644 --- a/.scripts/nightly.yml +++ b/.scripts/nightly.yml @@ -15,12 +15,12 @@ pool: stages: - stage: NightlyCI jobs: - - job: CadlRanchTest + - job: SpectorTest steps: - template: nightly-prepare.yml - script: npm run integration-test-ci workingDirectory: $(Build.SourcesDirectory)/packages/typespec-ts - displayName: "Run all Cadl-ranch test cases" + displayName: "Run all Spector test cases" - job: UnitTest steps: - template: nightly-prepare.yml diff --git a/.vscode/launch.json b/.vscode/launch.json index 4d00bcb546..57d18f79e0 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -124,7 +124,7 @@ "name": "[TypeSpec] Debug generate integration code", "request": "launch", "cwd": "${workspaceFolder}/packages/typespec-ts", - "runtimeArgs": ["tsx", "./test/commands/gen-cadl-ranch.js", "--tag=rlc"], + "runtimeArgs": ["tsx", "./test/commands/gen-spector.js", "--tag=rlc"], "runtimeExecutable": "npx", "skipFiles": ["/**"], "type": "pwa-node", @@ -173,4 +173,4 @@ "outFiles": ["${workspaceFolder}/packages/*/dist/**/*.js"] } ] -} \ No newline at end of file +} diff --git a/packages/typespec-ts/CONTRIBUTING.md b/packages/typespec-ts/CONTRIBUTING.md index 42b63f4aa9..d1b5fcf588 100644 --- a/packages/typespec-ts/CONTRIBUTING.md +++ b/packages/typespec-ts/CONTRIBUTING.md @@ -52,11 +52,11 @@ npm run smoke-test Whenever you work on adding a feature/fixing a bug, this would probably be your first step. You create a test case and then run it through the generator, see the result, modify the generator, run it again and so on, until you get the desired output. -1. Pick up a typespec as your test input in cadl-ranch. Below are some examples +1. Pick up a typespec as your test input in spector. Below are some examples - Let us say your test input is `authentication/api-key/main.tsp` in @azure-tools/cadl-ranch-specs. + Let us say your test input is `authentication/api-key/main.tsp` in @typespec/http-specs or @azure-tools/azure-http-specs. -1. Now add an entry to the TypeSpecRanchConfig to the file [`cadl-ranch-list.ts`](./test/commands/cadl-ranch-list.ts). In the file, add the following to the array. +1. Now add an entry to the TypeSpecRanchConfig to the file [`spector-list.js`](./test/commands/spector-list.js). In the file, add the following to the array. ```typescript { diff --git a/packages/typespec-ts/package.json b/packages/typespec-ts/package.json index 88be3a828d..682f02caa2 100644 --- a/packages/typespec-ts/package.json +++ b/packages/typespec-ts/package.json @@ -45,10 +45,10 @@ "generate-and-run:modular": "npm run generate-tsp-only:modular && npm run integration-test:alone:modular && npm run stop-test-server -- -p 3002", "generate-and-run:azure-modular": "npm run generate-tsp-only:azure-modular && npm run integration-test:alone:azure-modular && npm run stop-test-server -- -p 3002", "generate-tsp-only": "npm run generate-tsp-only:azure-rlc && npm run generate-tsp-only:rlc &&npm run generate-tsp-only:azure-modular && npm run generate-tsp-only:modular", - "generate-tsp-only:rlc": "npx tsx ./test/commands/gen-cadl-ranch.js --tag=rlc", - "generate-tsp-only:azure-rlc": "npx tsx ./test/commands/gen-cadl-ranch.js --tag=azure-rlc", - "generate-tsp-only:modular": "npx tsx ./test/commands/gen-cadl-ranch.js --tag=modular", - "generate-tsp-only:azure-modular": "npx tsx ./test/commands/gen-cadl-ranch.js --tag=azure-modular", + "generate-tsp-only:rlc": "npx tsx ./test/commands/gen-spector.js --tag=rlc", + "generate-tsp-only:azure-rlc": "npx tsx ./test/commands/gen-spector.js --tag=azure-rlc", + "generate-tsp-only:modular": "npx tsx ./test/commands/gen-spector.js --tag=modular", + "generate-tsp-only:azure-modular": "npx tsx ./test/commands/gen-spector.js --tag=azure-modular", "regen-test-baselines": "npm run generate-tsp-only", "integration-test:alone": "npm run integration-test:alone:rlc && npm run integration-test:alone:azure-rlc && npm run integration-test:alone:modular && npm run integration-test:alone:azure-modular", "integration-test:alone:rlc": "vitest run --project integration-rlc", diff --git a/packages/typespec-ts/test/azureModularIntegration/payloadMultipart.spec.ts b/packages/typespec-ts/test/azureModularIntegration/payloadMultipart.spec.ts index 6886afe3cc..467f29abc3 100644 --- a/packages/typespec-ts/test/azureModularIntegration/payloadMultipart.spec.ts +++ b/packages/typespec-ts/test/azureModularIntegration/payloadMultipart.spec.ts @@ -23,7 +23,7 @@ // id: "123", // profileImage: { // contents: fs.createReadStream(imgPath), -// // must specify a filename due to cadl-ranch limitations +// // must specify a filename due to spector limitations // filename: "test.jpg" // } // }); diff --git a/packages/typespec-ts/test/commands/gen-cadl-ranch.js b/packages/typespec-ts/test/commands/gen-spector.js similarity index 94% rename from packages/typespec-ts/test/commands/gen-cadl-ranch.js rename to packages/typespec-ts/test/commands/gen-spector.js index 97b15fbe45..88b008a6f3 100644 --- a/packages/typespec-ts/test/commands/gen-cadl-ranch.js +++ b/packages/typespec-ts/test/commands/gen-spector.js @@ -3,7 +3,7 @@ import { azureModularTsps, azureRlcTsps, rlcTsps -} from "./cadl-ranch-list.js"; +} from "./spector-list.js"; import { runTypespec } from "./run.js"; async function generateTypeSpecs(tag = "rlc", isDebugging, pathFilter) { @@ -68,12 +68,12 @@ async function main() { let exitCode = 0; try { - console.time("generate-cadl-ranch"); + console.time("generate-spector"); await main(); } catch (e) { console.error(e); exitCode = 1; } finally { - console.timeEnd("generate-cadl-ranch"); + console.timeEnd("generate-spector"); process.exit(exitCode); } diff --git a/packages/typespec-ts/test/commands/cadl-ranch-list.js b/packages/typespec-ts/test/commands/spector-list.js similarity index 100% rename from packages/typespec-ts/test/commands/cadl-ranch-list.js rename to packages/typespec-ts/test/commands/spector-list.js diff --git a/packages/typespec-ts/test/modularIntegration/payloadMultipart.spec.ts b/packages/typespec-ts/test/modularIntegration/payloadMultipart.spec.ts index 19978a7234..08b1bfd158 100644 --- a/packages/typespec-ts/test/modularIntegration/payloadMultipart.spec.ts +++ b/packages/typespec-ts/test/modularIntegration/payloadMultipart.spec.ts @@ -25,7 +25,7 @@ describe("Multipart Client", () => { id: "123", profileImage: { contents: fs.createReadStream(imgPath), - // must specify a filename due to cadl-ranch limitations + // must specify a filename due to spector limitations filename: "test.jpg" } }); diff --git a/packages/typespec-ts/test/modularUnit/scenarios/operations/wrapNonModelReturn.md b/packages/typespec-ts/test/modularUnit/scenarios/operations/wrapNonModelReturn.md index bd26f0c1dc..92bebd7dfa 100644 --- a/packages/typespec-ts/test/modularUnit/scenarios/operations/wrapNonModelReturn.md +++ b/packages/typespec-ts/test/modularUnit/scenarios/operations/wrapNonModelReturn.md @@ -1,6 +1,6 @@ # wrap-non-model-return wraps string scalar response with body property -When `wrap-non-model-return` is enabled, scalar/non-model responses are wrapped with a `body` property to maintain HLC compatibility. +When `wrap-non-model-return` is enabled, scalar/non-model responses are wrapped with a `body` property to maintain AutoRest backward compatibility. ## TypeSpec @@ -281,7 +281,7 @@ export async function get( # wrap-non-model-return does not wrap array-of-models response -Array-of-models responses (Composite kind) are not wrapped — they are returned as `Resource[]` directly (matching HLC behavior where PropertyKind.Composite means no body wrapper). +Array-of-models responses (Composite kind) are not wrapped — they are returned as `Resource[]` directly (matching AutoRest behavior where PropertyKind.Composite means no body wrapper). ## TypeSpec @@ -854,7 +854,7 @@ export async function getString( # wrap-non-model-return wraps LRO string response with body property When `wrap-non-model-return` is enabled, LRO operations with non-model final result types -(e.g., string) should also be wrapped in a response type alias for HLC compatibility. +(e.g., string) should also be wrapped in a response type alias for AutoRest backward compatibility. ## TypeSpec @@ -952,7 +952,7 @@ export function getIkeSas( When both `wrap-non-model-return` and `head-as-boolean` are enabled and the operation is a HEAD request with no response body, the response is wrapped as `{ body: boolean }` to indicate resource existence (true = exists, false = not found). -This matches HLC behavior for HEAD operations. +This matches AutoRest behavior for HEAD operations. ## TypeSpec