Skip to content

fix(topograph): the 'topology' endpoint to return '102 Processing' when the request has't completed yet#192

Merged
dmitsh merged 1 commit into
mainfrom
ds-topo
Dec 11, 2025
Merged

fix(topograph): the 'topology' endpoint to return '102 Processing' when the request has't completed yet#192
dmitsh merged 1 commit into
mainfrom
ds-topo

Conversation

@dmitsh
Copy link
Copy Markdown
Collaborator

@dmitsh dmitsh commented Dec 11, 2025

No description provided.

…en the request has't completed yet

Signed-off-by: Dmitry Shmulevich <dshmulevich@nvidia.com>
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Dec 11, 2025

Greptile Overview

Greptile Summary

Changed the /v1/topology endpoint to return HTTP status 102 Processing instead of 202 Accepted when a request is still in progress, providing better semantic clarity about request state.

  • Replaced http.StatusAccepted (202) with http.StatusProcessing (102) for pending requests in trailing_delay_queue.go:132
  • Updated error messages to be more descriptive: "request ID %s has not completed yet" vs "request ID %s not found"
  • Updated README.md documentation to reflect the correct status codes and their meanings

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is a straightforward improvement that uses a more semantically correct HTTP status code (102 Processing instead of 202 Accepted). The constant http.StatusProcessing is a standard Go library constant. The change improves API clarity without altering behavior or introducing breaking changes.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
README.md 5/5 Updated documentation to reflect proper HTTP status codes (102 Processing, 404 Not Found) for the topology endpoint
pkg/server/trailing_delay_queue.go 5/5 Changed status from 202 Accepted to 102 Processing for in-progress requests; improved error messages

Sequence Diagram

sequenceDiagram
    participant Client
    participant HTTPServer
    participant TrailingDelayQueue
    participant Handler

    Note over Client,Handler: Initial Request
    Client->>HTTPServer: POST /v1/generate (topology request)
    HTTPServer->>TrailingDelayQueue: Submit(item)
    TrailingDelayQueue->>TrailingDelayQueue: Store item, generate UID
    TrailingDelayQueue-->>HTTPServer: Return UID
    HTTPServer-->>Client: 202 Accepted (UID)

    Note over Client,Handler: Polling for Results (Before This PR)
    Client->>HTTPServer: GET /v1/topology?uid=xxx
    HTTPServer->>TrailingDelayQueue: Get(uid)
    alt Request still processing
        TrailingDelayQueue-->>HTTPServer: Status: 202 Accepted
        HTTPServer-->>Client: 202 Accepted (unclear state)
    else Request not found
        TrailingDelayQueue-->>HTTPServer: Status: 404 Not Found
        HTTPServer-->>Client: 404 Not Found
    end

    Note over Client,Handler: Polling for Results (After This PR)
    Client->>HTTPServer: GET /v1/topology?uid=xxx
    HTTPServer->>TrailingDelayQueue: Get(uid)
    alt Request still processing (current UID)
        TrailingDelayQueue-->>HTTPServer: Status: 102 Processing
        HTTPServer-->>Client: 102 Processing (request not completed yet)
    else Request not found (invalid UID)
        TrailingDelayQueue-->>HTTPServer: Status: 404 Not Found
        HTTPServer-->>Client: 404 Not Found (request ID not found)
    else Request completed successfully
        TrailingDelayQueue->>Handler: Execute handler
        Handler-->>TrailingDelayQueue: Result
        TrailingDelayQueue-->>HTTPServer: Status: 200 OK + Result
        HTTPServer-->>Client: 200 OK + Topology Data
    end
Loading

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@dmitsh dmitsh merged commit f1027fd into main Dec 11, 2025
3 of 4 checks passed
@dmitsh dmitsh deleted the ds-topo branch December 11, 2025 21:09
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.

1 participant