Skip to content

Address review feedback on #9047 (GetRunningTasks buffer reuse)#9056

Merged
Evangelink merged 1 commit into
mainfrom
dev/amauryleve/9047-followup-buffer-doc-and-test
Jun 12, 2026
Merged

Address review feedback on #9047 (GetRunningTasks buffer reuse)#9056
Evangelink merged 1 commit into
mainfrom
dev/amauryleve/9047-followup-buffer-doc-and-test

Conversation

@Evangelink

Copy link
Copy Markdown
Member

Follow-up to #9047 (already merged) addressing review feedback that arrived on the merged PR:

  • Documentation: Clarify the <remarks> on GetRunningTasks so the contract reflects the actual invariant — the hazard is calling it again on the same instance before consuming the prior buffer (buffers from different instances are independent and may be held concurrently). Also note that the production caller (AnsiTerminalTestProgressFrame) is single-threaded, addressing the thread-safety concern raised by copilot-pull-request-reviewer.
  • Test assertion: Replace Assert.Contains("3", tasks[2].Text) with an exact-text assertion that matches the maxCount=1 test's pattern. The previous loose substring match could pass for unrelated reasons if the resource format ever changes (any '3' anywhere in a localized string).
  • Resource accessor: Expose ActiveTestsRunning_MoreTestsCount to the unit-test project via the IS_MTP_UNIT_TESTS block in PlatformResources.cs (hand-maintained accessor).

No behavior change — pure docs + test tightening + a hand-maintained resource accessor.

- Clarify <remarks> contract: the hazard is calling GetRunningTasks
  again on the *same* instance before consuming the previously-returned
  buffer; buffers from different instances are independent. Also notes
  that the production caller is single-threaded (render loop), so
  copilot-pull-request-reviewer's thread-safety concerns do not apply.
- Replace brittle `Assert.Contains("3", ...)` with exact-text
  assertion matching the maxCount=1 test's pattern, so the assertion
  cannot accidentally pass for unrelated digits in a formatted/
  localized string.
- Expose ActiveTestsRunning_MoreTestsCount to the unit-test project
  via the IS_MTP_UNIT_TESTS block in PlatformResources.cs (the
  resource accessor is hand-maintained).
Copilot AI review requested due to automatic review settings June 11, 2026 20:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR is a follow-up to #9047 that aligns the GetRunningTasks contract documentation with the actual buffer-reuse invariant, tightens a unit test assertion to avoid false positives, and exposes an additional resource accessor for unit tests.

Changes:

  • Updated TestNodeResultsState.GetRunningTasks XML remarks to clarify same-instance buffer reuse and the single-threaded production call pattern.
  • Strengthened TestNodeResultsState_GetRunningTasks_WhenMoreThanMax_TruncatesAndAppendsSummary to assert the exact localized summary text (instead of a substring match).
  • Added an IS_MTP_UNIT_TESTS resource accessor for ActiveTestsRunning_MoreTestsCount in PlatformResources.cs.
Show a summary per file
File Description
test/UnitTests/Microsoft.Testing.Platform.UnitTests/OutputDevice/Terminal/TerminalTestReporterTests.cs Tightens the truncation summary assertion to match the production formatting and avoid brittle substring matching.
src/Platform/Microsoft.Testing.Platform/Resources/PlatformResources.cs Exposes ActiveTestsRunning_MoreTestsCount under IS_MTP_UNIT_TESTS so unit tests can format the summary string using the real localized resource.
src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/TestNodeResultsState.cs Clarifies the GetRunningTasks buffer reuse contract and thread-safety expectations in XML documentation.

Copilot's findings

  • Files reviewed: 3/3 changed files
  • Comments generated: 0

@Evangelink

Copy link
Copy Markdown
Member Author

🧪 Test quality grade — PR #9056

1 test method graded across 1 file. The PR upgrades a loose substring assertion (Assert.Contains("3", ...)) to an exact formatted-string equality check, strengthening the test's ability to catch regressions in the summary format. Grade: A. No issues found.

ΔTestGradeBandNotes
mod TerminalTestReporterTests.
TestNodeResultsState_
GetRunningTasks_
WhenMoreThanMax_
TruncatesAndAppendsSummary
A 90–100 Four exact equality assertions (count + two task texts + formatted summary); clear AAA; no anti-patterns.

This advisory comment was generated automatically. Grades are heuristic
and informational — they do not block merging. Re-run with
/grade-tests.

🤖 Automated content by GitHub Copilot. Posted via a maintainer's GitHub token, so it appears under their account — the account owner did not write or approve this content personally. Generated by the Grade Tests on PR (on open / sync) workflow. · 481 AIC · ⌖ 13.6 AIC · [◷]( · )

@Evangelink Evangelink merged commit e8bbe70 into main Jun 12, 2026
36 checks passed
@Evangelink Evangelink deleted the dev/amauryleve/9047-followup-buffer-doc-and-test branch June 12, 2026 09:53
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