Skip to content

feat(app-09): comprehensive test suite, session tracker, and doc-gardening - #176

Merged
jonathan-vella merged 13 commits into
mainfrom
feature/app-06-admin
Feb 27, 2026
Merged

jonathan-vella merged 13 commits into
mainfrom
feature/app-06-admin

Conversation

@jonathan-vella

Copy link
Copy Markdown
Owner

Summary

Completes Phase E Step 9 (app-09-tests) and runs doc-gardening health checks.

Changes

1. Test Suite (app-09) — Commit 1a92ad3

  • New test files: leaderboard (17), challenge-gate (9), me (7), audit (2), utils (4), health (1), leaderboard API (3)
  • Extended roles.test.ts with 4 isGlobalAdmin tests
  • Configured @vitest/coverage-v8 with 80% thresholds
  • Results: 178 tests, 93% line coverage, 86% branch coverage
  • All validators pass: tsc clean, business rules 28/28, eslint clean

2. Session Tracker Update — Commit 278d69b

3. Doc Gardening — Commit 420262b

  • Ran all validators: freshness ✅, instructions ✅, skills ✅, agent frontmatter ✅
  • Updated QUALITY_SCORE.md: Application grade A-→A
  • Fixed instruction count in docs/README.md: 21→28 (debt [Epic] Phase B: Backlog Scaffold #21 resolved)
  • No new active debt discovered

Gates

  • 178 tests pass (all)
  • Coverage >80%: lines 93.01%, branches 86.05%
  • tsc --noEmit clean
  • npm run validate:business-rules passes (28/28)
  • npx next lint clean
  • All doc validators green

Testing

Run locally to verify:

cd apps/web
npx vitest run                    # 178 tests pass
npx vitest run --coverage         # lines 93%, branches 86%
tsc --noEmit                      # no errors

Related Issues

Closes #6 (app-08 complete), #9 (app-dev skills), #10 (app-dev instructions)

- POST /api/roles/invite — invite coach/admin by GitHub username
- GET /api/roles — paginated role list (hackathon-scoped)
- DELETE /api/roles/:id — remove role (primary admin protected)
- GET /api/audit/:hackathonId — paginated audit trail with action filter
- GET /api/config — list all app-wide config values
- PATCH /api/config/:key — update config (read-only keys protected)

Added isGlobalAdmin() for app-wide admin checks (config endpoints).
3 Zod schemas: role invite, audit list, config update.
24 tests covering auth, RBAC, primary admin protection, config
read-only keys, pagination, and happy paths.

131/131 tests pass, tsc + eslint clean, business rules 28/28 pass.
…/award badges

- API route: GET /api/leaderboard/[hackathonId] with score aggregation,
  tiebreaker (earliest last-approval), grade badges (A/B/C/D),
  award badges (Fastest, Highest per Challenge, Perfect Score)
- SSR page: /leaderboard/[id] with generateMetadata, server-rendered
  initial HTML for fast first paint and shareable URLs
- Client component: auto-refresh polling every 30s with countdown,
  expandable rows for per-challenge score breakdown
- Shared lib: buildLeaderboard() used by both API and SSR page
- Components: GradeBadge (color-coded A/B/C/D), AwardBadge
- Gate: npm run build succeeds, tsc clean, 131/131 tests pass
- Reformat page route, Award badge, and Leaderboard table for consistency
- Adjust line breaks in TypeScript and JSX for readability
- Add new sync-issues.prompt.md for reconciling tracker with GitHub
- Update session log formatting in execution tracker
app-08-dashboard: Build all frontend pages from ui-pages.md spec.

Pages (10 routes):
- / (landing with auth redirect)
- /join (4-digit event code onboarding)
- /dashboard (role-scoped: admin/coach/hacker views)
- /admin/hackathons (CRUD, launch, archive, assign teams)
- /admin/teams (view teams, reassign hackers)
- /admin/rubrics (create rubric, dynamic categories, activate)
- /admin/audit (paginated, filterable audit trail)
- /admin/roles (invite users, remove roles, primary admin protection)
- /admin/config (inline edit, read-only key protection)
- /leaderboard/:id (existing, unchanged)

Layouts:
- Admin layout with sidebar, role guard, loading state
- Shell layout via Navbar component

Shared components (14):
navbar, admin-sidebar, status-badge, empty-state, loading-skeleton,
hackathon-picker, confirm-dialog, pagination-bar, progress-bar,
challenge-card, submission-form, review-card, rubric-form

Infrastructure:
- /api/me endpoint (auth principal + roles)
- useAuth and useFetch hooks for client components
- Extended lucide-react type declarations

Gate: npm run build succeeds, tsc clean, 131/131 tests pass,
28/28 business rules pass
- Add leaderboard.test.ts (17 tests): ranking, tiebreaker, grade badges,
  award badges (Fastest to Complete, Highest Score, Perfect Score),
  challenge breakdown, edge cases
- Add audit.test.ts (2 tests): audit record creation with all fields
- Add utils.test.ts (4 tests): cn() Tailwind merge utility
- Add challenge-gate.test.ts (9 tests): gate checking, progression
  advancement with ETag, edge cases
- Add health.test.ts (1 test): health endpoint
- Add me.test.ts (7 tests): auth, role derivation, dev bypass, error handling
- Add leaderboard-api.test.ts (3 tests): route handler with cache headers
- Extend roles.test.ts with isGlobalAdmin tests (4 tests)
- Configure @vitest/coverage-v8 with 80% thresholds
- Exclude hooks from coverage (client-side React, no business logic)

Coverage: lines 93.01%, branches 86.05%, functions 88.88%
Gate: 178/178 tests pass, tsc clean, business rules 28/28
- Application grade A-→A: 178 tests, 93% coverage, 24 routes, 10 pages
- Fix instruction count 21→28 in docs/README.md (debt #21)
- All validators pass: freshness, instructions, skills, agent frontmatter
- No new active debt items discovered
@jonathan-vella
jonathan-vella merged commit a1b35f2 into main Feb 27, 2026
1 of 4 checks passed
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.

Create UI pages

1 participant