Skip to content

fix: Require batch encoding for BATCH output - #3779

Draft
edgarrmondragon wants to merge 6 commits into
mainfrom
fix/BATCH-encoding-format
Draft

edgarrmondragon wants to merge 6 commits into
mainfrom
fix/BATCH-encoding-format

Conversation

@edgarrmondragon

@edgarrmondragon edgarrmondragon commented Sep 12, 2026

Copy link
Copy Markdown
Collaborator

Summary by Sourcery

Require batch-capable taps to configure the encoding format for BATCH output while keeping it optional for targets.

Bug Fixes:

  • Require taps that support BATCH output to declare the batch encoding format in their configuration.

Enhancements:

  • Allow targets to keep batch encoding configuration optional because they read encoding details from incoming BATCH messages.
  • Share batch configuration schema construction while providing tap- and target-specific encoding requirements.

…er BATCH output is opted into

Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
@edgarrmondragon edgarrmondragon self-assigned this Sep 12, 2026
@edgarrmondragon

Copy link
Copy Markdown
Collaborator Author

@sourcery-ai title

@sourcery-ai

sourcery-ai Bot commented Sep 12, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The PR tightens batch output configuration validation by requiring an encoding format, preventing BATCH outputs from being configured without specifying how files should be encoded.

File-Level Changes

Change Details Files
Make the batch output encoding format a mandatory configuration field.
  • Mark the batch output format property as required so invalid configurations are rejected during schema validation.
  • Preserve the existing format description and supported compression/encoding options.
singer_sdk/helpers/capabilities.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

@sourcery-ai sourcery-ai Bot changed the title feat: Make the batch_config.encoding.format setting required whenever BATCH output is opted into Require batch encoding format for BATCH output Sep 12, 2026
@edgarrmondragon edgarrmondragon changed the title Require batch encoding format for BATCH output fix: Require batch encoding format for BATCH output Sep 12, 2026
@codecov

codecov Bot commented Sep 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.47%. Comparing base (43b3563) to head (649134b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3779   +/-   ##
=======================================
  Coverage   94.47%   94.47%           
=======================================
  Files          74       74           
  Lines        6298     6303    +5     
  Branches      771      771           
=======================================
+ Hits         5950     5955    +5     
  Misses        260      260           
  Partials       88       88           
Flag Coverage Δ
core 83.10% <100.00%> (+0.01%) ⬆️
end-to-end 76.23% <100.00%> (+0.01%) ⬆️
optional-components 45.02% <85.71%> (+0.04%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 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

codspeed Bot commented Sep 12, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 14 untouched benchmarks


Comparing fix/BATCH-encoding-format (649134b) with main (6bd41c4)

Open in CodSpeed

@edgarrmondragon edgarrmondragon added configuration BATCH Support for BATCH messages labels Sep 12, 2026
@edgarrmondragon edgarrmondragon added this to the v0.55 milestone Sep 12, 2026
@edgarrmondragon
edgarrmondragon marked this pull request as ready for review September 12, 2026 21:25

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

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

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="singer_sdk/helpers/capabilities.py" line_range="206-209" />
<code_context>
                         description="Compression format to use for batch files.",
                     ),
                 ),
+                required=True,
             ),
             Property(
</code_context>
<issue_to_address>
**issue (bug_risk):** The new `required=True` applies to the `encoding` property of `batch_config`, not to the nested `format` property. A BATCH configuration containing `"encoding": {}` still passes the generated JSON Schema, so the required batch encoding format is not enforced.

**Triggers:** When BATCH output is enabled and the configuration includes `batch_config.encoding` without `format`.

**Suggested fix:** Set `required=True` on the nested `Property("format", ...)` instead of on the `encoding` property.

```suggestion
                    Property(
                        "format",
                        StringType,
                        title="Batch Encoding Format",
                        description="Format to use for batch files.",
                        required=True,
                    ),
                    Property(
                        "compression",
                        StringType,
                        allowed_values=["gzip", "none"],
                        title="Batch Compression Format",
                        description="Compression format to use for batch files.",
                    ),
                ),
```
</issue_to_address>

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: singer_sdk/helpers/capabilities.py:209


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread singer_sdk/helpers/capabilities.py Outdated
edgarrmondragon and others added 2 commits September 12, 2026 15:27
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
@edgarrmondragon

Copy link
Copy Markdown
Collaborator Author

@sourcery-ai review

sourcery-ai[bot]
sourcery-ai Bot previously approved these changes Sep 12, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sourcery assessment

Approved.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

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

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="singer_sdk/helpers/capabilities.py" line_range="201" />
<code_context>
                         title="Batch Encoding Format",
                         description="Format to use for batch files.",
+                        required=True,
                     ),
                     Property(
                         "compression",
</code_context>
<issue_to_address>
**issue (bug_risk):** Making `format` required only inside the optional `encoding` object does not require it for every `batch_config`. A configuration such as `{"batch_config": {"storage": {"root": "..."}}}` still passes the generated schema because `encoding` itself is optional, then `BatchConfig.from_dict()` raises `TypeError` when BATCH processing constructs `BatchConfig` without an `encoding`.

**Triggers:** When BATCH output is enabled with `batch_config` containing storage or other settings but no `encoding` object.

**Suggested fix:** Make `encoding` required whenever `batch_config` is present, or add a conditional schema requiring `encoding.format` for BATCH configurations.
</issue_to_address>

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: singer_sdk/helpers/capabilities.py:201


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread singer_sdk/helpers/capabilities.py
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
@sourcery-ai
sourcery-ai Bot dismissed their stale review September 12, 2026 21:31

Sourcery withdrew this approval because the latest commits introduced blocking findings.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

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

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="singer_sdk/helpers/capabilities.py" line_range="209" />
<code_context>
                         description="Compression format to use for batch files.",
                     ),
                 ),
+                required=True,
             ),
             Property(
</code_context>
<issue_to_address>
**issue (bug_risk):** The schema requires the `encoding` object but leaves its `format` property optional, so a BATCH configuration such as `{"encoding": {"compression": "gzip"}}` passes validation and later `BaseBatchFileEncoding.from_dict` raises `TypeError` because the required `format` constructor argument is missing.

**Triggers:** When BATCH output is enabled and the configuration supplies encoding without a format.

**Suggested fix:** Set `required=True` on the nested `format` Property, rather than only on the `encoding` Property.
</issue_to_address>

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: singer_sdk/helpers/capabilities.py:209


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread singer_sdk/helpers/capabilities.py Outdated
@edgarrmondragon edgarrmondragon changed the title fix: Require batch encoding format for BATCH output fix: Require batch encoding for BATCH output Sep 12, 2026
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
@edgarrmondragon
edgarrmondragon marked this pull request as draft September 12, 2026 21:33

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sourcery assessment

Approved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BATCH Support for BATCH messages configuration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant