Skip to content

fix: reset per-run counters + timing each run (#246)#247

Merged
Chris-Wolfgang merged 2 commits into
mainfrom
feature/reset-run-state
Jun 24, 2026
Merged

fix: reset per-run counters + timing each run (#246)#247
Chris-Wolfgang merged 2 commits into
mainfrom
feature/reset-run-state

Conversation

@Chris-Wolfgang

Copy link
Copy Markdown
Owner

Fixes the cumulative-across-runs behavior of the base-class counters. Closes #246.

Stacked on #244 (base feature/report-timing) because it also resets the StartedAt/Elapsed timing that #244 introduced — which had the same cumulative bug.

Problem

CurrentItemCount / CurrentSkippedItemCount were cumulative for the lifetime of the instance: running the same instance twice continued from where the prior run ended (N → 2N). The timing added in #144/#91 had the identical issue (StartedAt captured once, Elapsed ever-growing), which would make ItemsPerSecond nonsensical on a re-run.

Fix

Per the decisions on #246: reset on each run, kept in all three base classes (no shared base).

Each run resets the counters and the timing to their initial state:

  • Extractor / Transformer — at enumeration start (the reset lives in a wrapper async-iterator that all ExtractAsync/TransformAsync overloads route through, so it fires lazily when the consumer begins enumerating, not at call time).
  • Loader — at LoadAsync invocation (the load isn't lazy).

The reset is private — no public API change. The per-run contract is now documented on the CurrentItemCount XML docs, and concurrent re-enumeration of a single instance is stated as unsupported (consistent with the one-shot Pipeline model).

Verified

  • Full Release build clean across all TFMs (0 warnings).
  • 234 tests pass — 3 new tests assert a second run on the same extractor / loader / transformer reports N, not 2N.

Unblocks the ETL-Test-Kit idempotency contract tests (Chris-Wolfgang/ETL-Test-Kit#15).

Part of: #154

CurrentItemCount / CurrentSkippedItemCount (and the StartedAt/Elapsed timing
added in #144/#91) were cumulative for the lifetime of the instance — running
the same instance twice continued counting from where the prior run ended.

Each run now resets those to their initial state at enumeration start
(extractor/transformer) or at LoadAsync invocation (loader), so a re-run reports
the current run's figures rather than a cumulative total. All run overloads route
through a reset-aware wrapper so the reset fires consistently under lazy
enumeration. Kept in all three base classes (no shared base, per the decision on
#246); the reset is private — no public API change. Contract documented on the
CurrentItemCount XML docs; concurrent re-enumeration of one instance is stated as
unsupported.

Verified: full Release build clean across all TFMs (0 warnings); 234 tests pass
(3 new per-run-reset tests across extractor/loader/transformer). Unblocks the
ETL-Test-Kit idempotency contract tests (ETL-Test-Kit#15).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Base automatically changed from feature/report-timing to main June 24, 2026 00:41
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.

CurrentItemCount / CurrentSkippedItemCount are cumulative across runs (never reset) in all three base classes

1 participant