← Back to Pull requests

Admin report: Collection depth #234

Closed
unknown closed this pull request without merging on Nov 29, 2026 04:42 UTC
View on GitHub
unknown unknown commented on Nov 29, 2026 04:04 UTC
Author

<!-- CURSOR_AGENT_PR_BODY_BEGIN -->

Summary

Adds the Collection depth admin report: histogram of distinct catalog SKUs per account, plus a sortable table with % of catalog owned and card/pin SKU coverage (totals from bundled catalog data).

Behavior

  • /admin/reports/collection-depth registered in registry.js (alongside ISO, Growth, Activation, and Data quality from merged main).

  • Admin UI: AdminGate / isAdmin.

  • Data: one-shot paginated fetchAllCollectionEntries shared with the data-quality report (entries include Firestore id; SKU via resolveCollectionEntrySkuId). Only rows with quantity > 0 count toward depth (ISO/UFT wishlist at qty 0 excluded — matches collectionSummary.js).

  • Collectors: listAdminCollectors({ directoryOnly: true }) — Auth directory only, no second full collection scan; depth still from client pagination. Refresh also bumps reloadCollectors to refetch the directory.

  • ISO exclusions: shared one-shot fetchIsoReportExcludedUids.
  • Not tracked yet

  • Unique card faces (215) — table shows card SKU coverage only.

  • PostHog metrics.

  • Server-side aggregation (full collection scan each refresh).
  • Tests

    Depth aggregation (incl. retired pins, qty-zero ISO/UFT, legacy doc id), fetch pagination with id, hook, UI (Card/Pin SKU headers, refresh + directory reload), directoryOnly callable, Admin routes after merges.

    Setup / deploy

    | Item | Required? |
    |------|-----------|
    | Firestore indexes | No |
    | Firestore rules | No change |
    | Cloud Functions | Yes — deploy listAdminCollectors (directoryOnly) plus merged callables (getAdminGrowthReport, getAdminActivationReport, etc.) |
    | Hosting | Yes (frontend) |
    <!-- CURSOR_AGENT_PR_BODY_END -->

    <div><a href="https://cursor.com/agents/bc-f93b1a72-932b-5814-8ee4-cdca49b26cb4?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a>&nbsp;<a href="https://cursor.com/background-agent?bcId=bc-f93b1a72-932b-5814-8ee4-cdca49b26cb4&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a>&nbsp;</div>

    Diff: 344 lines (+258 / -86) across 4 files Reviewer: cursor[bot] Review duration: 37m
    All Vouch review confidence checks passed
    Residual risk 0.20 = Change Risk (0.47) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.47 · 344 lines diff across 4 files
    0.47
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.350
    Shallow Review Depth shallow_review_depth
    0.289
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #234"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 47.3% (MEDIUM) · Higher = larger blast radius
    47.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%