Skip to content

feat: load VCR_SANITIZERS from component script during scaffold recording#7

Merged
matyas-jirat-keboola merged 6 commits intomainfrom
add-sanitizers-from-component
Mar 19, 2026
Merged

feat: load VCR_SANITIZERS from component script during scaffold recording#7
matyas-jirat-keboola merged 6 commits intomainfrom
add-sanitizers-from-component

Conversation

@matyas-jirat-keboola
Copy link
Collaborator

@matyas-jirat-keboola matyas-jirat-keboola commented Mar 19, 2026

Summary

  • Scaffold/record parity: TestScaffolder._record_test() now calls _load_vcr_sanitizers_from_script (the same function used by tester.py during replay) so component-defined sanitizers (e.g. GCS signed URL redaction) are applied when cassettes are first recorded, not only on replay.
  • Sanitizer improvements: DefaultSanitizer.merge refactored; PEP 563 lazy annotations; pre-scan optimisation to skip interactions with no secrets.
  • Recorder improvements: Streaming JSON writer; JSONL interactions written immediately rather than accumulated; _write_interaction rename.

Test plan

  • All 119 existing tests pass (python -m pytest tests/)
  • Manual smoke: scaffold a component that defines VCR_SANITIZERS and verify the cassette output contains sanitized values

🤖 Generated with Claude Code

matyas-jirat-keboola and others added 6 commits March 19, 2026 12:02
…affold recording

Scaffold recording now calls _load_vcr_sanitizers_from_script (same as
the replay path in tester.py) so component-defined sanitizers are applied
consistently when cassettes are first recorded, not only on replay.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ers are provided

Previously, passing a non-None sanitizers list to VCRRecorder replaced the
DefaultSanitizer entirely, so secrets from config.secrets.json were no longer
redacted. Now DefaultSanitizer is always prepended, ensuring credentials are
sanitized even when component-defined sanitizers are also active.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… compat

datetime.UTC was added in Python 3.11; the package requires >=3.10.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ruff target-version was py313 while requires-python is >=3.10, causing UP017
to suggest datetime.UTC which is unavailable on Python 3.10/3.11.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link

@soustruh soustruh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Week done, I appreciate all those code quality improvements! 👍

@matyas-jirat-keboola matyas-jirat-keboola merged commit de174d4 into main Mar 19, 2026
3 checks passed
@matyas-jirat-keboola matyas-jirat-keboola deleted the add-sanitizers-from-component branch March 19, 2026 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants