Skip to content

feat: Expose emit_activate_version_messages as a built-in tap setting#3657

Merged
edgarrmondragon merged 1 commit into
mainfrom
feat/activate-version-setting
May 28, 2026
Merged

feat: Expose emit_activate_version_messages as a built-in tap setting#3657
edgarrmondragon merged 1 commit into
mainfrom
feat/activate-version-setting

Conversation

@edgarrmondragon
Copy link
Copy Markdown
Collaborator

@edgarrmondragon edgarrmondragon commented May 28, 2026

SSIA

Summary by Sourcery

Expose the emit_activate_version_messages option as a built-in tap configuration setting when activate-version support is enabled.

New Features:

  • Add emit_activate_version_messages as a built-in tap config option gated by the activate-version plugin capability.

Tests:

  • Extend tap config default injection test to cover the new emit_activate_version_messages setting.

Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
@edgarrmondragon edgarrmondragon self-assigned this May 28, 2026
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented May 28, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR wires the tap capability for activate-version handling into the generic plugin capability system and injects a built-in config option emit_activate_version_messages whenever that capability is enabled, updating tests to assert the new default config shape.

Flow diagram for append_builtin_config handling ACTIVATE_VERSION capability

flowchart 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
Loading

File-Level Changes

Change Details Files
Switch activate-version support from tap-specific capability to plugin-level capability.
  • Remove TapCapabilities.ACTIVATE_VERSION from the tap capabilities list.
  • Add PluginCapabilities.ACTIVATE_VERSION to the tap capabilities list so activate-version is treated as a plugin capability.
singer_sdk/tap_base.py
Inject built-in configuration for controlling activate-version message emission when the plugin advertises that capability.
  • In append_builtin_config, when PluginCapabilities.ACTIVATE_VERSION is present, merge EMIT_ACTIVATE_VERSION_CONFIG into the provided config_jsonschema using merge_missing_config_jsonschema.
  • Leave existing batch config injection logic unchanged but now conditional runs after the activate-version config injection.
singer_sdk/tap_base.py
Update config default injection test to account for the new emit_activate_version_messages setting.
  • Extend expected_tap_config in test_tap_config_default_injection to include emit_activate_version_messages: False as the default.
  • Keep other expected configuration values as-is to ensure backward compatibility.
tests/core/test_jsonschema_helpers.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@edgarrmondragon edgarrmondragon added the Type/Tap Singer taps label May 28, 2026
@edgarrmondragon edgarrmondragon added this to the v0.55 milestone May 28, 2026
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • 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.
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>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread tests/core/test_jsonschema_helpers.py
@read-the-docs-community
Copy link
Copy Markdown

Documentation build overview

📚 Meltano SDK | 🛠️ Build #32894734 | 📁 Comparing 5d789e9 against latest (f291961)

  🔍 Preview build  

2 files changed
± classes/singer_sdk.Tap.html
± classes/singer_sdk.sql.SQLTap.html

@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 93.88%. Comparing base (f291961) to head (5d789e9).

Files with missing lines Patch % Lines
singer_sdk/tap_base.py 50.00% 0 Missing and 1 partial ⚠️

❌ 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     
Flag Coverage Δ
core 82.63% <50.00%> (-0.02%) ⬇️
end-to-end 75.22% <50.00%> (-0.01%) ⬇️
optional-components 42.74% <0.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented May 28, 2026

Merging this PR will not alter performance

✅ 8 untouched benchmarks


Comparing feat/activate-version-setting (5d789e9) with main (f291961)

Open in CodSpeed

@edgarrmondragon edgarrmondragon merged commit 210cb24 into main May 28, 2026
39 of 41 checks passed
@edgarrmondragon edgarrmondragon deleted the feat/activate-version-setting branch May 28, 2026 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type/Tap Singer taps

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant