Skip to content

Strengthen contract tests for batching, cancellation and dynamic updates #86

Description

@MasterOfBinary

Current outcome

Replace coverage-driven housekeeping with behavioral evidence needed by a real concurrent consumer.

Replanned on 2026-09-06 against GoBatch master 63ef757 and ShitQuant's recorder, enrichment, paper/replay, and flow workloads. This is an implementation target, not a claim that the behavior already exists.

Required behavior

Verification and completion

Identify actual behavioral gaps after current PRs and API changes, add tests that fail for the corresponding broken behavior, and show race-enabled results. No statement-coverage target.

Follow the repository's formatting, race-test, vet/lint, package documentation, example and changelog requirements for the changed surface. Report the actual supported behavior and migration; do not treat a passing coverage percentage as proof of these outcomes.

Scope and relationships

#69 is already merged. Coordinate #73/#90 and PR #65; this issue is targeted hardening, not a requirement to refactor every test.

Design history

The earlier report/prototype remains below for provenance; the requirements above supersede conflicting prescriptions. Existing discussion is preserved.

Original issue: Test robustness: gaps the 97%+ statement coverage hides

From a test-quality audit (validated @ 58cee73; statement coverage is excellent but several behaviors are unguarded):

  • Dynamic-config mid-run pickup has no deterministic unit test. The only behavioral guard was Example_dynamicConfig's exact output — which PR test: make Example_* output deterministic #69 (correctly) makes stop asserting batch sizes. After test: make Example_* output deterministic #69, a regression where doProcessors caches config.Get() once would pass the whole suite. Add a unit test that pins per-batch config re-read using a synchronization barrier (not sleeps).
  • SourceError.Error() has 0% coverage — the "source error: %v" format contract is unguarded.
  • The MaxItems < MinItems clamp in fixConfig is mutation-inert — deleting it fails no test (the MaxItems return path fires before MinItems is consulted). Cover it via observable batch sizes, or fold the clamp into validation (Bound stream execution and validate formation/resource configuration #73).
  • Change-detector tests in buffer_config_test.go assert DefaultItemBufferSize == 100 etc. — they restate constants.go and fail legitimate retuning; keep only the >= 1 sanity checks.
  • Duplicate test helpers: testSource/countProcessor are defined twice with different shapes (external batch_test vs internal helpers_test) — drift hazard, consolidate.
  • Uncovered branches: IgnoreErrors(nil) guard; ExecuteBatches with cfg.B == nil (only cfg == nil is tested); empty configs....

Sequencing: after PR #69 lands (it rewrites the example files these gaps interact with).

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions