Skip to content

Rename query_engine.batch_size to max_channels_per_batch - #108

Merged
tombonfert merged 4 commits into
mainfrom
feature/deprecate_batch_size
Sep 30, 2026
Merged

tombonfert merged 4 commits into
mainfrom
feature/deprecate_batch_size

Conversation

@tombonfert

@tombonfert tombonfert commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Closes #102.

query_engine.batch_size limits how many distinct channel selections are solved per batch, not
rows or records. This PR renames it to max_channels_per_batch so it reads alongside
max_containers_per_batch.

Changes

  • New field max_channels_per_batch (default 500, must be >= 1).
  • batch_size remains a deprecated alias: it is still accepted in configs and as an attribute,
    emits a FutureWarning, and maps to the new field. Setting both is a validation error. It will
    be removed in a future release.
  • Updated call sites, the report_utils batch helpers, tests, docs and skills. The docs now state
    what the cap counts (distinct channel(...) / poi_channel(...) selections, and for calculated
    channels their input channels) and that it is a packing target: an expression that alone
    exceeds it runs in its own batch.

Notes

  • The name differs from the issue's proposal (max_selectors_per_batch), because end users know
    channels, not selectors.
  • Batching behaviour is unchanged.
  • config_hash in measurement_dimension changes for every report, because the dumped config
    key is renamed. The column is written but not read anywhere.

Testing

  • Unit: config_parser_test.py (alias mapping, warning, no mutation of the input config, >= 1
    validation, deprecated attribute and setter) and report_utils_test.py.
  • Integration: batched_report_pipeline_test.py and calculated_channel_test.py.
  • make lint

Test Plan

  • Unit tests added/updated
  • Manual testing completed
  • Documentation updated (if applicable)

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • No new linter warnings introduced

…s_per_batch

The old name implied a row-count cap, but the setting bounds unique TimeSeriesSelector instances per solve batch. Rename the field throughout the config, report utilities, Report batched solve paths, tests, and documentation. Keep batch_size as a deprecated alias that warns and maps to max_selectors_per_batch; setting both names raises a validation error.
- Copy the input dict in the alias shim so the caller's config is not mutated
- Emit FutureWarning instead of DeprecationWarning so users actually see it
- Add a deprecated batch_size property/setter forwarding to max_selectors_per_batch
- Reject max_selectors_per_batch < 1, mirroring max_containers_per_batch
- Wrap two over-long test docstrings
…s_per_batch

The setting bounds distinct input channels per solve batch, not generic selectors. Rename the field across config, report utilities, Report batched solve paths, tests, and documentation. Keep `batch_size` as a deprecated alias that now maps to `max_channels_per_batch`; setting both names raises a validation error.
…deprecated batch_size setter

- Update `build_batches` and report utilities to deduplicate selectors by `selector_id` rather than object identity, so equivalent channel selections count once.
- Allow a single expression whose own inputs exceed `max_channels_per_batch` to run in its own batch instead of failing.
- Make the deprecated `batch_size` setter validate the assigned value with the same `>= 1` rule as construction.
- Update configuration and API docs to describe the cap as a packing target and clarify selector deduplication behavior.
- Add a unit test verifying the deprecated setter rejects non-positive values.
@tombonfert
tombonfert requested a review from a team as a code owner September 30, 2026 11:29
@codecov

codecov Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.93939% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.82%. Comparing base (f77666f) to head (9ef4b5e).

Files with missing lines Patch % Lines
src/impulse_reporting/config/config_parser.py 93.54% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #108      +/-   ##
==========================================
+ Coverage   89.80%   89.82%   +0.01%     
==========================================
  Files          62       62              
  Lines        5740     5770      +30     
  Branches      722      726       +4     
==========================================
+ Hits         5155     5183      +28     
- Misses        463      464       +1     
- Partials      122      123       +1     
Flag Coverage Δ
query_engine 86.15% <ø> (ø)
reporting 94.63% <93.93%> (-0.02%) ⬇️

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

Files with missing lines Coverage Δ
...c/impulse_reporting/channels/calculated_channel.py 100.00% <ø> (ø)
src/impulse_reporting/core/report.py 93.33% <ø> (ø)
src/impulse_reporting/core/report_utils.py 97.81% <100.00%> (ø)
src/impulse_reporting/config/config_parser.py 96.59% <93.54%> (-0.48%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tombonfert
tombonfert merged commit c0ffd61 into main Sep 30, 2026
6 checks passed
@tombonfert
tombonfert deleted the feature/deprecate_batch_size branch September 30, 2026 16:59
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.

Deprecate query_engine.batch_size in favour of max_selectors_per_batch

1 participant