Skip to content

feat(wasteland): add Claims page tRPC tests + docs#3155

Merged
kilo-code-bot[bot] merged 3 commits intoconvoy/wasteland-claims-page/93e6710c/headfrom
convoy/wasteland-claims-page/93e6710c/gt/toast/c8119442
May 9, 2026
Merged

feat(wasteland): add Claims page tRPC tests + docs#3155
kilo-code-bot[bot] merged 3 commits intoconvoy/wasteland-claims-page/93e6710c/headfrom
convoy/wasteland-claims-page/93e6710c/gt/toast/c8119442

Conversation

@jrf0110
Copy link
Copy Markdown
Contributor

@jrf0110 jrf0110 commented May 9, 2026

Summary

Add tRPC procedure tests and documentation for the Claims page.

Tests (services/wasteland/src/trpc/router.test.ts):

  • listClaims with rigHandle filter
  • listClaims returns only claimed items
  • listClaims returns pending_pr with correct kind (claim/done) when DoltHub has matching open PRs
  • listClaims returns empty array when DoltHub enrichment fails (PRECONDITION_FAILED)
  • listClaims sets pending_pr to null when credential loading fails
  • forceUnclaimWantedItem rejects empty/whitespace-only reason (Zod validation)
  • forceUnclaimWantedItem rejects itemId with invalid characters (Zod regex)
  • forceUnclaimWantedItem requires upstream admin (FORBIDDEN when isUpstreamAdmin=false)

Component tests: Skipped — no *.test.tsx pattern exists in the wasteland app area (project doesn't do RTL component tests there).

Playwright e2e: Skipped — existing e2e tests require a running app with full auth; can't meaningfully test claims page without full wasteland infrastructure.

Docs (services/wasteland/docs/admin-mode.md):

  • Added "Claims page" section covering what the page shows, force unclaim workflow and audit trail, and how pending_pr enrichment works with in-flight DoltHub PRs.

Infra (services/wasteland/src/trpc/init.ts):

  • Exported createCallerFactory from the tRPC instance for test use.

Verification

  • pnpm --filter cloudflare-wasteland test passes (22/22 tests)

Visual Changes

N/A

Reviewer Notes

The test file uses vi.mock to stub DO stubs, DoltHub API, and crypto helpers — necessary because the router procedures depend on Cloudflare Durable Object bindings and external DoltHub API calls that can't run in a Node test environment.

Comment thread services/wasteland/src/trpc/router.test.ts Outdated
Comment thread services/wasteland/src/trpc/router.test.ts Outdated
Comment thread services/wasteland/src/trpc/router.test.ts Outdated
Comment thread services/wasteland/src/trpc/router.test.ts Outdated
Comment thread services/wasteland/src/trpc/router.test.ts Outdated
@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot Bot commented May 9, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Previously Flagged — All Resolved ✓
File Issue
services/wasteland/src/trpc/router.test.ts Non-null assertions (!) after not.toBeNull() guard — fixed with optional chaining
services/wasteland/src/trpc/router.test.ts Non-null assertion (!) without prior null guard — fixed with optional chaining
services/wasteland/src/trpc/router.test.ts Fragile try/catch double-invocation pattern — fixed
services/wasteland/src/trpc/router.test.ts as TRPCError cast on unknown catch variable — fixed
services/wasteland/src/trpc/router.test.ts if (err instanceof TRPCError) guard making assertion silently skippable; redundant double invocation — fixed, collapsed to single rejects.toMatchObject({ code: 'FORBIDDEN' })
Files Reviewed (3 files)
  • services/wasteland/src/trpc/router.test.ts
  • services/wasteland/src/trpc/init.ts
  • services/wasteland/docs/admin-mode.md

Reviewed by claude-4.6-sonnet-20260217 · 248,588 tokens

…s in test

- Replace pending_pr! with optional chaining (?.) after not.toBeNull() guards
- Replace fragile try/catch with .then() pattern that fails if unexpected resolve
- Remove 'as TRPCError' cast, use instanceof narrowing instead
Comment thread services/wasteland/src/trpc/router.test.ts Outdated
@kilo-code-bot kilo-code-bot Bot merged commit fe48450 into convoy/wasteland-claims-page/93e6710c/head May 9, 2026
2 checks passed
@kilo-code-bot kilo-code-bot Bot deleted the convoy/wasteland-claims-page/93e6710c/gt/toast/c8119442 branch May 9, 2026 22:21
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