azure/rerecord-tests
Re-record the ai-projects live test suite, push only the recordings whose playback passes to the Azure/azure-sdk-assets repo, and open a PR for the updated assets.json. Use when test recordings are stale, a recorded test fails in playback in CI, or new recorded tests need fresh recordings. Wraps TEST_MODE=record / TEST_MODE=playback runs, dev-tool test-proxy push, and a single-file assets.json PR via the gh CLI.
npx skills add https://github.com/Azure/azure-sdk-for-js --skill rerecord-tests
Records the live test suite for @azure/ai-projects, verifies the new
recordings play back green, pushes only the passing recordings to the
Azure/azure-sdk-assets repo, and opens a PR that contains just the updated
assets.json tag.
This package uses the asset-sync workflow: recordings live in
Azure/azure-sdk-assets, not in this repo. The only file that lands in a PR is
assets.json, whose Tag points at the pushed
recordings. See sdk/test-utils/recorder/ASSET_SYNC_WORKFLOW.md.
playback mode.author-tests skill) and needreal recordings captured against live Azure resources.
assets.json.authenticated (az login, or a working DefaultAzureCredential) and have the
test environment variables populated. Key ones (see
test/public/utils/createClient.ts):
FOUNDRY_PROJECT_ENDPOINT, FOUNDRY_MODEL_NAME, FOUNDRY_AGENT_NAME,
AZURE_AI_PUBLISHED_ENDPOINT, MODEL_ENDPOINT, plus the connection-id vars
for the tool tests. Missing vars only fail the tests that need them — those
recordings are simply not pushed (see "Only passing recordings", below).
Azure/azure-sdk-assets. Required by test-proxy push.pwsh and the gh CLI installed and authenticated againstAzure/azure-sdk-for-js.
sdk/ai/ai-projects/.Run everything from sdk/ai/ai-projects/. The flow mirrors the asset-sync
diagram: record → verify in playback → push → commit assets.json → PR.
npx dev-tool test-proxy restore
Pulls the recordings referenced by the current assets.json so re-recording
diffs against a known baseline.
./.github/skills/rerecord-tests/scripts/rerecord.ps1
The script (scripts/rerecord.ps1):
TEST_MODE=record npm run test:node),writing fresh recordings into the repo-root .assets/ working tree.
TEST_MODE=playback) with nolive env vars, to prove the recordings are self-contained.
manual steps to drop the failing recordings (so only passing recordings are
ever published — see "Only passing recordings").
-Push to also run `npx dev-tool test-proxypush, which uploads the kept recordings and rewrites the Tag` in
assets.json. -Push is ignored when playback is red.
Useful flags:
-TestFilter <pattern> — scope to a subset (passed through to the vitestrunner) instead of the whole suite.
-Push — push recordings and update assets.json after a green playback.-SkipRecord — skip record mode and only re-run playback verification(useful after manually fixing a recording).
If you ran Step 2 without -Push, push once playback is green:
npx dev-tool test-proxy push
This updates the Tag field in assets.json. Confirm the diff:
git --no-pager diff -- assets.json
Only the Tag line should change. The recordings are now visible at
https://github.com/Azure/azure-sdk-assets/tree/<new-tag>.
./.github/skills/rerecord-tests/scripts/open-assets-pr.ps1
The script (scripts/open-assets-pr.ps1):
assets.json has no change, or if there are changes outsidesdk/ai/ai-projects/assets.json (the only file this PR should touch).
rerecord/ai-projects/<yyyyMMdd-HHmm> from HEAD.assets.json with message[ai-projects] Re-record tests: update assets.json.
origin (never force) and opens a draft PR via gh, with abody that links the new assets tag and lists the verification checklist.
The user contract is "push the recordings that pass." A recording is "passing"
only if its spec is green in playback mode (Step 2.2). When playback is red,
the script refuses to push and tells you to drop the failing recordings first,
so the assets tag never publishes a broken recording.
To inspect or hand-tune what will be pushed:
npx dev-tool test-proxy diff — it locates the .assets/<hash>/ clone(via .assets/.breadcrumb) and prints the changed recording files for this
package.
cd into that clone dir and git restore <file> (or git clean) anyrecording you do not want pushed.
sdk/ai/ai-projects/ and run npx dev-tool test-proxy push (or./.github/skills/rerecord-tests/scripts/rerecord.ps1 -SkipRecord -Push).
record mode can't authenticate, surface that to the human — do not fabricate
recordings.
test/**). If a spec needs a code change torecord cleanly, that belongs to the author-tests skill or a human.
git push --force / --force-with-lease.assets.json. Recordings live in theassets repo, not here.
sdk/ai/ai-projects/.-TestFilter whileiterating on a single failing spec, then do a full run before pushing.
contains an unsanitized value or a non-deterministic field. Re-run with
dev-tool run test:vitest --test-proxy-debug to see sanitizer activity, fix
the sanitizer in test/public/utils/createClient.ts, and re-record.
npm run test:node runs both recorded and unit-style specs. Pure unitspecs (e.g. test/public/tracing/*.spec.ts) don't produce recordings and are
unaffected by record/playback mode.
Take azure/rerecord-tests from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.
The instructions reference npx.
Without those the skill loads but fails at the first command.