Repository navigation
feat: admin API layer, split CI, PR previews and contributor docs (#709, #686, #687, #695) - #828
Merged
amina69 merged 1 commit intoOct 25, 2026
Conversation
…ina69#709, amina69#686, amina69#687, amina69#695) amina69#709 Admin types, schemas and adminService - Zod schemas/types for AdminUser, AuditLogEntry, AdminStats and a reusable paginatedSchema factory; adminService parses every response - 403 raises ForbiddenError; a global handler shows a fixed friendly message amina69#686 Core CI workflow - Separate Install, Type check, Lint, Unit tests (coverage), Build and e2e jobs - Concurrency group cancels superseded PR runs; CI success gate job amina69#687 PR preview deployments - preview.yml deploys each PR to Vercel, keeps one sticky comment, and removes the deployment when the PR closes amina69#695 Contributing guide, changelog and release checklist - CONTRIBUTING.md, CHANGELOG.md, PR template and bug/feature issue templates
|
@ZeePearl56 is attempting to deploy a commit to the sheriffamina1-9497's projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Four Phase 3 backlog items in one PR: the typed admin API layer, a split CI pipeline, PR preview deployments, and contributor docs.
Closes #709
Closes #695
Closes #687
Closes #686
#709 — Admin types, schemas and
adminServicesrc/features/admin/schemas/paginated.tspaginatedSchema(item)factory →{ items, total, page, pageSize }src/features/admin/schemas/adminSchemas.tsadminUserSchema,auditLogEntrySchema(id, actorId, actorName, action, entityType, entityId, createdAt, metadata),adminStatsSchema, and the two paginated list schemassrc/features/admin/types/admin.types.tssrc/api/adminService.tslistUsers,getAuditLog,getStats; every response is Zod-parsedsrc/lib/forbidden.ts,src/components/ForbiddenNotifier.tsxPaginated<T>is reusable: both admin lists are built from the one factory.adminServiceraisesForbiddenError(the class already inlib/api-errors). The query client reports any 403 to a small channel, andForbiddenNotifier(mounted once inmain.tsx) shows a fixed "You don't have permission to do that." toast. The backend's message is never shown.userFacingMessage(error)is exported for screens that render an error inline.GET /admin/users,/admin/audit-log,/admin/stats, with the page/pageSize/filter params listed inadmin.types.ts. Please confirm with whoever builds the backend.Open PR #820 also adds
src/api/adminService.tsandsrc/types/admin.ts, with a different shape (plain arrays, plus suspend/reinstate/role methods). Whichever merges second will conflict onadminService.ts. I followed #709's spec (paginated envelope, Zod parsing,ForbiddenError) rather than guessing at #820's, so the two will need reconciling: #820's hooks would move to{ items, total }results and I'd suggest keeping its mutation methods in this file. Happy to rebase onto whichever lands first.#686 — Core CI workflow (
.github/workflows/ci.yml)Jobs, each reporting its own check:
Install(cachednode_modules, audit, lockfile check) →Type check·Lint·Unit tests(coverage, uploaded as an artifact) ·Build, plus the existinge2ejob, and a finalCI successgate.mainare never cancelled).type-check(tsc -b) andtest:coverage; new dev dependency@vitest/coverage-v8@4.1.12(matching the locked vitest;package-lock.jsononly gains the coverage packages). Coverage config is invite.config.ts;coverage/is git-ignored. No coverage threshold is enforced, since none was specified.test:coverageuses--testTimeout=30000. With coverage on, 13 existing tests timed out at the 5 s default in a full local run. I also gave one existing wait (realtimeNotifications.test.tsx, the lazy-loaded dropdown) a 10 s timeout.Needs a repo admin ("PRs can't merge red"): a workflow file can't enforce merge rules. Require the
CI successcheck in branch protection formain. It is red if any job failed, was cancelled or was skipped. Steps are in the newdocs/ci.md.Heads-up: the old
validatejob was split intoInstall,Type check,Lint,Unit testsandBuild. Ifvalidateis currently a required check it must be replaced, or PRs will wait on it forever.#687 — PR preview deployments (
.github/workflows/preview.yml)deploy.yml), posts one sticky comment with the URL and updates it on each push, and removes the deployment when the PR closes (the URL is stored in the comment as a hidden marker).preview; required secrets/variables are in the new "Pull request previews" section ofdocs/deploy.md. Previews point at the staging API.MSW is not supported in previews. The issue mentions MSW configurable by label. MSW only runs in the dev server (
import.meta.env.DEVinmain.tsx), andscripts/check-msw-production.mjsdeliberately fails any production build withVITE_MSW=true(#526). Enabling it in a deployed preview would mean weakening that guard, so I left it off and documented why. Analytics are also forced off in previews.#695 — Contributing guide, changelog, release checklist
CONTRIBUTING.md: setup, branch/commit conventions (taken from the repo's actual history), how to add a feature folder (mirrorssrc/features/approval), local checks, PR checklist (type-check, lint, test, build, a11y, Figma comparison screenshots), and the release checklist (version bump, tag, staging smoke test, production approval, rollback).CHANGELOG.md: Keep-a-Changelog, Phase 3 under[Unreleased], written from the merged history..github/pull_request_template.md(picked up automatically for new PRs) and.github/ISSUE_TEMPLATE/bug + feature forms (blank issues disabled).docs/ci.mdis new.The release steps match
docs/deploy.md(pushmaintostaging, tagv*, approve in theproductionenvironment).Tests
New: 23 tests in 3 files —
adminService(params, schema rejection, 403 →ForbiddenError, other errors pass through),paginatedSchema(reuse + invalid envelopes), and the 403 channel (including that the raw server text is never rendered).tsc -bclean; ESLint clean on all changed codenpm run test:coverage: 141/142 files, 1144/1145 tests; the one failure was the lazy-dropdown timeout fixed above, and that file passes with coverage on its ownNot verified
ci.ymlandpreview.ymlwere only YAML-validated locally; the first CI run is their real test, andpreview.ymladditionally needs thepreviewenvironment configured with Vercel credentials.