Skip to content

Add VCR auto-recording in platform debug mode#91

Merged
matyas-jirat-keboola merged 7 commits intomainfrom
feature/vcr-auto-recording
Feb 26, 2026
Merged

Add VCR auto-recording in platform debug mode#91
matyas-jirat-keboola merged 7 commits intomainfrom
feature/vcr-auto-recording

Conversation

@matyas-jirat-keboola
Copy link
Contributor

Summary

  • Adds automatic VCR HTTP recording when a component runs in platform debug mode (KBC_COMPONENT_RUN_MODE=debug)
  • Wraps action execution with VCRRecorder.record_debug_run() from the keboola.vcr package, capturing HTTP interactions for later replay in tests
  • Respects optional VCR_SANITIZERS defined at the component module level for redacting sensitive data
  • Adds keboola.vcr as a dependency in pyproject.toml

How it works

When KBC_COMPONENT_RUN_MODE=debug is set (e.g. via the platform's debug run mode), execute_action() automatically wraps the action dispatch with VCR recording instead of running it directly. The recorded cassette can then be used as fixtures for functional/VCR tests.

Test plan

  • Verify that components run normally (no KBC_COMPONENT_RUN_MODE or any value other than debug) without any change in behaviour
  • Verify that setting KBC_COMPONENT_RUN_MODE=debug triggers VCR recording and produces a cassette
  • Confirm that VCR_SANITIZERS defined in a component module are picked up and applied during recording
  • Run existing test suite to ensure no regressions

🤖 Generated with Claude Code

matyas-jirat-keboola and others added 6 commits February 17, 2026 18:27
execute_action() now detects KBC_COMPONENT_RUN_MODE=debug and
automatically records HTTP interactions via keboola.vcr. Components
can define a module-level VCR_SANITIZERS list for custom sanitizers.

Add keboola.vcr as a dependency.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@kudj kudj self-requested a review February 25, 2026 12:19
Copy link
Contributor

@kudj kudj left a comment

Choose a reason for hiding this comment

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

LGTM

pytz was only used for utc.localize() in one place. Since the project
requires Python >= 3.10, datetime.timezone.utc is a direct stdlib replacement.
Also removes the overly restrictive <2021.0 version pin.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@matyas-jirat-keboola matyas-jirat-keboola merged commit bcb5bd5 into main Feb 26, 2026
2 checks passed
@matyas-jirat-keboola matyas-jirat-keboola deleted the feature/vcr-auto-recording branch February 26, 2026 14:46
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