Skip to content

test(ui): cover formatReversalEventType's three branches directly - #8782

Closed
nghetien wants to merge 1 commit into
JSONbored:mainfrom
nghetien:fix/issue-8665-a1-test-ui
Closed

test(ui): cover formatReversalEventType's three branches directly#8782
nghetien wants to merge 1 commit into
JSONbored:mainfrom
nghetien:fix/issue-8665-a1-test-ui

Conversation

@nghetien

Copy link
Copy Markdown
Contributor

The formatReversalEventType helper in reversal-health-card-model.ts has three branches (reversal_reverted, reversal_reopened, and a generic fallback), but only reversal_reopened was exercised, and only indirectly through a ReversalHealthCard render assertion. This adds direct unit tests for all three branches, including the previously-uncovered "merge reverted" case.

Closes #8665

Validation

  • npx vitest run src/components/site/app-panels/reversal-health-card.test.tsx — 9/9 passed
  • npm --workspace @loopover/ui run test — 88 files / 626 tests passed
  • npm --workspace @loopover/ui-miner run test — 37 files / 393 tests passed
  • npm test (root suite) — 1156 files / 21627 tests passed
  • npm run test:workers — 3/3 passed
  • npm run typecheck, npm run actionlint, and the full drift/manifest/reference check suite — all green
  • npx turbo run lint --filter=@loopover/ui --filter=@loopover/ui-miner — 0 errors

Add direct unit assertions for the reversal_reverted, reversal_reopened,
and fallback branches of formatReversalEventType, previously exercised
only indirectly through the ReversalHealthCard render tests.
@nghetien
nghetien requested a review from JSONbored as a code owner July 26, 2026 05:10
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 26, 2026
@loopover-orb

loopover-orb Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-26 05:16:23 UTC

1 file · 1 AI reviewer · no blockers · readiness 95/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This is a small, well-targeted test-only addition that adds three direct unit tests for formatReversalEventType's three branches (reversal_reverted, reversal_reopened, and the generic underscore-to-space fallback), closing the coverage gap noted in issue #8665 where only the reopened case was exercised indirectly. The import and expected string outputs align with the referenced component usage (formatReversalEventType is already used and exported from reversal-health-card-model.ts, consistent with the render assertion 'close reopened · merged' seen in the existing ReversalHealthCard tests). No production code is touched, so risk is minimal.

Nits — 2 non-blocking
  • The fallback test only checks one example input ('some_new_event'); consider also asserting on an edge case like a single-word/no-underscore input if the model function has different behavior there.
  • Consider grouping the three new assertions using it.each for conciseness, though the current explicit form is also fine and arguably more readable.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #8665
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 3 registered-repo PR(s), 1 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor nghetien; Gittensor profile; 3 PR(s), 0 issue(s).
Improvement ℹ️ Insufficient signal risk: clean · value: insufficient-signal
Linked issue satisfaction

Addressed
The diff adds three direct unit tests asserting formatReversalEventType's behavior for "reversal_reverted", "reversal_reopened", and a generic fallback case, exactly matching all three Deliverables in the issue.

Review context
  • Author: nghetien
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Dart, JavaScript, Python, CSS, C#, C++, TypeScript
  • Official Gittensor activity: 3 PR(s), 0 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Triage stale or unlinked PRs.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask <question> answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat <question> answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

Visual preview
Route Viewport Before (production) After (this PR's preview) Diff
/ desktop before /
before /
after /
after /
/ mobile before / (mobile)
before / (mobile)
after / (mobile)
after / (mobile)

Click any thumbnail to open the full-size screenshot. Before = production · After = this PR's preview deploy.

Scroll preview
Route Before (production) After (this PR's preview)
/ before / (scroll)
before / (scroll)
after / (scroll)
after / (scroll)

A short scroll-through clip (desktop) — click either thumbnail to open the full animation. Evidence for scroll-linked behavior a single screenshot can't show.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb

loopover-orb Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

This pull request changes UI/visual code but its screenshot evidence is incomplete. Every required viewport × theme combination needs its own before/after image pair in a labeled table row (e.g. "Desktop · Light | before | after"). Still missing: Desktop · Dark, Tablet · Dark, Mobile · Dark.

Please resubmit with the remaining rows filled in.

See https://github.com/JSONbored/loopover/blob/main/.claude/skills/contributing-to-loopover/SKILL.md for the exact format and examples. This is an automated maintenance action.

@loopover-orb loopover-orb Bot closed this Jul 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(ui): formatReversalEventType's headline 'merge reverted' branch has zero direct test coverage

1 participant