Repository navigation
fix(admin): harden support reads, payment periods, and admin console UI - #25
Merged
Merged
Conversation
- 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.
|
The latest updates on your projects. Learn more about Vercel for GitHub. 4 Skipped Deployments
|
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
Two slices for the admin console, split per repo convention (one slice per
branch, rollback tag
pre-admin-hardening).Server hardening (
fix(admin))recordSubscriptionPaymentrefuses them (the overview already filtered; thelists and the mutation did not).
make_interval: Jan 31 + 1 month = Feb 28)instead of JS
setUTCMonthoverflowing to Mar 3.pg_advisory_xact_lockplus period computed from the locked row, soconcurrent different-reference payments chain instead of both reading the
same
current_period_endand losing an extension.beta_code_redemptions(the ledger) instead of thesingle-use
used_by_user_id/used_atcolumns; addsadmin.betaCodes.listRedemptions.metric (this was the ₹9,76,700-vs-0-owners mismatch on the dashboard).
Admin UI (
refactor(admin))StatsGrid,EmptyState,PageLoader,DetailHeaderplus a localTableSkeleton; adds routeerror.tsxandloading.tsx.TableSkeletonno longer nests<tbody>inside<tbody>; lists gate loading on React QueryisPending(SSR-stable) insteadof
isLoading(false during SSR, true on first client paint).min-w-0flex rows,full-width selects, wrapping pagination.
Verification
bun run check-types— 6/6bun run build:admin— green (9/9 pages)bunx vitest runadmin + beta-code-redemption suites — 30/30packages/api/src/routers/test/admin-hardening.test.ts(6)Not included (needs a decision)
plans.tenant_limitonly and ignores subscription status/expired, so thoseactions would be dead buttons without an enforcement slice; refund needs a
ledger/reversal decision.
db.batchpayment-lock path is not exercised by tests (the localtest DB uses the node transaction). The SQL is identical on both paths and
the lock ordering follows the B10 precedent.