Skip to content

Report duration, ordering, and noise cleanup; skip version check in result conversion#1996

Merged
merill merged 4 commits into
mainfrom
codex/improve-test-run-performance
Jul 25, 2026
Merged

Report duration, ordering, and noise cleanup; skip version check in result conversion#1996
merill merged 4 commits into
mainfrom
codex/improve-test-run-performance

Conversation

@merill

@merill merill commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Make the existing -SkipVersionCheck switch also prevent ConvertTo-MtMaesterResult from querying PowerShell Gallery, which could add up to 10 seconds while building report metadata.
  • Add per-test Duration to the report's Excel table and copied TSV output, formatted with milliseconds.
  • Order the main report by severity (Critical → Info), then by outcome (Failed, Investigate, Error, Passed, then Skipped and NotRun), while preserving user-selected column sorting.
  • Hide NotRun tests by default in the report so tag-filtered tests do not crowd the view. They remain in the data and stay selectable in the status filter.
  • Add ./build/Build-LocalMaester.ps1 -BuildReport to build the React report, copy the generated template into the PowerShell assets, then build, validate, and import the local module.
  • Regenerate the embedded ReportTemplate.html and update local build documentation.

Invoke-Maester.ps1 changes by a single line in this PR (passing -SkipVersionCheck through).

Report noise

A graph-only run discovers 699 tests in the bundled tree, of which 283 are reported as NotRun — 270 AD-tagged, 13 Preview/LongRunning. That is roughly 40% of the results table filled with tests the user did not ask to run.

NotRun is now excluded from the report's default status selection. This:

  • matches the summary tile, which already subtracts NotRun from the adjusted total,
  • covers Preview and LongRunning as well, not just AD,
  • keeps the rows in the JSON and one click away in the status filter, so deep links to a NotRun test still work.

The status lists moved into report/src/lib/testStatus.ts so the table, the home page, and the summary tiles cannot drift. The tiles treat the default selection as their unfiltered state, so clicking a tile on a freshly loaded report still narrows to that status.

Behavior changes

  • Reports open with NotRun deselected. Selecting it in the status filter restores the previous view.
  • The default result ordering is by severity and outcome rather than by test ID.
  • Per-test Duration in the JSON output is now hh:mm:ss.fff instead of hh:mm:ss. Most tests finish in well under a second, so the new column previously read 00:00:00 on nearly every row. Run-level totals keep the coarser format.

Developer workflow

./build/Build-LocalMaester.ps1 -BuildReport

Validates that npm is available, runs the production report build, verifies report/dist/index.html, copies it to powershell/assets/ReportTemplate.html, then performs the existing module build, validation, and import.

Validation

  • Pester: 530 passed, 0 failed across powershell/tests/functions.
  • PSScriptAnalyzer clean on all modified PowerShell files; tsc -b clean.
  • Build-LocalMaester.ps1 -BuildReport completed, including the Vite production build, module validation, and local import.
  • Report verified against the dev fixture (19 NotRun of 317 tests): default view shows 298 rows with zero NotRun; clicking the Failed tile narrows to 70 Failed rows; Total tests resets to 298; NotRun still present in the status filter.
  • Default ordering verified directly: Critical/Failed → Critical/Passed → High → Medium → Low → unset.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Adds report-template embedding to local builds, propagates version-check skipping, increases test-duration precision, centralizes report status filters, adds default result sorting, and exposes duration in report tables and TSV exports.

Changes

Build report embedding

Layer / File(s) Summary
BuildReport switch implementation and documentation
build/Build-LocalMaester.ps1, build/Build-MaesterModule.md, README.md, website/docs/contributing.md
Adds -BuildReport to build and embed the report template, validates the generated HTML, and documents the updated local development workflow.

Result conversion updates

Layer / File(s) Summary
SkipVersionCheck and duration formatting
powershell/internal/ConvertTo-MtMaesterResult.ps1, powershell/public/Invoke-Maester.ps1, powershell/tests/functions/ConvertTo-MtMaesterResult.Tests.ps1
Propagates -SkipVersionCheck, bypasses latest-version lookup when enabled, formats test durations with milliseconds, and tests the bypass behavior.

Report result presentation

Layer / File(s) Summary
Shared report status selections
report/src/lib/testStatus.ts, report/src/pages/HomePage.tsx, report/src/components/MtTestSummary.jsx, report/src/components/TestResultsTable.jsx
Defines shared default and complete status lists and uses them across report filters and summary selections.
Default test-result sorting
report/src/lib/testSort.ts, report/src/components/TestResultsTable.jsx
Ranks results by severity and status, uses identifier/name tie-breaking, and applies the comparator before an explicit column sort is chosen.
Duration in report output
report/src/pages/ExcelPage.tsx
Adds test duration to the rendered results table and copied TSV output.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

Suggested labels: enhancement, maester-core, build

Suggested reviewers: mynster9361

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title matches the main changes: report ordering/noise cleanup and skipping the version check during result conversion.
Description check ✅ Passed The description is detailed and covers the main behavior, workflow, and validation changes, though it does not include the template's issue reference.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/improve-test-run-performance

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 25, 2026

Copy link
Copy Markdown

Deploying maester with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3ab4615
Status: ✅  Deploy successful!
Preview URL: https://22453802.maester.pages.dev
Branch Preview URL: https://codex-improve-test-run-perfo.maester.pages.dev

View logs

@merill
merill marked this pull request as ready for review July 25, 2026 09:13
@merill
merill requested review from a team as code owners July 25, 2026 09:13

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@powershell/public/Invoke-Maester.ps1`:
- Around line 319-335: Update the exclusion logic around $resolvedRunPaths so it
only targets canonical bundled Active Directory directories, not arbitrary
immediate “ad” children under caller-supplied roots. Handle a run path that
resolves directly to a bundled ad directory without constructing an ad/ad path,
and add coverage for both direct-directory and parent-root resolution cases.

In `@powershell/tests/functions/ActiveDirectoryOptIn.Tests.ps1`:
- Around line 98-102: Update the assertions in the unvalidated -Tag AD test
around Invoke-Maester to expect zero results, including result.TotalCount, while
preserving the marker and excluded-script assertions.

In `@report/src/lib/testSort.ts`:
- Around line 8-14: Update the severityOrder map so Critical ranks before High,
Medium, and Low, matching the table’s Critical, High, Medium, Low, Info ordering
while preserving the existing severity keys.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e7ad5d2a-eacf-4369-af18-7dfc1390505d

📥 Commits

Reviewing files that changed from the base of the PR and between 46c9bf6 and 7d12e54.

📒 Files selected for processing (12)
  • README.md
  • build/Build-LocalMaester.ps1
  • build/Build-MaesterModule.md
  • powershell/assets/ReportTemplate.html
  • powershell/internal/ConvertTo-MtMaesterResult.ps1
  • powershell/public/Invoke-Maester.ps1
  • powershell/tests/functions/ActiveDirectoryOptIn.Tests.ps1
  • powershell/tests/functions/ConvertTo-MtMaesterResult.Tests.ps1
  • report/src/components/TestResultsTable.jsx
  • report/src/lib/testSort.ts
  • report/src/pages/ExcelPage.tsx
  • website/docs/contributing.md

Comment thread powershell/public/Invoke-Maester.ps1 Outdated
Comment thread powershell/tests/functions/ActiveDirectoryOptIn.Tests.ps1 Outdated
Comment thread report/src/lib/testSort.ts
merill and others added 3 commits July 25, 2026 19:24
Resolves conflict in ConvertTo-MtMaesterResult.Tests.ps1 by keeping both
the version-check skip test from this branch and the malformed-name
warning tests from main (#1990). All 4 tests pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Rank Critical ahead of High in the report's default test ordering. It
previously sorted below Low, which pushed the most severe findings down
the default view.

Scope the Active Directory path exclusion to directories where every
test is AD-tagged, so unrelated tests in a folder named "ad" still run.
Also handle a run path that is the "ad" directory itself, and back off
to tag-only filtering when excluding the directory would leave Pester
with no test files (Pester throws in that case).

Format per-test Duration with milliseconds. Most tests finish in well
under a second, so the new report column read 00:00:00 on nearly every
row. Run-level totals keep the coarser format.

Regenerate the embedded report template.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The Run.ExcludePath machinery saved ~237ms of Pester discovery on the real
bundled test tree (513ms -> 276ms across 506 test files), not the 47% the
synthetic 270-AD-test fixture suggested. That is well under 1% of a run
against a live tenant, and it is all Pester-specific code that 3.0 removes.

It also made AD the only tag that disappears from discovery. Every other
filtered tag still reports as NotRun, and #1990 deliberately invested in
rendering those rows well, so the exclusion cut against the current design.

The real benefit was report noise: 270 of 699 tests were AD NotRun rows.
Address that in the report instead by dropping NotRun from the default
status selection. Rows stay in the data and remain selectable in the status
filter, this hides filtered Preview and LongRunning tests too, and it
matches the summary tile, which already subtracts NotRun from the total.

Share the status lists through report/src/lib/testStatus.ts. The summary
tiles treat the default selection as their unfiltered state, so clicking a
tile on a freshly loaded report still narrows to that status.

Keeps the rest of the PR: -SkipVersionCheck reaching ConvertTo-MtMaesterResult,
the Duration column, the default severity and status ordering, and
Build-LocalMaester.ps1 -BuildReport.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@merill merill changed the title Improve graph-only test performance and report diagnostics Report duration, ordering, and noise cleanup; skip version check in result conversion Jul 25, 2026

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@report/src/components/MtTestSummary.jsx`:
- Line 11: Update the status comparisons in MtTestSummary, including the
current-selection check and isActive calculation, to use set equality against
allStatuses rather than comparing only array lengths. Ensure selections with the
same size but different statuses are not treated as the default view or as an
active Total tests tile.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 6850a024-a153-48ee-939f-8e7128e53e7e

📥 Commits

Reviewing files that changed from the base of the PR and between 59e5809 and 3ab4615.

📒 Files selected for processing (6)
  • powershell/assets/ReportTemplate.html
  • powershell/public/Invoke-Maester.ps1
  • report/src/components/MtTestSummary.jsx
  • report/src/components/TestResultsTable.jsx
  • report/src/lib/testStatus.ts
  • report/src/pages/HomePage.tsx
💤 Files with no reviewable changes (1)
  • powershell/public/Invoke-Maester.ps1
🚧 Files skipped from review as they are similar to previous changes (1)
  • report/src/components/TestResultsTable.jsx

Comment thread report/src/components/MtTestSummary.jsx
@merill
merill merged commit f2bc797 into main Jul 25, 2026
13 of 15 checks passed
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