Skip to content

[WIP] Fix UUID path variable mismatch in check-in API - #2

Closed
rish-kar with Copilot wants to merge 1 commit into
API-Designfrom
copilot/fix-checkin-endpoint-issue
Closed

[WIP] Fix UUID path variable mismatch in check-in API#2
rish-kar with Copilot wants to merge 1 commit into
API-Designfrom
copilot/fix-checkin-endpoint-issue

Conversation

Copilot AI commented Dec 23, 2025

Copy link
Copy Markdown

Coding agent has begun work on Spring Boot check-in endpoint failing due to UUID path variable mismatch; user requests properly formatted logs and will update this pull request as work progresses.

Original prompt

Format the logs properly. This is not proper.

The user has attached the following files from their workspace:

  • src/main/java/com/prarambh/act/one/ticketing/controller/TicketController.java
  • Act-One

TITLE: Spring Boot check-in endpoint failing due to UUID path variable mismatch; user requests properly formatted logs

USER INTENT:
Diagnose why their live Spring Boot check-in API is throwing an exception when called from an Android barcode-scanning app, and improve/standardize log formatting because current output is “not proper”.

TASK DESCRIPTION:

  • Investigate a production-like error triggered by POST /api/tickets/{id}/checkin coming from an Android client (okhttp/4.12.0) to localhost.
  • Root cause: Spring controller method expects ticketId as java.util.UUID, but the client sends a non-UUID string (appears to be a shortened/partial UUID-like barcode value): 2acc227e-716c-42fc. This causes MethodArgumentTypeMismatchException during argument conversion.
  • User expectation: this error “should not occur ever” in their online app; they want a robust fix (likely API contract alignment + validation/handling).
  • Secondary requirement: “Format the logs properly” (they are unhappy with current log formatting/output).

EXISTING:

  • Runtime logs show request/response tracing via com.prarambh.act.one.ticketing.config.RequestLoggingFilter.
  • Global exception logging via com.prarambh.act.one.ticketing.config.GlobalExceptionHandler logs the unhandled exception with requestId.
  • Current behavior: request results in HTTP 500 because of MethodArgumentTypeMismatchException converting path variable to UUID.

Key log evidence (already happening in app):

  • HTTP IN POST /api/tickets/2acc227e-716c-42fc/checkin ... ua="okhttp/4.12.0" [requestId=...]
  • Exception: Method parameter 'ticketId': Failed to convert value of type 'java.lang.String' to required type 'java.util.UUID'; Invalid UUID string: 2acc227e-716c-42fc
  • HTTP OUT POST /api/tickets/2acc227e-716c-42fc/checkin status= 500 ...

PENDING:

  • Adjust the API/controller so the check-in path variable type matches what the Android scanner sends:
    • Either change endpoint to accept String barcodeId instead of UUID ticketId, and perform lookup by barcodeId, or
    • Ensure the Android app sends a full UUID, or
    • Provide two endpoints: one for UUID ticketId and one for barcodeId.
  • Add proper validation + error handling so malformed IDs do not become HTTP 500:
    • Return 400 (bad request) for invalid identifiers, or 404 if not found, instead of “Unhandled exception”.
  • “Format the logs properly”:
    • Improve HTTP OUT logging (currently shows status= blank in the snippet) and standardize log layout (likely include method, path, status, tookMs, requestId consistently).
    • Potentially adjust GlobalExceptionHandler logging format to be consistent and non-noisy (e.g., avoid huge stack traces for expected client errors, log concise messages for validation errors).

CODE STATE:
No concrete repository changes were provided in the conversation, but the assistant proposed code-level direction.

Proposed (conceptual) changes discussed:

  • Controller change (accept String instead of UUID for check-in):
    @PostMapping("/api/tickets/{barcodeId}/checkin")
    public ResponseEntity<?> checkin(@PathVariable String barcodeId) { ... }
  • Service/repo to lookup by barcodeId:
    Optional<Ticket> findByBarcodeId(String barcodeId);

Referenced classes from logs (existing in project):

  • com.prarambh.act.one.ticketing.config.RequestLoggingFilter
  • com.prarambh.act.one.ticketing.config.GlobalExceptionHandler

RELEVANT CODE/DOCUMENTATION SNIPPETS:

  • Exception type and message (root cause):
    • org.springframework.web.method.annotation.MethodArgumentTypeMismatchException
    • Invalid UUID string: 2acc227e-716c-42fc
  • Endpoint being called:
    • POST /api/tickets/2acc227e-716c-42fc/checkin
  • Client:
    • ua="okhttp/4.12.0"

OTHER NOTES:

  • The assistant initially responded with an unrelated explanation about decompiled Spring bytecode; the user clarified the issue is a real runtime problem in a running app and that such an error should never occur. That decompiler explanation should be disregarded for the actual bug.
  • Primary issue is an API contract mismatch: server expects UUID but client sends a non-UUID barcode token. The durable fix is to align ID formats and handle invalid input gracefully (avoid 500).
  • Logging concerns remain unresolved; user explicitly asked to “Format the logs properly” and indicates current log output is unacceptable.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

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