KatInterview

Troubleshooting Search Inconsistencies and Inventory Bugs in Web Apps

System DesignModel answer
EasyModel answerSystem Designdebuggingfull-stackapi

Last updated

Outline a structured debugging methodology for diagnosing search and inventory state discrepancies in full-stack applications using targeted tracing and controlled AI code analysis.

You take ownership of a legacy library management application. Users have reported two main issues:

  1. Book search and filtering produce incomplete or missing results under specific conditions.
  2. Real-time book inventory and availability displays frequently show out-of-date or invalid stock counts.

Walk through your end-to-end strategy for identifying, isolating, and resolving these issues.

Rules for AI Tooling

Assume you are permitted to use an AI assistant during this investigation, but only for explaining legacy code snippets, explaining database queries, or identifying potential files of interest. The AI must not be asked to write the bug fixes or generate automated resolutions directly.

Guidelines

Your response should explain:

  • How you establish deterministic steps to reproduce the symptoms.
  • How you isolate issues between the frontend interface, backend routing/business logic, search indexing/database queries, and state management.
  • How you leverage the AI assistant responsibly within the permitted scope.
  • How you craft, test, and verify the fix while preventing regression errors.

Hints

Hint 1

Divide the system into clear observation boundaries: UI state, API payload, server query execution, and persistent storage.

Hint 2

Consider edge cases in query matching like case sensitivity, pagination off-by-one errors, null handling, or stale local UI caching.

Hint 3

Focus AI usage on dissecting complex legacy functions or SQL query execution plans rather than asking it to auto-patch the codebase.