Skip to content

test(j1939): witness actor disposal without elapsed margins - #472

Merged
dborgards merged 1 commit into
mainfrom
fix/j1939-dispose-witnesses-362
Oct 26, 2026
Merged

dborgards merged 1 commit into
mainfrom
fix/j1939-dispose-witnesses-362

Conversation

@dborgards

Copy link
Copy Markdown
Owner

What does this change?

Refs #362 and its remaining timing inventory in comment 6357888413. Two J1939 disposal tests compared elapsed time against 1.5 seconds to distinguish a non-waiting actor call from a two-second join. Host scheduling could consume that margin.

The periodic-schedule case now keeps its emission blocked until the actor disposal call returns. An internal join-timeout seam retains the two-second production default; this test sets it to ten minutes so a mistaken self-join cannot finish within its hang guard. The actor DisposeAsync case inspects the returned ValueTask while still inside the actor turn: it must already be complete because the actual teardown is queued behind that turn. The test then awaits the real teardown from outside the actor.

Two restored source mutations fail at runtime: allowing the schedule to join its emission on the actor, and making actor DisposeAsync return the unfinished teardown task. No public API or default disposal behavior changes. #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. The final Cobertura report was inspected across all classes and nested types: both changed executable entries are covered, with no missing lines or partial branches.

@cursor

cursor Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Test-only hardening plus an internal timeout seam; production disposal behavior and public API are unchanged.

Overview
Replaces elapsed-time assertions (~1.5 s margins) in two J1939 disposal tests with behavioral witnesses, addressing flaky timing under host scheduling (#362).

Adds an internal PeriodicEmissionJoinTimeout seam (production default still 2 s) and wires periodic schedule disposal to use it instead of a hardcoded wait. The periodic-dispose-from-actor test sets that timeout to ten minutes so a mistaken self-join cannot complete within the test hang guard; it keeps the emission blocked on the bus until the actor Dispose returns, then asserts the release never fired early.

The in-actor DisposeAsync test now requires the returned ValueTask to already be completed while still on the actor turn (teardown is queued behind that callback), then completes disposal from outside the actor—no stopwatch comparison.

Reviewed by Cursor Bugbot for commit d77d4e2. 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-26T22:13:21.188769Z d77d4e2 PR opened
ℹ️ 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!

@dborgards
dborgards merged commit 5eaa9c7 into main Oct 26, 2026
16 checks passed
@dborgards
dborgards deleted the fix/j1939-dispose-witnesses-362 branch October 26, 2026 22:37
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