Skip to content

refactor(data-plane): drop the counter-delta branch a selected program never takes - #784

Merged
zzylol merged 1 commit into
mainfrom
refactor/drop-dead-counter-delta
Sep 28, 2026
Merged

zzylol merged 1 commit into
mainfrom
refactor/drop-dead-counter-delta

Conversation

@zzylol

@zzylol zzylol commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

RawDagProgram::uses_counter_delta returned a constant false:

pub fn uses_counter_delta(&self) -> bool {
    // Planner represents rate computation as an explicit upstream operator.
    false
}

Three call sites still branched on it, so the counter-delta side was unreachable whenever a program was present.

Site Before After
worker.rs:549 program.map_or_else(legacy_rule, |p| p.uses_counter_delta()) legacy_counter_delta(state) — the legacy rule only applies with no program
worker.rs:609 same same
window_builder.rs:172 if program.uses_counter_delta() { reset_aware_counter_delta(...) } else { Some(value) } applied directly; program is a required parameter there, so the branch was dead outright

The previous map in window_builder.rs existed only to feed reset_aware_counter_delta and goes with it.

Behaviour

Unchanged. Every removed path was already unreachable, which is why this is a deletion rather than a rewrite.

cargo test -p data_plane --lib 934 passed, cargo test -p control_plane --lib 433 passed, cargo fmt --check and cargo clippy --all-targets with -D warnings clean.

Context

Found while checking, after #774, which backend abstractions the shared asap-physical-operators crate had made redundant. RawDagProgram itself is not redundant: it already delegates accumulation to asap_physical_operators::factory, and what remains is the backend's own binding glue. This constant method was the one genuinely dead piece.

🤖 Generated with Claude Code

…m never takes

RawDagProgram::uses_counter_delta returned a constant `false`, with a comment
explaining why: Planner represents rate as an explicit upstream operator, so a
sample reaches the accumulator unchanged. Three call sites still branched on
it, and the counter-delta side of each was unreachable whenever a program was
present.

In worker.rs the two sites asked the program and were always told no, so the
condition is just the legacy configured update rule, which only applies when
there is no program. Name that: `legacy_counter_delta`.

In window_builder.rs the program is a required parameter, so the branch was
dead outright. Its `previous` map existed only to feed
`reset_aware_counter_delta` and goes with it; each sample is now applied as it
arrives.

Behaviour is unchanged: every removed path was already unreachable.
`cargo test -p data_plane --lib` 934 passed, `-p control_plane --lib` 433
passed, clippy with `-D warnings` clean.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@zzylol
zzylol merged commit a00c3fb into main Sep 28, 2026
1 check passed
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