Skip to content

fix(admin): harden support reads, payment periods, and admin console UI - #25

Merged
iamparmjeet merged 4 commits into
mainfrom
feat/admin-hardening
Sep 16, 2026
Merged

iamparmjeet merged 4 commits into
mainfrom
feat/admin-hardening

Conversation

@iamparmjeet

Copy link
Copy Markdown
Owner

Summary

Two slices for the admin console, split per repo convention (one slice per
branch, rollback tag pre-admin-hardening).

Server hardening (fix(admin))

  • Demo/sample identities no longer appear in admin user/subscription lists, and
    recordSubscriptionPayment refuses them (the overview already filtered; the
    lists and the mutation did not).
  • Month-end renewals clamp in SQL (make_interval: Jan 31 + 1 month = Feb 28)
    instead of JS setUTCMonth overflowing to Mar 3.
  • Per-owner pg_advisory_xact_lock plus period computed from the locked row, so
    concurrent different-reference payments chain instead of both reading the
    same current_period_end and losing an extension.
  • Beta-code history reads beta_code_redemptions (the ledger) instead of the
    single-use used_by_user_id/used_at columns; adds
    admin.betaCodes.listRedemptions.
  • Expiring an exhausted beta code is refused server-side.
  • Managed rent volume excludes demo identities, matching every other overview
    metric (this was the ₹9,76,700-vs-0-owners mismatch on the dashboard).

Admin UI (refactor(admin))

  • Reuses StatsGrid, EmptyState, PageLoader, DetailHeader plus a local
    TableSkeleton; adds route error.tsx and loading.tsx.
  • Fixes the hydration error: TableSkeleton no longer nests <tbody> inside
    <tbody>; lists gate loading on React Query isPending (SSR-stable) instead
    of isLoading (false during SSR, true on first client paint).
  • Adds an audit actor filter and a per-code beta redemption viewer.
  • Mobile/tablet fixes: header label, stat value wrapping, min-w-0 flex rows,
    full-width selects, wrapping pagination.

Verification

  • bun run check-types — 6/6
  • Biome clean on changed paths
  • bun run build:admin — green (9/9 pages)
  • bunx vitest run admin + beta-code-redemption suites — 30/30
  • New regressions in packages/api/src/routers/test/admin-hardening.test.ts (6)

Not included (needs a decision)

  • Pause/cancel/extend/refund subscription: entitlement is read from
    plans.tenant_limit only and ignores subscription status/expired, so those
    actions would be dead buttons without an enforcement slice; refund needs a
    ledger/reversal decision.
  • The Neon db.batch payment-lock path is not exercised by tests (the local
    test DB uses the node transaction). The SQL is identical on both paths and
    the lock ordering follows the B10 precedent.

- Exclude demo/sample identities from admin user and subscription lists and
  refuse payments against them; the overview already filtered but the lists
  and the mutation did not.
- Clamp month-end renewals in SQL (Jan 31 + 1 month = Feb 28) instead of
  setUTCMonth overflow to Mar 3.
- Serialize per-owner payments with a transaction-scoped advisory lock and
  compute the period from the locked row, so concurrent different-reference
  payments chain instead of losing an extension.
- Read beta-code redemption history from beta_code_redemptions (the ledger)
  instead of the single-use columns, and add a per-code redemption query.
- Refuse expiring an exhausted beta code server-side.
- Exclude demo identities from managed rent volume, matching every other
  overview metric.

Adds packages/api/src/routers/test/admin-hardening.test.ts (6 regressions).
- Adopt StatsGrid, EmptyState, PageLoader, DetailHeader and a local
  TableSkeleton; add route error.tsx and loading.tsx.
- Fix hydration: TableSkeleton no longer nests <tbody> inside <tbody>, and
  lists gate loading on React Query isPending (SSR-stable) instead of
  isLoading, which is false during SSR and true on the first client paint.
- Add an audit actor filter and a per-code beta redemption viewer.
- Responsive: hide the header label on phones, wrap long stat values in the
  2-up mobile grid, min-w-0 the header/detail flex rows, full-width selects,
  wrapping pagination.
Record the server fixes, the dashboard managed-rent-volume demo leak, and
the hydration fix so the next session resumes without re-discovery.
@vercel

vercel Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

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

4 Skipped Deployments
Project Deployment Actions Updated
rently-admin Ignored Ignored Sep 16, 2026 7:39pm UTC
rently-dashboard Ignored Ignored Sep 16, 2026 7:39pm UTC
rently-tenant Ignored Ignored Sep 16, 2026 7:39pm UTC
rently-web Ignored Ignored Sep 16, 2026 7:39pm UTC

@iamparmjeet
iamparmjeet merged commit 1c58ccf into main Sep 16, 2026
7 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.

1 participant