Skip to content

Pin that a non-empty superseded baseline aggregate is kept while its successor is short (#4292) - #4441

Merged
erikdarlingdata merged 1 commit into
devfrom
test/4292-nonempty-legacy-baseline-kept
Sep 26, 2026
Merged

erikdarlingdata merged 1 commit into
devfrom
test/4292-nonempty-legacy-baseline-kept

Conversation

@erikdarlingdata

Copy link
Copy Markdown
Owner

Refs #4292.

Why

The retirement sweep for a superseded baseline continuous aggregate has two live pins today, both covering the case where the legacy aggregate is EMPTY. There was no live pin for the opposite, and more common, case: a legacy aggregate that still HOLDS rows, paired with a successor whose own oldest bucket has not yet reached the retention horizon. In that state the judge is supposed to return SuccessorShort and the sweep must leave the legacy alone. Without a pin, an edit that mishandled the "holds rows" branch could ship green while it silently dropped a legacy aggregate full of baseline history the successor hasn't caught up to yet.

What changes

Test-only. Adds one live fact, NonEmptyLegacyAggregate_SuccessorShort_IsKept, alongside the existing empty-legacy facts in RetiredBaselineAggregateTests.cs. It seeds two rows into collect.wait_stats (one 40 days back, one 5 days back), leaves the legacy wait_stats_baseline aggregate unrefreshed so its real-time aggregation unions in both raw rows regardless of age, and refreshes the successor wait_stats_interval_baseline only from the 5-day-back hour forward — the same trick the file's existing end-to-end supersession fact uses to make a successor's own oldest bucket land after a horizon that the legacy still predates. It then runs the product's own judge and drop pass (TimescaleSupport.JudgeSupersededBaselineRelationAsync and DropRetiredBaselineAggregatesAsync), not the pure decision helper, and asserts the verdict is SuccessorShort, LegacyHoldsRows is true, nothing gets dropped, and the legacy relation still exists and still returns its rows afterward.

Test plan

  • EmptySupersededBaselineLiveTests (all 3 facts, including the new one): GREEN, 3/3, against a local TimescaleDB container.
  • Real mutation for proof: changed legacyHoldsRows = await probe.ExecuteScalarAsync(cancellationToken) is not false; to legacyHoldsRows = false; await probe.ExecuteScalarAsync(cancellationToken); at TimescaleSupport.cs (~1358). The new fact went RED:
    Assert.Equal() Failure: Values differ / Expected: SuccessorShort / Actual: Drop at the verdict-decision assertion.
    Reverted the line; rebuilt 0 errors; reran the class: back to GREEN, 3/3.
  • BaselineSupplyTests: GREEN, 23/23.
  • DocCommentHygieneTests: GREEN, 77/77.
  • Both test projects build 0 errors (Darling.Tests: 0 warnings/0 errors after the mutation revert; Lite.Tests untouched by this change — no Lite file was edited, so its build was not re-run for this change).
  • No CI-only or Windows-only assertion in this change; the new fact runs the same in-process path as its siblings.

CHANGELOG entry

SECTION: None
ENTRY: None: test-only change, adds a live pin with no product-code effect.

@erikdarlingdata
erikdarlingdata marked this pull request as ready for review September 26, 2026 19:17
@erikdarlingdata
erikdarlingdata merged commit e588c95 into dev Sep 26, 2026
15 of 16 checks passed
@erikdarlingdata
erikdarlingdata deleted the test/4292-nonempty-legacy-baseline-kept branch September 26, 2026 19:17
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.

1 participant