← Back to Pull requests

Fix admin pages that break on undefined names #201

Open
unknown opened this pull request with 266 lines diff across 3 files
View on GitHub
unknown unknown commented on Oct 01, 2026 21:58 UTC
Author

Why


Same class of bug as last night's backend crash: a name used but never defined only fails when that code runs. A scan of every admin page, with its scripts in load order, found 11 on dev (all also on main).

Fixes


| Page | Before | After |
|---|---|---|
| Food management | "Delete Selected" button found by a browser shortcut | looked up by id |
| Card details | update request sent to /card/update/[object HTMLInputElement] | uses the card number value |
| Update adhyayan / update utsav | on a server error the page threw silently, staff saw nothing | shows the server's message (falls back to the status text) |
| Utsav check-in and issue-plate scanners | Home and Logout did nothing; Logout didn't clear the session | load the shared role-check script, like the sibling scanner pages |
| Forms create | Access Type change threw every time | removed two handlers pointing at functions that never existed or were removed on purpose (an existing listener already handles Access Type) |

Cleanup (approved): removed a toggle-status loop that never runs, an unused header script, and jQuery plugins loaded without jQuery on create-utsav and utsav-registration (they threw 3 errors on load). Fixed wrong script paths on the role-delete page, removed a tag for a file that doesn't exist on the menu page, and loaded the table script on the admins list.

Proof


  • Page-aware scan (strict): 11 findings on dev → 0.

  • Headless Chrome with a stubbed API: 12/12 checks pass (1/12 on dev) — food button, card update URL, both update pages' error messages (JSON 400 and non-JSON 502), Home/Logout on both scanners, forms Access Type change, admins list loads.

  • 0 page errors on all 13 touched pages.
  • Known, not fixed here


  • The card details page still can't work end to end: nothing links to it, its card number field is never filled, and the backend route has no card number in the path.

  • The two utsav scanner pages don't check the user's role on load like their siblings do.
  • No tooling added to this repo (the S3 deploy uploads everything publicly).

    🤖 Generated with Claude Code

    Diff: 266 lines (+199 / -67) across 3 files Reviewer: claude[bot] Review duration: 7m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.39) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 266 lines diff across 3 files
    0.39
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    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
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.334
    Real PR Conversation Timeline
    1 comments
    "Review active on #201"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% 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: 39.4% (MEDIUM) · Higher = larger blast radius
    39.4%
    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: 46.7% · Lower = rushed or shallow review
    46.7%
    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: 21.0% · Safe to merge
    21.0%