Skip to content

Complete IconCheckbox JS interop in ManageDataDialog tests - #21434

Merged
Mitch Denny (mitchdenny) merged 1 commit into
mainfrom
agent/fix-managedatadialog-iconcheckbox-jsinterop
Nov 5, 2026
Merged

Mitch Denny (mitchdenny) merged 1 commit into
mainfrom
agent/fix-managedatadialog-iconcheckbox-jsinterop

Conversation

@davidfowl

Copy link
Copy Markdown
Collaborator

Description

Fixes a timing-dependent failure in ManageDataDialogTests.Render_ClearedSignals_PrunesSelectionsAndSupportsRemovingEmptyResource (#20759).

Root cause. SetupIconCheckboxJs() registered the IconCheckbox.razor.js handlers with SetupVoid(...) but never configured a result. In bUnit 2.x, an unconfigured invocation stays pending and is faulted with JSRuntimeInvocationNotSetException once BunitContext.DefaultWaitTimeout (10s in DashboardTestContext) elapses. Each IconCheckbox awaits initializeIconCheckboxKeyboard in OnAfterRenderAsync, so the fault becomes an unhandled renderer exception. The next WaitForAssertion that has to wait then rethrows it. Any ManageDataDialog test still running 10s after its first checkbox rendered therefore fails. That happens on a slow runner: the failing CI run took 20.9s (job 112149721345), and its stack goes through IconCheckbox.OnAfterRenderAsync → WaitForAssertion. Locally the whole class takes about 4s, which is why it usually passes.

Fix. Call .SetVoidResult() on both IconCheckbox handlers, matching every other module setup in this project (for example TerminalSetupHelpers). This only changes test setup; no assertions changed.

Regression test. IconCheckbox_CompletesKeyboardInitializationAndCleansUpOnDispose renders an IconCheckbox, disposes it, and asserts disposeIconCheckboxKeyboard was invoked. IconCheckbox only runs cleanup after initialization completed, so the test fails immediately without the fix and needs no waiting.

Validation (Linux, native):

Without fix With fix
New regression test fails in 7ms (Assert.Contains() Failure: Filter not matched) passes
Render_ClearedSignals_* (both cases) with a temporary, uncommitted 11s pause after the first render to simulate a slow runner 2/2 fail with JSRuntimeInvocationNotSetException ... initializeIconCheckboxKeyboard, matching CI 2/2 pass
Full Aspire.Dashboard.Components.Tests suite — 1162/1162 pass

Fixes #20759

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No

🤖 Posted by AspireAgent (AI Agent)

The IconCheckbox module handlers were set up without a result, so each
initializeIconCheckboxKeyboard invocation stayed pending until bUnit faulted
it with JSRuntimeInvocationNotSetException after DefaultWaitTimeout (10s).
That fault surfaced as an unhandled renderer exception in any
ManageDataDialog test still waiting more than 10s after a checkbox first
rendered, which slow Windows runners hit.

Configure both handlers with SetVoidResult and add a regression test that
verifies keyboard initialization completes (cleanup only runs after it does).

Fixes #20759

Co-authored-by: Copilot <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 21434

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 21434"

@github-actions

Copy link
Copy Markdown
Contributor

Tests selector

1 / 100 PR test projects · 0 PR jobs, from 1 changed file.

Selected PR test projects (1 / 100)

Aspire.Dashboard.Components.Tests

Selected PR jobs (0)

none


How these were chosen — grouped by what changed

🧪 tests/Aspire.Dashboard.Components.Tests/Dialogs/ManageDataDialogTests.cs (changed test)
→ 1 directly: Aspire.Dashboard.Components.Tests

Job reasons

none


Selection computed for commit 6d8ddbc.

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.

🟢 Approval recommended

No active review issues block this test-only fix for pending IconCheckbox interop calls.

No open issues 🎉

What changed in this PR

Fixes the timing-dependent ManageDataDialog test failure tracked in #20759 by completing mocked IconCheckbox JavaScript calls. Production code is unchanged.

Changes:

  • Adds .SetVoidResult() to the initialization and disposal handlers so calls no longer remain pending.
  • Adds a regression test that renders and disposes an IconCheckbox, then verifies cleanup was invoked.
File Description
tests/​Aspire.Dashboard.Components.Tests/​Dialogs/​ManageDataDialogTests.cs Completes IconCheckbox interop mocks and adds initialization/disposal regression coverage.

Review effort: Balanced

@mitchdenny
Mitch Denny (mitchdenny) merged commit 079169b into main Nov 5, 2026
59 checks passed
@microsoft-github-policy-service microsoft-github-policy-service Bot added this to the 17.0 milestone Nov 5, 2026
@aspire-repo-bot

Copy link
Copy Markdown
Contributor

✅ No documentation update needed.

docs_optional → test_only. No signals triggered (signal_count == 0). The only changed file, tests/Aspire.Dashboard.Components.Tests/Dialogs/ManageDataDialogTests.cs, matches tests/**.

Ankit Jain (radical) pushed a commit that referenced this pull request Nov 10, 2026
…ts (#21503)

## Description

Fixes an intermittent Dashboard.Components flake:
`EmptyState_HelpDisappearsAfterAnySignalAndStaysHiddenAfterClear`
(StructuredLogs/Traces), plus TraceDetails tests, fail with
`Bunit.JSRuntimeInvocationNotSetException` on slow runners (mostly
Windows).

### Root cause

In bUnit 2.x, a planned JS handler without a result leaves the
invocation pending. After `BunitContext.DefaultWaitTimeout` (10s, set in
`DashboardPageTestContext`), bUnit faults the invocation. That fault
surfaces from the component's `OnAfterRenderAsync` and is rethrown by
the next `WaitForAssertion`. So any test still running 10s after the
first render fails.

Two kinds of handlers were left without a result:

- **`focusElement`**: `StructuredLogsTests`, `TracesTests` and
`TraceDetailsTests` each call `JSInterop.SetupVoid("focusElement", _ =>
true)` without a result. They do this after `SetupFluentMenu` registered
a resolved handler. The last registration wins, so the resolved handler
is overridden. Each page awaits `focusElement(<scrollContainer>, true)`
on first render.
- **Tooltip**: `AddCommonDashboardServices` registers the Tooltip
module's `FluentTooltipInitialize` without a result.

This is the same bug class #21412 fixed for `Select.Initialize` and
`observeAttributeChange`, and #21434 fixes in `ManageDataDialogTests`.
This PR doesn't touch those files.

### Fix

Add `.SetVoidResult()` to the four handlers above. Also complete the
other shared void stubs these pages exercise: the three handlers in
`SetupFluentAnchoredRegion` (`goToNextFocusableElement`,
`initializeKeyboardNavigation`, `removeKeyboardNavigation`) and the two
in `SetupFluentOverflow` (`fluentOverflowInitialize`,
`fluentOverflowDispose`). Test-only change.

### CI evidence (attempt-1 failures, `ci.yml`, about Oct 16–31)

Survey: 1000 `ci.yml` runs (466 with Dashboard jobs).
Dashboard.Components had 10 attempt-1 failures in 181 Windows jobs and 1
in 181 Ubuntu jobs. These 3 jobs failed on pending calls this PR fixes:

| Run / job | Head | Failing tests | Pending invocation |
|---|---|---|---|
| main push
[40534267321](https://github.com/microsoft/aspire/actions/runs/40534267321/job/122317031694)
(Windows) | b1b850f | StructuredLogsTests.EmptyState… (and
MetricsTests.EmptyState… on `Select.Initialize`, fixed since by #21412)
| `focusElement("structuredLogsScrollContainer", true)` |
| PR
[40563038552](https://github.com/microsoft/aspire/actions/runs/40563038552/job/122398561156)
(Windows) and [job
122398564683](https://github.com/microsoft/aspire/actions/runs/40563038552/job/122398564683)
(Ubuntu) | f1cc41e | TraceDetailsTests.ExpandAllSpans…,
Render_TraceUpdateWithNewSpans…, ToggleCollapse… |
`focusElement("traceDetailScrollContainer", true)`,
`FluentTooltipInitialize` (plus handlers since fixed on main) |

A fourth job, PR run
[40390542875](https://github.com/microsoft/aspire/actions/runs/40390542875/job/121814090794)
(StructuredLogsTests.EmptyState… on Windows), faulted on
`observeAttributeChange`, which #21412 has since fixed. On the same head
the Ubuntu job passed. Locally, the 9 EmptyState cases passed 15/15
loops on main because they finish well under 10s. The other 6 Components
failures were the MetricsTests histogram test (tracked separately in
#21394).

### Before/after

**Slow-runner simulation (not committed).** Added `await
Task.Delay(11s)` before the final `WaitForAssertion` in the
StructuredLogs/Traces EmptyState tests:

| | EmptyState (9 cases) | Failure |
|---|---|---|
| main | **6 failed** / 9 | `JSRuntimeInvocationNotSetException`:
`focusElement("structuredLogsScrollContainer"/"tracesScrollContainer",
true)` ×5, `FluentTooltipInitialize` ×1 |
| this PR | **9 passed** / 9 | n/a |

No new tests are added. The existing render tests for these pages
already cover the first-render calls.

### Validation

- `Aspire.Dashboard.Components.Tests` full suite: 1161 passed, 0 failed.

## Checklist
- Is this feature complete?
  - [x] Yes. Ready to ship.
- Are you including unit tests for the changes and scenario tests if
relevant?
  - [x] No. Test-only fix; existing render tests cover it.
- Did you add public API?
  - [x] No
- Does the change make any security assumptions or guarantees?
  - [x] No
- Does the change require an update in our Aspire docs?
  - [x] No

**🤖 Posted by AspireAgent (AI Agent)**

---------

Co-authored-by: davidfowl <[email protected]>
Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI Failure] Flaky: ManageDataDialogTests(dashboardClientIsReadOnly: True) bUnit JSInterop hang on IconCheckbox.initializeIconCheckboxKeyboard call

4 participants