Skip to content

[Repo Assist] test(shared): add 45 unit tests for MenuDisplayHelper and MenuSizingHelper#522

Merged
shanselman merged 1 commit into
masterfrom
repo-assist/improve-menuhelpers-tests-2026-05-23-64c69b4d0fa2bef3
May 23, 2026
Merged

[Repo Assist] test(shared): add 45 unit tests for MenuDisplayHelper and MenuSizingHelper#522
shanselman merged 1 commit into
masterfrom
repo-assist/improve-menuhelpers-tests-2026-05-23-64c69b4d0fa2bef3

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

Summary

MenuDisplayHelper and MenuSizingHelper are pure static helpers in OpenClaw.Shared with zero unit-test coverage. This PR adds 45 tests across both classes.

MenuDisplayHelper (21 tests)

  • GetStatusIcon — Connected / Connecting / Error / unknown enum value
  • GetChannelStatusIcon — healthy, intermediate, null, empty, and unknown status strings
  • TruncateText — short, null, whitespace-only, exact-max-length, over-max-length, and custom maxLength
  • FormatProviderSummary — singular vs plural
  • GetNextToggleValueon/ON/Onoff; everything else → on

MenuSizingHelper (24 tests)

  • ConvertPixelsToViewUnits — 96 dpi, 192 dpi, zero/negative pixels, zero-dpi fallback, minimum-1 clamp
  • HasDpiOrScaleChanged — identical, DPI change, scale change, sub-tolerance scale delta, zero-DPI normalisation, NaN/0 scale normalisation
  • CalculateWindowHeight — content fits, content exceeds work area, zero/negative content, zero work area, work area smaller than minimum, custom minimum height

Test Status

  • dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj45 new tests pass ✅
  • Total suite: 1928 passed, 29 skipped, 8 pre-existing failures (Windows-path tests that fail on Linux runners — not related to this change)

Generated by 🌈 Repo Assist, see workflow run. Learn more.

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@97143ac59cb3a13ef2a77581f929f06719c7402a

…elper

Both classes had zero test coverage. These tests cover:

MenuDisplayHelper (21 tests):
- GetStatusIcon: Connected/Connecting/Error/unknown enum value
- GetChannelStatusIcon: healthy/intermediate/empty/null/unknown status
- TruncateText: short/null/whitespace/exact-max/over-max/custom-length
- FormatProviderSummary: singular vs plural
- GetNextToggleValue: on/ON/On → off; off/null/empty/other → on

MenuSizingHelper (24 tests):
- ConvertPixelsToViewUnits: 96/192 dpi, zero/negative pixels, zero dpi fallback, minimum-1 clamp
- HasDpiOrScaleChanged: same DPI+scale, different DPI, different scale, sub-tolerance scale delta, zero-DPI normalisation, NaN/0 scale normalisation
- CalculateWindowHeight: content fits/exceeds, zero/negative content, zero work area, work area smaller than minimum, custom minimum

All 45 tests pass. Pre-existing 8 failures in ExecApprovalV2NormalizationTests are Windows-path tests that fail on Linux runners — not caused by this change.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@clawsweeper
Copy link
Copy Markdown

clawsweeper Bot commented May 23, 2026

Codex review: needs maintainer review before merge.

Latest ClawSweeper review: 2026-05-23 01:33 UTC / May 22, 2026, 9:33 PM ET.

Workflow note: Future ClawSweeper reviews update this same comment in place.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

Summary
Adds a new tests/OpenClaw.Shared.Tests/MenuHelpersTests.cs file with xUnit coverage for MenuDisplayHelper and MenuSizingHelper.

Reproducibility: not applicable. this is a test coverage PR, not a bug report. The source check shows the helpers and existing tray-project tests are present on current main.

PR rating
Overall: 🦐 gold shrimp
Proof: 🌊 off-meta tidepool
Patch quality: 🦐 gold shrimp
Summary: The patch is low-risk and coherent, but its value is limited by overlap with existing helper tests on main.

Rank-up moves:

  • Decide whether helper coverage should be moved into Shared.Tests, reduced to missing cases, or left in the existing Tray.Tests suite.
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Real behavior proof
Not applicable: This is a GitHub Actions bot PR, so the external contributor real-behavior-proof gate is not applied; the PR body still reports the shared test command result.

Risk before merge

  • Merging as-is would duplicate many helper assertions across two test projects, so future helper changes may need updates in two places.
  • The PR appears to add a few narrowly useful cases not obvious in the existing tray tests, such as sub-tolerance scale deltas, so closing it as fully redundant would discard small coverage signal.

Maintainer options:

  1. Decide the mitigation before merge
    Keep one clear owning location for menu helper coverage, adding only the missing tolerance or normalization cases if maintainers want extra coverage in Shared.Tests.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge
Maintainer judgment is needed on whether the duplicated Shared.Tests placement is desirable; there is no narrow automated repair required from the current diff.

Security
Cleared: The diff only adds C# xUnit tests and does not change dependencies, workflows, scripts, secrets handling, or runtime code.

Review details

Best possible solution:

Keep one clear owning location for menu helper coverage, adding only the missing tolerance or normalization cases if maintainers want extra coverage in Shared.Tests.

Do we have a high-confidence way to reproduce the issue?

Not applicable; this is a test coverage PR, not a bug report. The source check shows the helpers and existing tray-project tests are present on current main.

Is this the best way to solve the issue?

Unclear. The patch is coherent, but current main already has broader helper tests in OpenClaw.Tray.Tests, so the maintainable path is a maintainer decision about moving, extending, or avoiding duplicate coverage.

Label changes:

  • add P3: This is low-risk test coverage cleanup with no runtime behavior change.
  • add rating: 🦐 gold shrimp: Current PR rating is 🦐 gold shrimp because proof is 🌊 off-meta tidepool, patch quality is 🦐 gold shrimp, and The patch is low-risk and coherent, but its value is limited by overlap with existing helper tests on main.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is a GitHub Actions bot PR, so the external contributor real-behavior-proof gate is not applied; the PR body still reports the shared test command result.

Label justifications:

  • P3: This is low-risk test coverage cleanup with no runtime behavior change.
  • rating: 🦐 gold shrimp: Current PR rating is 🦐 gold shrimp because proof is 🌊 off-meta tidepool, patch quality is 🦐 gold shrimp, and The patch is low-risk and coherent, but its value is limited by overlap with existing helper tests on main.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is a GitHub Actions bot PR, so the external contributor real-behavior-proof gate is not applied; the PR body still reports the shared test command result.

What I checked:

Likely related people:

  • bkudiess: The helper area and existing helper tests appear to have landed through Rebuild Nodes page as cross-platform Instances page #407, whose API metadata names bkudiess as the PR author and includes the branch commits that were merged. (role: feature contributor; confidence: high; commits: 27dd4ddda5fa, e9c5de3d90d7; files: src/OpenClaw.Shared/MenuDisplayHelper.cs, src/OpenClaw.Shared/MenuSizingHelper.cs, tests/OpenClaw.Tray.Tests/MenuDisplayHelperTests.cs)
  • shanselman: Local blame attributes the current helper files and tests to merge commit e9c5de3d90d701f21024ff04c7b63087ce48658f, and GitHub API metadata names shanselman as the merger for that PR. (role: merger and recent area contributor; confidence: high; commits: e9c5de3d90d7, 1960a436e0d0, bc140e9cca41; files: src/OpenClaw.Shared/MenuDisplayHelper.cs, src/OpenClaw.Shared/MenuSizingHelper.cs, tests/OpenClaw.Tray.Tests/MenuDisplayHelperTests.cs)

Codex review notes: model gpt-5.5, reasoning high; reviewed against 8714381248a2.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. labels May 23, 2026
@clawsweeper
Copy link
Copy Markdown

clawsweeper Bot commented May 23, 2026

ClawSweeper PR egg

✨ Hatched: 🥚 common Moonlit Merge Sprite

Hatch command

Comment @clawsweeper hatch when this PR is hatchable.

Hatchability rules:

  • Merged PRs are hatchable.
  • Open PRs are hatchable when they are status: 👀 ready for maintainer look, status: 🚀 automerge armed, or labeled clawsweeper:automerge.
  • Closed unmerged PRs are hatchable only when one of those hatchable labels is still present in the durable record.

Rarity: 🥚 common.
Trait: watches the merge queue.
Image traits: location green-check meadow; accessory little merge flag; palette cobalt, lime, and pearl; mood calm; pose pointing at a small proof artifact; shell paper lantern shell; lighting cool dashboard glow; background tiny artifact crates.
Share on X: post this hatch
Copy: My PR egg hatched a 🥚 common Moonlit Merge Sprite in ClawSweeper.

What is this egg doing here?
  • Eggs appear after the PR passes real-behavior proof. It is here for vibes, not verdicts: it does not change labels, ratings, merge decisions, or automation.
  • The shell reacts to review momentum: open follow-up work warms it up, re-review makes it wobble, and a clean final review lets it hatch.
  • Hatchability usually comes from sufficient real-behavior proof, no blocking P0/P1/P2 findings, no security attention needed, and clean correctness. A merged PR is already final, so merge makes the egg hatchable independently.
  • The hatch is seeded from this repository and PR number, so the same PR keeps the same creature; the reviewed head SHA can only change safe visual details.
  • Rarity is just collectible sparkle: 🥚 common, 🌱 uncommon, 💎 rare, ✨ glimmer, and 🌈 legendary.

@shanselman shanselman marked this pull request as ready for review May 23, 2026 05:16
@shanselman shanselman merged commit 5a87c99 into master May 23, 2026
6 checks passed
@shanselman shanselman deleted the repo-assist/improve-menuhelpers-tests-2026-05-23-64c69b4d0fa2bef3 branch May 23, 2026 05:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. repo-assist status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant