Skip to content

feat: Phase E+F — complete app build, CI/CD, and supporting artifacts - #177

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

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

Conversation

@jonathan-vella

Copy link
Copy Markdown
Owner

Description

Completes the full HackOps application build (Phases E and F). This PR brings 18 commits from feature/app-06-admin into main, covering the admin API, leaderboard, dashboards, full test suite, CI/CD workflows, seed script, and all supporting documentation.

Type of Change

  • 🆕 New prompt guide section
  • 🏗️ New infrastructure module (Bicep/Terraform)
  • 🤖 Agent definition update (.github/agents/)
  • 📝 Documentation update
  • ⚙️ Configuration/workflow change

Workflow Used

  • Copilot Coding Agent (autonomous)

Changes Made

Phase E — Application Build (app-06 through app-10):

  • feat(api): admin, roles, audit, config routes (app-06)
  • feat(leaderboard): SSR page with auto-refresh, grade/award badges (app-07)
  • feat(web): admin/hacker/coach dashboard pages and shared components (app-08)
  • test(app-09): 178 tests across 18 files, 93% line coverage, 86% branch coverage
  • ci: hackops-ci.yml (5 jobs) + hackops-deploy.yml (dev+prod, OIDC, slot swap) (app-10)

Phase F — Supporting Artifacts:

  • scripts/seed-cosmos.ts: 11 containers with full sample data
  • apps/web/tests/fixtures/index.ts: typed test fixtures + Easy Auth principal headers
  • docs/testing-strategy.md: test pyramid, tools, coverage targets
  • docs/security-checklist.md: consolidated security invariants
  • docs/local-dev-guide.md: step-by-step local dev setup
  • Updated QUALITY_SCORE.md, docs/README.md, copilot-instructions.md

Testing Performed

  • npx tsc --noEmit passes clean
  • npm test — 178/178 tests pass
  • npm run lint:md — 0 errors
  • npm run validate — all validators pass
  • actionlint — 0 errors on all 5 CI workflows

- 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
…nd slot swaps

- hackops-ci.yml: split into 5 parallel jobs (lint, type-check, test,
  bicep-validate, build), add coverage artifact upload, add Bicep
  build+lint job, add infra path trigger
- hackops-deploy.yml: add dev/prod environments with OIDC federation,
  staging slot swap for zero-downtime, health check verification,
  IaC deployment step (Bicep), manual dispatch with env selector
- Both files pass actionlint with zero errors
- All 178 tests pass, tsc clean
- Add audit container (11th) to seed-cosmos.ts
- Add sample docs for scores, submissions, rubrics, progression, audit
- Add coach role to sample data for richer testing
- Create apps/web/tests/fixtures/index.ts with typed fixture data
- Include Easy Auth principal headers for admin/coach/hacker simulation
- F3: docs/testing-strategy.md (test pyramid, tools, coverage targets)
- F4: docs/security-checklist.md (consolidated security invariants)
- F5: docs/local-dev-guide.md (step-by-step local setup)
- F6: Updated QUALITY_SCORE.md, docs/README.md, copilot-instructions.md
- Updated session tracker: Phase F complete, session #30 logged
Phase F artifacts reviewed and updated:
- Refined docs/testing-strategy.md, docs/security-checklist.md, docs/local-dev-guide.md
- Updated docs/exec-plans/active/hackops-execution.md formatting
- Synchronized QUALITY_SCORE.md and README meta-documentation
- Enhanced scripts/seed-cosmos.ts and test fixtures formatting
- Updated copilot-instructions.md
@jonathan-vella
jonathan-vella merged commit a78f996 into main Feb 27, 2026
1 of 5 checks passed
@jonathan-vella
jonathan-vella deleted the feature/app-06-admin branch February 27, 2026 17:05
@jonathan-vella jonathan-vella mentioned this pull request Feb 27, 2026
1 of 3 tasks
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