Skip to content

test(ui): cover app.runs mapping helpers and SavedViews - #8777

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
rsnetworkinginc:test-app-runs-helpers-8701
Jul 26, 2026
Merged

test(ui): cover app.runs mapping helpers and SavedViews#8777
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
rsnetworkinginc:test-app-runs-helpers-8701

Conversation

@rsnetworkinginc

Copy link
Copy Markdown
Contributor

Closes #8701

What

apps/loopover-ui/src/routes/app.runs.tsx's pure mapping helpers — mapSignalFidelity, mapAgentRunKind, mapAgentRunBundle (including its four-level repo fallback chain and the counterfactuals-pooling / snapshot-replay construction) — and the SavedViews save/apply/remove flow had zero direct test coverage: app.runs.test.tsx only covered the drawer's copy buttons and the filter-bar reset control.

How

The three helpers and the SavedViews component gain an export keyword — no behavior change, no signature change — so the test file can exercise them directly. The file's sonner mock becomes a callable base (Object.assign(vi.fn(), { success, error })) because SavedViews' remove flow announces through bare toast(...), which the previous { success, error }-only mock could not represent; the existing copy-button assertions are untouched. app.runs.test.tsx grows four suites (25 tests in the file total, all passing):

  • mapSignalFidelity — all 4 branches: complete → ready, degraded → degraded, blocked → blocked, and the unknown default → stale.
  • mapAgentRunKind — all 4 branches: preflight_branch, prepare_pr_packet, both explain_blockers and explain_branch_blockersexplain-blockers, and the default (null and unrecognized strings) → plan-next-work.
  • mapAgentRunBundle — each level of the repo fallback chain (targetRepoFullName present; blank/absent → payload.repoFullName; absent → payload.input.repoFullName; input not even a record → "unknown"), plus: surface → source/boundary mapping for all three surfaces (github_commentgithub-command/public, mcp → private-mcp, api → private-api), kind and data-quality routing through the two helpers above, the scoringModelIddecisionPackVersion"live" ruleset-snapshot fallback, the createdAtupdatedAt → fresh-timestamp fallback, string-only recommendation filtering with ranked_actions counting, and snapshot-replay construction that keeps only object-shaped recommendationSnapshots (string/array/absent are dropped) while a non-array counterfactualReasons payload is ignored rather than crashing the pooling.
  • SavedViews — a full render flow: save a named view (open the naming form, type, submit), assert the chip appears, the empty state clears, toast.success announces it, and it persists to localStorage["loopover.runs.views"]; apply it and assert onApply receives the saved {status, kind, q}; remove it and assert the chip disappears, the bare-toast announcement fires, and storage empties. Companion tests pin the disabled save affordance when no filter is active and the blank-name no-op.

Deliverables (all in this one PR)

  • mapSignalFidelity tested for all 4 branches, including the default/fallthrough case.
  • mapAgentRunKind tested for all 4 branches.
  • mapAgentRunBundle tested exercising each level of the repo-fallback chain (targetRepoFullName present, absent-falls-to-payload.repoFullName, absent-falls-to-input?.repoFullName, all absent-falls-to-"unknown").
  • SavedViews render test: save a view, confirm it appears in the list, apply it, remove it.

Validation

  • app.runs.test.tsx: 25 tests, all passing (10 pre-existing + 15 new).
  • Full @loopover/ui suite: 88 test files, 600 tests, all passing; @loopover/ui-miner suite (37 files, 393 tests) also green (npm run ui:test).
  • npm run ui:typecheck green.
  • prettier --check and eslint clean on both changed files (0 errors).
  • Every branch named in test(ui): app.runs.tsx's pure mapping helpers and SavedViews flow have zero direct test coverage #8701 now has a direct, explicit assertion. (apps/** is excluded from codecov/patch; the app's own vitest suite gates locally.)

UI Evidence

This PR is test-only plus an export keyword on four existing symbols — it intentionally changes no rendered pixels, so each row's Before and After captures are identical, taken from the same build. Captured on /app/runs served locally (vite dev, local preview session per the contributor skill), with /v1/auth/session and /v1/agent/runs answered at the network boundary by fixtures shaped like the new tests' bundles (other private endpoints answer 500). The rendered list is mapAgentRunBundle's output end-to-end: the READY preflight-branch run from an mcp surface resolving JSONbored/loopover through targetRepoFullName, the DEGRADED plan-next-work run whose github_comment surface renders as github-command, and a BLOCKED explain-blockers run falling back through the repo chain — with the SavedViews "Views" row above the list. The UI is a dark-mode-only build, so the Light and Dark rows (captured under emulated prefers-color-scheme) render identically by design. Viewports: 1280×800 / 768×1024 / 375×812.

Viewport · Theme Before After
Desktop · Light Desktop light before — agent runs list rendered from mapped bundles Desktop light after — identical, test-only change
Desktop · Dark Desktop dark before — agent runs list rendered from mapped bundles Desktop dark after — identical, test-only change
Tablet · Light Tablet light before — agent runs list Tablet light after — identical, test-only change
Tablet · Dark Tablet dark before — agent runs list Tablet dark after — identical, test-only change
Mobile · Light Mobile light before — agent runs list Mobile light after — identical, test-only change
Mobile · Dark Mobile dark before — agent runs list Mobile dark after — identical, test-only change

app.runs.tsx's mapSignalFidelity, mapAgentRunKind, and mapAgentRunBundle helpers and the SavedViews save/apply/remove flow had zero direct test coverage. Export the three helpers and the SavedViews component from the route module, unit-test every mapping branch (all four data-quality statuses, all four kind mappings plus the null/unknown default, the four-level repo fallback chain, the surface-to-source/boundary mapping, the scoring-snapshot and created_at fallbacks, string-only recommendation filtering, and object-only snapshot-replay construction with non-array counterfactual pooling), and add render tests that save a named view, assert it persists to localStorage, apply it back through onApply, and remove it. The sonner mock becomes callable to match SavedViews' bare toast(...) removal announcement.
@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:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x 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 04:25:29 UTC

2 files · 1 AI reviewer · no blockers · readiness 81/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This PR only adds `export` to four already-existing, unchanged functions/components in app.runs.tsx and adds a corresponding 261-line test suite exercising the mapping helpers and SavedViews save/apply/remove flow. The sonner mock is correctly reworked into a callable base object (`Object.assign(vi.fn(), { success, error })`) to represent the bare `toast(...)` call used by SavedViews' remove flow, which is a real and necessary change given `toast("Removed...")` is called directly in app.runs.tsx. The tests trace real branches (repo fallback chain, ruleset snapshot fallback, timestamp fallback, surface→boundary mapping) against the actual implementation shown in the full file, not fabricated states.

Nits — 5 non-blocking
  • The PR description claims 'no behavior change' but doesn't mention the sonner mock rework in app.runs.test.tsx:1-13 is itself a meaningful test-infra change worth calling out explicitly in the diff summary rather than folding into the coverage description.
  • app.runs.tsx is 575 lines (external brief flags long-file), and this PR is a good opportunity to note that future feature work here should consider splitting SavedViews/DrawerSurface into separate files, though that's out of scope for a test-only PR.
  • Consider asserting `toastBase` was called exactly once in the SavedViews remove test to guard against double-toast regressions, mirroring the specificity already used for `success` assertions.
  • Possible screenshot-table issue: identical images (row 1) — Advisory only — verify the screenshot-table images against the stated change before deciding.
  • Possible screenshot-table issue: identical images (row 2) — Advisory only — verify the screenshot-table images against the stated change before deciding.

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 #8701
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ❌ 8/20 High 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: 58 registered-repo PR(s), 24 merged, 3 issue(s).
Contributor context ✅ Confirmed Gittensor contributor rsnetworkinginc; Gittensor profile; 58 PR(s), 3 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The PR exports the three helpers and SavedViews and adds tests covering all 4 branches of mapSignalFidelity and mapAgentRunKind, all four levels of mapAgentRunBundle's repo fallback chain plus surface/kind/ruleset/timestamp/recommendation logic, and a full SavedViews save/apply/remove render test.

Review context
  • Author: rsnetworkinginc
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: TypeScript
  • Official Gittensor activity: 58 PR(s), 3 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Add a concise scope and risk note.
  • Then work through the remaining 2 steps in the Signals table above.
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
/app/runs/test desktop before /app/runs/test
before /app/runs/test
after /app/runs/test
after /app/runs/test
/app/runs/test mobile before /app/runs/test (mobile)
before /app/runs/test (mobile)
after /app/runs/test (mobile)
after /app/runs/test (mobile)
/app/runs desktop before /app/runs
before /app/runs
after /app/runs
after /app/runs
/app/runs mobile before /app/runs (mobile)
before /app/runs (mobile)
after /app/runs (mobile)
after /app/runs (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)
/app/runs/test before /app/runs/test (scroll)
before /app/runs/test (scroll)
after /app/runs/test (scroll)
after /app/runs/test (scroll)
/app/runs before /app/runs (scroll)
before /app/runs (scroll)
after /app/runs (scroll)
after /app/runs (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 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.

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit c3d0704 into JSONbored:main Jul 26, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(ui): app.runs.tsx's pure mapping helpers and SavedViews flow have zero direct test coverage

1 participant