feat: Expose emit_activate_version_messages as a built-in tap setting#3657
Conversation
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR wires the tap capability for activate-version handling into the generic plugin capability system and injects a built-in config option Flow diagram for append_builtin_config handling ACTIVATE_VERSION capabilityflowchart TD
A[Tap.append_builtin_config called] --> B[PluginBase.append_builtin_config]
B --> C{PluginCapabilities.ACTIVATE_VERSION in cls.capabilities?}
C -- Yes --> D[merge_missing_config_jsonschema
EMIT_ACTIVATE_VERSION_CONFIG
config_jsonschema]
C -- No --> E[Skip EMIT_ACTIVATE_VERSION_CONFIG]
D --> F{PluginCapabilities.BATCH in cls.capabilities?}
E --> F
F -- Yes --> G[merge_missing_config_jsonschema
BATCH_CONFIG
config_jsonschema]
F -- No --> H[Return]
G --> H
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- Switching from
TapCapabilities.ACTIVATE_VERSIONtoPluginCapabilities.ACTIVATE_VERSIONinTap.capabilitiescould break taps that still use the former constant; consider providing a compatibility path or explicit deprecation to avoid surprising behavior. - Given that
append_builtin_confignow gatesEMIT_ACTIVATE_VERSION_CONFIGonPluginCapabilities.ACTIVATE_VERSION, it might be worth clarifying or consolidating where activate-version capabilities should be declared to avoid confusion betweenTapCapabilitiesandPluginCapabilities.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Switching from `TapCapabilities.ACTIVATE_VERSION` to `PluginCapabilities.ACTIVATE_VERSION` in `Tap.capabilities` could break taps that still use the former constant; consider providing a compatibility path or explicit deprecation to avoid surprising behavior.
- Given that `append_builtin_config` now gates `EMIT_ACTIVATE_VERSION_CONFIG` on `PluginCapabilities.ACTIVATE_VERSION`, it might be worth clarifying or consolidating where activate-version capabilities should be declared to avoid confusion between `TapCapabilities` and `PluginCapabilities`.
## Individual Comments
### Comment 1
<location path="tests/core/test_jsonschema_helpers.py" line_range="229" />
<code_context>
"username": "foo",
"password": "bar",
"batch_size": -1,
+ "emit_activate_version_messages": False,
}
</code_context>
<issue_to_address>
**suggestion (testing):** Add a dedicated test to verify jsonschema injection for `emit_activate_version_messages` when the capability is enabled.
The current test only checks that the resolved config contains `emit_activate_version_messages` defaulting to `False`; it doesn’t exercise the jsonschema injection driven by `PluginCapabilities.ACTIVATE_VERSION`. Please add a test (e.g. `test_emit_activate_version_config_injection`) that defines a minimal tap with `PluginCapabilities.ACTIVATE_VERSION` in `capabilities`, calls `append_builtin_config`, and asserts that the resulting jsonschema includes the `emit_activate_version_messages` property with the correct type and default.
Suggested implementation:
```python
assert dict(tap.config) == expected_tap_config
def test_emit_activate_version_config_injection() -> None:
"""emit_activate_version_messages is injected when ACTIVATE_VERSION is enabled."""
base_schema = {
"type": "object",
"properties": {},
}
result_schema = append_builtin_config(
base_schema,
{PluginCapabilities.ACTIVATE_VERSION},
)
properties = result_schema["properties"]
assert "emit_activate_version_messages" in properties
emit_activate_version_config = properties["emit_activate_version_messages"]
assert emit_activate_version_config["type"] == "boolean"
assert emit_activate_version_config["default"] is False
```
- Ensure that `append_builtin_config` and `PluginCapabilities` are imported at the top of `tests/core/test_jsonschema_helpers.py`. If they are not already, add something like:
- `from singer_sdk.helpers._jsonschema import append_builtin_config`
- `from singer_sdk.plugin_base import PluginCapabilities`
- If this test file uses a different import path for these symbols, adjust the imports to match the existing conventions in the file.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Documentation build overview
|
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (50.00%) is below the target coverage (100.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #3657 +/- ##
==========================================
- Coverage 93.90% 93.88% -0.02%
==========================================
Files 73 73
Lines 5952 5954 +2
Branches 730 731 +1
==========================================
+ Hits 5589 5590 +1
Misses 270 270
- Partials 93 94 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
SSIA
Summary by Sourcery
Expose the
emit_activate_version_messagesoption as a built-in tap configuration setting when activate-version support is enabled.New Features:
emit_activate_version_messagesas a built-in tap config option gated by the activate-version plugin capability.Tests:
emit_activate_version_messagessetting.