Detail for the two rules in web/admin/AGENTS.md.
All fetches use hooks/useAuthToken.ts; never call getIdToken(), create auth headers, or read Firestore in the client.
- Reads:
useAuthToken()+authenticatedFetcher; mutations:useAuthFetch()→fetchWithAuth(url, init). - Server routes call
verifyAdmin(request)fromlib/auth.ts. - Parallel fetches use
Promise.allSettled, returningpartial: trueon partial failure and 502 on total failure. - SWR configuration belongs in
components/swr-provider.tsx; keys aretoken ? [url, token] : null. - Partial data shows an amber warning. On error, clear stale data and show N/A; never show stale data with an error flag.
- Do not add custom fetchers,
useEffecttoken handling, manual-authfetch(),Promise.allupstream calls, or zero metrics for upstream failures.
Subscription metrics use lib/stripe-subscriptions.ts; never list subscriptions by price ID.
OMI_PLAN_PRODUCTSdefines the subscription scope; it excludes marketplace apps and internal test products. Add a line when launching a plan.- Marketplace apps are excluded by
metadata.app_id, stamped by the backend on app checkout. - MRR includes
activeandpast_due; reporttrialingseparately. - Normalize amounts with each price's
intervalandinterval_count; never assume monthly or annual pricing.