Skip to content

test: make three timing-dependent tests deterministic - #982

Merged
polewskm merged 10 commits into
mainfrom
worktree-issue-981
Nov 30, 2026
Merged

polewskm merged 10 commits into
mainfrom
worktree-issue-981

Conversation

@polewskm

@polewskm polewskm commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Makes three timing-dependent tests deterministic, and applies the same fixes to their sibling tests:

  • DefaultOpenIdTeamCacheTests: every team that an eviction or expiry releases for the last time has its DisposeAsyncCore set up and awaited. The creators release their own references first, so the cache's background eviction always ends the last one. Each wait uses one DisposalTimeout.
  • TeamSettingsReconciliationServiceTests: the retry-at-deadline test starts its FakeTimeProvider at a fixed instant. The clock moves from inside the reconciler call on the service's own loop, never from the test thread, so the service never arms a timer from a stale clock read.
  • DirectoryOutboxPublisherTests, DirectoryChangeFeedServiceTests, DirectoryReplicaHealthTests: every DirectoryMetrics comes from the IMeterFactory of the test's own AddMetrics() provider. The published-counter test collects with a MetricCollector scoped to that factory, never with a process-wide MeterListener.
  • DirectoryMetricsTests pins the directory metrics' meter, instrument and attribute names and their units as literals.
  • csharp-testing.instructions.md records the three lessons.

Each changed suite passed five runs in a row.

Protected paths changed:
.github/instructions/csharp-testing.instructions.md

Closes #981

@polewskm polewskm self-assigned this Nov 30, 2026
@polewskm
polewskm marked this pull request as ready for review November 30, 2026 22:36
@polewskm
polewskm deployed to code-review November 30, 2026 22:36 — with GitHub Actions Active

@ncode-review ncode-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 NCode Review at e92fd15: 4 new findings on the changed lines.

@ncode-review

ncode-review Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Superseded by the review at cfdd354.

@codecov

codecov Bot commented Nov 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff             @@
##             main     #982       +/-   ##
===========================================
- Coverage   96.20%   65.60%   -30.61%     
===========================================
  Files        2437     1529      -908     
  Lines      114032    57989    -56043     
  Branches      196     1753     +1557     
===========================================
- Hits       109709    38044    -71665     
- Misses       4323    19945    +15622     
Flag Coverage Δ
dotnet 62.27% <ø> (-33.79%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

📢 Thoughts on this report? Let us know!

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@polewskm

Copy link
Copy Markdown
Contributor Author

/review

@ncode-review-approver ncode-review-approver Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at cfdd354: no blocker or should-fix finding remains.

@ncode-review

ncode-review Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

🤖 Review complete

Verdict: ✅ Approve — Re-review of what changed since the last review at e92fd15: 23 hunks in 6 files and changes taken back in 5 files, by correctness only. Earlier findings: F1 fixed, F2 fixed, F3 fixed, F4 fixed. No further findings above nits.

Approval: Approved — no blocker or should-fix finding remains.

1 reviewer run — 0 findings (run details)

Reviewer Model Findings Top
correctness sonnet-5-5 0 🟢

Trial: findings are posted as review threads and in the check run. $0.08 on Amazon Bedrock, 12s, at cfdd354. (how to interact)

📋 Outcomes

Merged at cfdd354: 4 fixed, 0 dismissed, 0 acknowledged, 0 ignored.

Finding Reviewer Severity Outcome
F1 rule-check 🟡 Nit ✅ fixed
F2 conventions, rule-check 🟡 Nit ✅ fixed
F3 rule-check 🟡 Nit ✅ fixed
F4 hygiene 🟡 Nit ✅ fixed

@polewskm
polewskm enabled auto-merge November 30, 2026 22:55
@polewskm
polewskm added this pull request to the merge queue Nov 30, 2026
@polewskm

Copy link
Copy Markdown
Contributor Author

Autopilot: this pull request is ready to merge as far as this run can tell.

  • One round of review feedback: NCode Review's four findings at e92fd15 (F1 to F4, all nits) held, and each is fixed in steps 6 to 9 (9db81c6, 90cbefe, 7af5d34, cfdd354). NCode Review's review at cfdd354 confirms all four fixed, raises nothing above a nit, and its approver approved that head.
  • Every check on cfdd354 passes. "Lint and render the host chart" failed once while downloading kubeconform from its GitHub release (curl HTTP 618), a step this pull request doesn't touch; its re-run passed.
  • Nothing was left as a follow-up or for Marcin, and no review thread is unresolved.
  • Protected paths changed: .github/instructions/csharp-testing.instructions.md (the three lessons, and the F4 wording).

After it merges, run /finish-plan issue-981.

Merged via the queue into main with commit 766d1bb Nov 30, 2026
25 of 26 checks passed
@polewskm
polewskm deleted the worktree-issue-981 branch November 30, 2026 23:16
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.

Make three timing-dependent tests deterministic

1 participant