mix reqord.edit (reqord v0.4.0)
View SourceEdit cassette entries in your editor with automatic JSON encoding/decoding.
This task opens cassette entries in your configured editor (via $EDITOR or $VISUAL), handles JSONL parsing and formatting, and validates changes before saving.
Useful for manually redacting sensitive data like emails, account IDs, or other PII from response bodies.
Usage
# Edit all entries in a cassette (relative to cassette dir)
mix reqord.edit my_test.jsonl
# Edit with full/relative path
mix reqord.edit test/support/cassettes/auth_param_test.jsonl
# Edit a specific entry by index (0-based)
mix reqord.edit my_test.jsonl --entry 0
# Edit entries matching a URL pattern
mix reqord.edit my_test.jsonl --grep "/users"
# Use a specific cassette directory (for short names only)
mix reqord.edit my_test.jsonl --dir test/fixturesOptions
--entry INDEX- Edit only the entry at INDEX (0-based)--grep PATTERN- Edit only entries matching URL pattern--dir PATH- Cassette directory (default: test/support/cassettes)
Workflow
- Task loads cassette entries from JSONL file
- Filters entries based on --entry or --grep if specified
- Formats entries as pretty-printed JSON
- Opens your editor with the JSON content
- Validates JSON after you save and close the editor
- Writes valid entries back to the cassette file
Editor Configuration
The task uses your configured editor in this order:
- $VISUAL environment variable
- $EDITOR environment variable
- Falls back to 'vim' if neither is set
Example: Redacting Emails
# Edit the cassette
mix reqord.edit AccountTest/fetches_user.jsonl
# In your editor, find the response body and change:
# "email": "user@example.com"
# to:
# "email": "[REDACTED]"
# Save and close - the task validates and writes back to JSONLError Handling
- If JSON is invalid after editing, the task shows errors and exits without saving
- Original cassette is preserved if validation fails
- Use
mix reqord.showto verify changes after editing