Skip to content

Cap total LGA count at 774 on registration, with a seed-secret test bypass - #25

Merged
dprograma merged 2 commits into
mainfrom
claude/lga-auth-e2e-test-ocez8x
Jul 27, 2026
Merged

Cap total LGA count at 774 on registration, with a seed-secret test bypass#25
dprograma merged 2 commits into
mainfrom
claude/lga-auth-e2e-test-ocez8x

Conversation

@dprograma

Copy link
Copy Markdown
Owner

Summary

  • Nigeria has exactly 774 Local Government Areas, but POST /api/lga/register had no limit on how many rows could be created — the admin dashboard could accumulate unlimited fake LGAs beyond the real 774.
  • The guard only blocks the "fresh create" branch (no matching seeded row by name+state). The "claim a seeded LGA" branch — used when a real chairman registers against one of the 774 rows already loaded via /api/admin/seed — is untouched, so real chairman registrations are never blocked once the official 774 are seeded.
  • Test/seed scripts can still create LGAs past the cap by sending the existing SEED_SECRET (already used to gate /api/admin/seed) as an x-seed-secret header.
  • Documented SEED_SECRET properly in .env.example (it previously existed there undocumented and duplicated).

Test plan

  • npx tsc --noEmit — clean
  • npx eslint on all changed files — no new warnings/errors
  • Manual API verification: registering past the cap without the bypass header returns 409 with a clear message; the correct x-seed-secret header still allows creation past the cap; a wrong/missing header stays blocked; claiming an already-seeded LGA (no chairman yet) succeeds even when the total is well over 774
  • Updated the Playwright suite's registration helpers (11 spec files) to send the bypass header, since the local test DB already exceeds 774 rows from prior test runs
  • Added two new regression tests covering the cap enforcement + bypass, and the seeded-claim exemption
  • Full suite: npx playwright test --project=api — 454 passed (452 existing + 2 new)

Generated by Claude Code

claude added 2 commits July 24, 2026 19:00
Analytics, Press Releases, Live Streams, Audit Reports, Procurement,
and Users were built with dark-theme classes (text-white, text-green-
200/*, bg-white/5, border-white/10) assuming a dark page background,
but the admin content area is actually light (bg-slate-50) — headings,
subtitles, stat labels, search placeholders, and pagination text were
all rendering nearly invisible (white/pale-green on white). Converted
all six to the light theme already used correctly elsewhere in the
admin panel (LGA Approvals, Wards, Payments, Allocations).

The Users list row had the same non-stacking layout bug fixed earlier
on LGA Approvals — avatar, name, badges, and Suspend/Ban buttons were
forced into one non-wrapping row, so on mobile names and emails
truncated to a single character ("K…", "ke…") and buttons crowded the
text. Now stacks properly on narrow screens.

Also found the root cause of a stray corrupted byte discovered while
editing press-releases: the previous session's arrow-mojibake fix
(sed replacing "â†" with "←") left a dangling C1 control byte (U+0090)
immediately after the arrow in 5 files, invisible in normal viewing
but preventing exact-string edits on those lines. Fixed at the byte
level and confirmed zero remaining control-character corruption
across the whole app/ tree.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UPJE5cNDtQ4j7yeg9Xjtxw
…ypass

Nigeria has exactly 774 LGAs, but POST /api/lga/register had no limit on
how many rows could be created — the admin dashboard could accumulate
unlimited fake LGAs. Blocks the "fresh create" branch (no matching seeded
row) once the total hits 774; the "claim a seeded LGA" branch is untouched
so real chairmen can always register against the official 774 seeded via
/api/admin/seed. Test/seed scripts bypass the cap with the existing
SEED_SECRET via an x-seed-secret header.

Updates the Playwright suite's registration helpers to send the bypass
header (the local test DB already exceeds 774 from prior test runs), and
adds regression coverage for both the cap and the seeded-claim exemption.
@dprograma
dprograma merged commit 9805fc1 into main Jul 27, 2026
2 of 4 checks passed
@vercel

vercel Bot commented Jul 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
774ng Building Building Preview, Comment Jul 27, 2026 10:50am

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.

2 participants