Skip to content

test(canopen): witness queued events before disposal - #470

Merged
dborgards merged 2 commits into
mainfrom
fix/canopen-dispose-queue-362
Oct 26, 2026
Merged

dborgards merged 2 commits into
mainfrom
fix/canopen-dispose-queue-362

Conversation

@dborgards

Copy link
Copy Markdown
Owner

What does this change?

Refs #362 and its remaining timing inventory in comment 6357888413. Two CANopen disposal tests assumed that a second heartbeat was queued after 300 ms. They now block the first subscriber explicitly, wait until the second event is actually queued, and release the subscriber only after that observation. Assertions wait for the event pump to terminate through an internal test seam, replacing the final negative delay as well. Cleanup releases the subscriber even when an assertion fails.

The outside-disposal case still exercises the real pump join timeout: its subscriber remains blocked until Dispose returns. Two restored source mutations fail at runtime: delivering queued events after stop, and retaining the stopped queue. The test-only completion accessor changes no public API or disposal behavior. #362 remains open for its other timing windows.

Type of change

  • feat — new behaviour (minor release)
  • fix / perf — bug or performance fix (patch release)
  • docs / test / refactor / chore / ci — no release
  • Breaking change

Checklist

Validation: 3,035 net10 tests; net48 compilation; nine verified packages; 50 engineering tests; requirements traceability. Cobertura inspected across every class/nested type: the changed executable entry is covered with no missing line or partial branch.

@cursor

cursor Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Test-only changes plus an internal test accessor; production CANopen disposal and event pump behavior are unchanged.

Overview
Hardens two CANopen disposal tests that assert queued heartbeats are dropped when the node is disposed, replacing fixed 300 ms sleeps with deterministic synchronization.

Both scenarios now block the first HeartbeatReceived handler on a ManualResetEventSlim, send the second frame only after the first handler has run, and WaitForQueuedEventAsync polls QueuedEventCount until the second event is actually queued. Assertions await EventPumpCompletionForTests (new internal seam on CanOpenNode exposing _eventPumpTask) instead of sleeping after dispose. try/finally always releases the blocked subscriber so failures do not hang the suite.

No public API or runtime disposal behavior changes—only test infrastructure and timing reliability for #362.

Reviewed by Cursor Bugbot for commit 6a95535. Bugbot is set up for automated code reviews on this repo. Configure here.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T21:10:27.471993Z 6a95535 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@codecov

codecov Bot commented Oct 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Owner Author

@codex review

Please review updated head 6a95535. It replaces the manual finally-disposal reported by CodeQL 756/757 with explicit using scopes while retaining subscriber-release → node-disposal → pump-join ordering. All local gates were repeated successfully.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 6a95535d3e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@dborgards
dborgards merged commit c63b527 into main Oct 26, 2026
16 checks passed
@dborgards
dborgards deleted the fix/canopen-dispose-queue-362 branch October 26, 2026 21:36
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.

2 participants