Skip to content

Round 15: /admin/scans observability + handled-timeout console cleanup#82

Merged
bejranonda merged 2 commits into
mainfrom
claude/webapp-review-improve-dlhdzr
Jun 10, 2026
Merged

Round 15: /admin/scans observability + handled-timeout console cleanup#82
bejranonda merged 2 commits into
mainfrom
claude/webapp-review-improve-dlhdzr

Conversation

@bejranonda

@bejranonda bejranonda commented Jun 10, 2026

Copy link
Copy Markdown
Owner

Round 15 — admin observability + console-noise cleanup

Two items from KNOWN_ISSUES, each its own commit:

1. /admin/scans — metadata-only scan feed (KNOWN_ISSUES 0b)

The item was blocked on "a read-only design decision on PII exposure (photos)". The decision: metadata only — photos were never stored anyway (/api/analyze writes imageUrl: null by design), rows show truncated userIds and item counts, no emails, no food-name lists. Read-only page, filter chips by errorClass, same offset pagination as /admin/users.

To make it useful for its stated purpose (spotting AI-pipeline regressions): /api/analyze now persists a failure row at the single 503 funnel with errorClasstimeout / parse_error / provider_error / binding_missing. The errorClass column existed since the first schema cut with zero writers — failures were only visible in the ephemeral CF log stream. The insert is best-effort (its own try/catch); a DB hiccup can never mask the 503 the user is receiving.

2. Handled scan timeouts log at warn, not error (KNOWN_ISSUES "benign console noise" pattern 2)

The scan UI fully absorbs cascade timeouts (renders the retry card), but the logger emitted them via console.error, polluting every console-error assertion — the e2e suites carried a dedicated filter entry just for this line. Timeout-category telemetry now emits at warn; genuinely unhandled categories stay at error.

Validation

  • npm run check:all: 193/193 unit, i18n parity, type-check — green
  • next build: green; /[locale]/admin/scans compiles as a dynamic route
  • ESLint: 0 errors
  • Full Playwright suite against the branch preview before merge, production after

Merge with Merge, not Squash (ITERATION_PROCESS §4).

https://claude.ai/code/session_01RaziyjCxHgKcqvTqss7bXS


Generated by Claude Code

Summary by CodeRabbit

  • New Features

    • Added admin Scans page to view recent food scan history with pagination and error-class filtering
    • Enhanced error tracking by persisting categorized failure records for improved visibility into scan errors
  • Documentation

    • Updated known issues documentation reflecting Round 15 improvements
  • Improvements

    • Refined timeout error logging to warning level for reduced console noise

claude added 2 commits June 10, 2026 09:55
…ilter

Closes the /admin/scans item from KNOWN_ISSUES 0b. The PII design
decision the item was blocked on: metadata only. Photos were never
stored (analyze writes imageUrl: null by design), rows show truncated
userIds and item counts — no emails, no food-name lists. Read-only,
same philosophy as /admin/users.

To make the page useful for its stated purpose (spotting AI-pipeline
regressions), /api/analyze now persists a failure row at the single
503 funnel with errorClass derived from the failure (timeout /
parse_error / provider_error / binding_missing) — the errorClass
column existed since the first schema cut but had zero writers, so
failures were only ever visible in the ephemeral CF log stream.
Best-effort insert: a DB hiccup can never mask the 503 the user is
receiving.

https://claude.ai/code/session_01RaziyjCxHgKcqvTqss7bXS
KNOWN_ISSUES 'benign console-error noise' pattern 2: the scan UI fully
absorbs cascade timeouts (renders the retry card), but the logger
reported them via console.error, polluting every console-error
assertion — the e2e suites carried a dedicated filter entry just for
this line. Timeout-category telemetry now emits at warn; genuinely
unhandled categories stay at error. KNOWN_ISSUES updated for both
Round-15 items.

https://claude.ai/code/session_01RaziyjCxHgKcqvTqss7bXS
@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bf54656d-7a43-4762-bafc-ec3f50d41cf1

📥 Commits

Reviewing files that changed from the base of the PR and between c21d119 and f48d82a.

📒 Files selected for processing (5)
  • docs/KNOWN_ISSUES.md
  • frontend/src/app/[locale]/admin/layout.tsx
  • frontend/src/app/[locale]/admin/scans/page.tsx
  • frontend/src/app/api/analyze/route.ts
  • frontend/src/lib/logger.ts

📝 Walkthrough

Walkthrough

This PR adds admin visibility into food scan failures through a new /admin/scans page that displays recent scans with optional error-class filtering. The feature is enabled by API-side persistence of failure rows (with error classification) and improved timeout telemetry via logger-level warnings instead of errors.

Changes

Admin scans visibility and telemetry

Layer / File(s) Summary
Timeout logging as handled telemetry
frontend/src/lib/logger.ts, docs/KNOWN_ISSUES.md
Logger.scanError now emits warn level logs for timeout errors instead of error, treating timeouts as handled outcomes rather than true failures, with e2e console-error filtering retained for legacy bundles.
API failure row persistence with errorClass
frontend/src/app/api/analyze/route.ts, docs/KNOWN_ISSUES.md
On AI failure in /api/analyze, a metadata-only row is inserted into foodScans (when DB available) with derived errorClass (timeout, binding, parse, provider), reviving visibility into previously untracked failure categories.
Admin scans page with filtering and pagination
frontend/src/app/[locale]/admin/scans/page.tsx
New read-only admin page displays recent food scans in a table with optional errorClass filtering via query chips, pagination controls (Newer/Older), and row details including UTC timestamp, truncated userId, scan mode, item count, model, and error status badge.
Admin navigation link to scans page
frontend/src/app/[locale]/admin/layout.tsx
Added "Scans" nav item to the admin sidebar linking to /admin/scans.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

  • bejranonda/Nutri-Vision-AI#23: Both PRs modify /api/analyze AI-failure handling to track error context (main PR adds errorClass classification and failure row persistence; retrieved PR includes Gemini fallback cascade and primaryProviderError in 503).
  • bejranonda/Nutri-Vision-AI#79: Both PRs update console-error noise documentation to reflect timeout telemetry expectations; main PR also implements the logger behavior change that the docs reference.

Poem

🐰 The scans do fly, but some may fail—
Now logged as warnings, not in wail.
The admin sees each error's class,
No more do failures silently pass.
Timeout or parse, the truth shines bright,
Making regressions easier to sight! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the two main changes: implementing /admin/scans observability and updating timeout logging to warn level instead of error.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/webapp-review-improve-dlhdzr

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying eatinorder with  Cloudflare Pages  Cloudflare Pages

Latest commit: f48d82a
Status: ✅  Deploy successful!
Preview URL: https://5027b2fe.eatinorder.pages.dev
Branch Preview URL: https://claude-webapp-review-improve.eatinorder.pages.dev

View logs

@bejranonda bejranonda merged commit 6fe653e into main Jun 10, 2026
4 of 5 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.

2 participants