diagnosing-vcr-failures
Skill918 starsChanged 10 days agoMITView on GitHub
Use when ASO controller CRUD tests or sample tests fail during playback or recording, to diagnose the failure and re-record if needed.
- Reads credentials
In this repository8 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- create-new-resourceSkill
- create-release-notesSkill
- create-releaseSkill
- migrate-group-versioningSkill
- migrate-json-golden-testsSkill
- testing-aso-recordingsSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
19 rules. About 0 are common, 13 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈13
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 24
Search for FAIL: (trailing colon avoids false positives).
- Distinctive: line 30
IMPORTANT: Before deleting a recording and re-recording, always investigate WHY the test failed.
- Distinctive: line 38
If recording is unmodified (git status shows clean) → the recording is stale.
- Distinctive: line 39
If recording was already updated (you just re-recorded or it shows modified in git) → the test or controller is making an unexpected …
- Distinctive: line 59
Signature: test fails with a context deadline or timeout during a live Azure recording run.
- Distinctive: line 64
If the test still fails with a longer timeout, investigate further (e.g., is the resource stuck provisioning?) and report to user.
- Very specific: line 70
Check the sample YAML for location/locationName fields.
- Distinctive: line 71
Check what regions other samples in the same resource group use — prefer consistency.
- Very specific: line 72
Update the sample YAML to use a different Azure region (e.g.
- Distinctive: line 73
Delete the failed/partial recording and re-run.
- Distinctive: line 74
If the new region also fails, try another region and repeat.
- Distinctive: line 80
Delete the recording file for the failing test from the appropriate recordings directory (see Quick Reference table).
- Distinctive: line 84
Run as a background terminal:
- Very specific: line 108
Run the same command without source test.env:
- Distinctive: line 118
When a recording attempt fails, watch for:
- Distinctive: line 126
If new failures appear, loop back to the top and diagnose them.
- Very specific: line 134
Monitoring: Run as background terminals and use await_terminal.
- Very specific: line 137
If await_terminal times out, just call it again.
- Distinctive: line 141
When finished, provide a table to the user showing which tests were re-recorded and why.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Diagnose and Fix go-vcr Test Failures
This skill covers diagnosing failures in ASO's go-vcr recording/replay tests (both controller CRUD and sample tests) and re-recording when needed.
For running tests and understanding the test suites, see the testing-aso-recordings skill.
Quick Reference
| Controllers | Samples | |
| Task command | controller:test-controllers | controller:test-samples |
| Log file | reports/test-controllers.log | reports/test-samples.log |
| Recordings dir | v2/internal/controllers/recordings/ | v2/samples/sampletesting/recordings/Test_Samples_CreationAndDeletion/ |
Identifying Failures
Logs overflow the terminal buffer. Always use the log file (see table above).
- Search for
FAIL:(trailing colon avoids false positives). - Initial failures often cascade — identify the first problem.
- Compare the error message against the known failure modes below.
Known Failure Modes
IMPORTANT: Before deleting a recording and re-recording, always investigate WHY the test failed. Blindly re-recording wastes time (30–60 min) and may not fix the problem. If you can't determine the root cause, report to the user and ask for guidance.
Missing interaction
Signature: go-vcr error containing "no responses recorded for this method/URL".
The test made an HTTP request that doesn't exist in the recording.
- If recording is unmodified (
git statusshows clean) → the recording is stale. Delete it and re-record. - If recording was already updated (you just re-recorded or it shows modified in git) → the test or controller is making an unexpected request. Investigate what changed; report to user.
Body hash mismatch
Signature: go-vcr error containing "body mismatch" and/or logs showing "Request body hash header mismatch".
The test found the right URL in the recording but the request body differs.
- Recording unmodified → stale, re-record.
- Recording just created (you literally just recorded it) → non-deterministic serialization. The request body is being serialized differently across runs. This is a systemic issue. Do NOT keep re-recording — report to user.
Test assertion failure
Signature: assertion error from test code (e.g. "Expected true to be false", "Expected ... to have length"), NOT a go-vcr error.
- During recording (live Azure) → likely a real bug in the controller or test code. Report to user.
- During playback → typically means the replay roundtripper is returning stale cached responses that don't reflect the current resource state. The recording may need re-creating, but if not, report the specific assertion and context to user.
Timeout while recording
Signature: test fails with a context deadline or timeout during a live Azure recording run.
Some resources take 30+ min to provision (ApiManagement, Kusto, etc.) and the default test timeout may be insufficient.
- Extend timeout: add
TIMEOUT=90mto the command line. - If the test still fails with a longer timeout, investigate further (e.g., is the resource stuck provisioning?) and report to user.
Lack of capacity or quota
Signature: ServiceUnavailable with a message about "high demand" in a region, or quota/capacity exceeded errors during recording.
- Check the sample YAML for
location/locationNamefields. - Check what regions other samples in the same resource group use — prefer consistency.
- Update the sample YAML to use a different Azure region (e.g.
eastus→australiaeastorwestus2). - Delete the failed/partial recording and re-run.
- If the new region also fails, try another region and repeat.
Re-Recording Workflow
Step 1: Delete the stale recording
Delete the recording file for the failing test from the appropriate recordings directory (see Quick Reference table).
Step 2: Record
Run as a background terminal:
Controllers:
source test.env && TIMEOUT=60m TEST_FILTER="<your-test-here>" task controller:test-controllersSamples (note the Test_Samples_CreationAndDeletion/ prefix is required):
source test.env && TIMEOUT=60m TEST_FILTER="Test_Samples_CreationAndDeletion/<your-test-here>" task controller:test-samplesExample: to re-record Test_Redis_v1api20230801_CreationAndDeletion:
source test.env && TIMEOUT=60m TEST_FILTER="Test_Samples_CreationAndDeletion/Test_Redis_v1api20230801_CreationAndDeletion" task controller:test-samplesFor slow-provisioning resources, use TIMEOUT=90m. Record one test at a time to isolate problems.
Step 3: Verify playback
Run the same command without source test.env:
TIMEOUT=60m TEST_FILTER="<your-test-here>" task controller:<SUITE>Playback takes 1–3 min. If playback fails but recording succeeded, this is a systemic VCR issue (e.g. non-deterministic request serialization) — do NOT keep re-recording. Investigate and report.
Step 4: Handle failed recording attempts
When a recording attempt fails, watch for:
- Azure debris — failed runs can leave resources in Azure (resource groups, Entra security groups, etc.) that weren't cleaned up. On retry, the test may adopt these pre-existing resources instead of creating new ones, causing unexpected behavior. Wait a few minutes for Azure cleanup, delete the partial recording, and try again. Sometimes the quickest fix is to run a live test (which will delete everything in the resource group) and then re-record.
Step 5: Run the full suite
Once updated recordings pass individually, re-run the full test suite to confirm all tests pass. A test run exits on first failure, leaving later tests unexecuted. The full re-run confirms all problems are resolved and there are no hidden issues.
If new failures appear, loop back to the top and diagnose them.
Guidance
- DO NOT interrupt a test run, even if slow. Interrupting can leave Azure debris that pollutes the next recording attempt.
- NEVER modify recording files by hand. They are machine-generated and must only be created by running the tests.
- DO NOT analyze recording YAML files to debug mismatches. They're large and machine-generated — manual inspection is not productive. Delete and re-record instead.
- ALWAYS use
taskdirectly — never use./hack/tools/task. Iftaskis not on the PATH, your environment is not set up correctly for testing. Stop and ask the user to fix your environment. - Monitoring: Run as background terminals and use
await_terminal. DO NOT poll logs in a loop. Timeouts:- Playback (single): 5 min (300000ms)
- Recording (single): 10 min (600000ms), then repeat — can take 20–60+ min
- If
await_terminaltimes out, just call it again.
Postrequisites
When finished, provide a table to the user showing which tests were re-recorded and why.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

