Skip to content

refactor(node): delegate scheduler correlation check to the canonical predicate - #2846

Merged
trunk-io[bot] merged 1 commit into
mainfrom
claude/dreamy-bardeen-90d0pc-scheduler-correlation-dedup
Jul 28, 2026
Merged

refactor(node): delegate scheduler correlation check to the canonical predicate#2846
trunk-io[bot] merged 1 commit into
mainfrom
claude/dreamy-bardeen-90d0pc-scheduler-correlation-dedup

Conversation

@phil-opp

Copy link
Copy Markdown
Collaborator

Issue

The event-stream scheduler's is_correlated inlined the same three-key check (request_id / goal_id / goal_status) that dora_message already exposes as carries_pattern_correlation. That canonical function's own doc explicitly asks callers to keep it the single definition, so the send-side, node-receive-side, and daemon-debug layers can never disagree on what "pattern-correlated" means.

The scheduler is the one place that had drifted into a private copy. The two are identical today, so there is no active bug — but if a fourth correlation key were ever added to carries_pattern_correlation, the scheduler would keep treating those messages as non-correlated and could evict them under queue pressure, silently breaking the service/action request-response contract this eviction logic exists to protect (dora-rs/adora#145).

Fix

Delegate is_correlated to carries_pattern_correlation and drop the duplicated key list. REQUEST_ID/GOAL_ID/GOAL_STATUS remain imported for the per-key structured fields in log_correlation_drop.

Validation

  • cargo test -p dora-node-api passes, including the existing scheduler eviction tests.
  • cargo clippy ... -D warnings and cargo fmt --all --check pass.

⚠️ This PR is machine-generated by Claude (Claude Code), an AI assistant. Please review carefully before merging.

🤖 Generated with Claude Code

https://claude.ai/code/session_01D2eu6P1CvTvoKdK9fK3ZSd


Generated by Claude Code

… predicate

The event-stream scheduler's `is_correlated` inlined the same three-key
check (`request_id` / `goal_id` / `goal_status`) that `dora_message`
already exposes as `carries_pattern_correlation`. That canonical function's
own doc asks callers to keep it the single definition so the send-side,
node-receive-side, and daemon-debug layers can never disagree on what
"pattern-correlated" means.

The scheduler is the one place that had drifted into a private copy. Today
the two are identical, so there is no active bug — but if a fourth
correlation key were ever added to `carries_pattern_correlation`, the
scheduler would keep treating those messages as non-correlated and could
evict them under queue pressure, silently breaking the service/action
request-response contract this code exists to protect (dora-rs/adora#145).

Delegate to `carries_pattern_correlation` and drop the duplicated key list.
`REQUEST_ID`/`GOAL_ID`/`GOAL_STATUS` remain imported for the per-key log
message in `log_correlation_drop`.

Validation: `cargo test -p dora-node-api` (existing scheduler eviction
tests), `cargo clippy`, and `cargo fmt --check` pass.

This change was generated by Claude (Claude Code), an AI assistant. It is
machine-generated and should be reviewed carefully before merging.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01D2eu6P1CvTvoKdK9fK3ZSd
@trunk-io

trunk-io Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

😎 Merged successfully - details.

Copy link
Copy Markdown
Collaborator Author

🤖 Fully automated review by Claude — this review was generated end-to-end by an automated agent with no human vetting. Treat it accordingly.

No issues found. carries_pattern_correlation has the exact same three-key body (REQUEST_ID / GOAL_ID / GOAL_STATUS) that was inlined, so this is behavior-preserving, and the REQUEST_ID/GOAL_ID/GOAL_STATUS imports are still used by log_correlation_drop, so the change compiles cleanly with no unused imports. Delegating to the single canonical predicate is a reasonable way to keep the scheduler's eviction guard from drifting from the send/receive/daemon layers.


Generated by Claude Code

@phil-opp
phil-opp marked this pull request as ready for review July 28, 2026 10:42
@trunk-io
trunk-io Bot merged commit cf57c0b into main Jul 28, 2026
27 checks passed
@trunk-io
trunk-io Bot deleted the claude/dreamy-bardeen-90d0pc-scheduler-correlation-dedup branch July 28, 2026 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants