Skip to content

docs: add API client pipeline and server-side pagination conventions#9

Closed
mrizzi wants to merge 1 commit into
mainfrom
docs/add-api-pagination-conventions
Closed

docs: add API client pipeline and server-side pagination conventions#9
mrizzi wants to merge 1 commit into
mainfrom
docs/add-api-pagination-conventions

Conversation

@mrizzi
Copy link
Copy Markdown
Owner

@mrizzi mrizzi commented May 15, 2026

Summary

  • Document the API client generation pipeline (generated vs manual types, regeneration checklist, legacy REST helpers)
  • Document the server-side pagination data flow (request path with total: true opt-in, response path with ?? 0 nullable guard)
  • Add pagination constants reference and Axios interceptor architecture
  • Add a 9-step checklist for adapting to upstream API changes

These sections close a documentation gap exposed when adapting to upstream pagination changes (guacsec/trustify#2338, guacsec/trustify#2351): reading only CONVENTIONS.md was insufficient to correctly trace the data flow or know where to add total: true per page.

Test plan

🤖 Generated with Claude Code

Summary by Sourcery

Document the frontend API client generation pipeline and server-side pagination data flow to clarify how list pages interact with the backend and where pagination-related flags must be applied.

Documentation:

  • Expand CONVENTIONS.md with sections covering generated vs manual API types, client regeneration steps, legacy REST helpers, and Axios interceptor behavior.
  • Add detailed documentation of server-side pagination request/response flow, including the total: true opt-in, nullable total handling, pagination constants, and a checklist for adapting to upstream API changes.

Document the pagination data flow (request and response paths), the
generated-vs-manual type distinction, the client regeneration checklist,
and a step-by-step guide for adapting to upstream API changes.

These sections close a documentation gap exposed when adapting to
upstream pagination changes (guacsec/trustify#2338, #2351): an AI or
new contributor reading only CONVENTIONS.md could not have correctly
traced the data flow or known where to add `total: true` per page.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Assisted-by: Claude Code
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented May 15, 2026

Reviewer's Guide

Documents the API client generation pipeline, server-side pagination data flow, and related conventions to guide future adaptations to upstream API changes, all within CONVENTIONS.md.

File-Level Changes

Change Details Files
Document the API client generation pipeline and division between generated and manual types, including regeneration workflow and legacy REST helpers.
  • Explain how OpenAPI spec in client/openapi/trustd.yaml is used to generate API types and SDK functions and forbid manual edits to generated output.
  • Define the separation of concerns between generated types, manual request/response models, and query hooks that bridge them.
  • Add a step-by-step checklist for regenerating the client and updating types/hooks after backend spec changes.
  • Clarify the role and limitations of legacy REST helpers and require new paginated endpoints to use the requestParamsQuery path.
CONVENTIONS.md
Describe the server-side pagination request/response flows and establish conventions for total handling and pagination constants.
  • Add a request flow diagram from context providers through getHubRequestParams and requestParamsQuery to generated SDK calls, emphasizing that total: true must be added per page.
  • Add a response flow diagram showing normalization in query hooks, the ?? 0 nullable guard for total, and propagation into table pagination components.
  • Document pagination-related constants, including MAX_ITEMS_PER_PAGE, default itemsPerPage, and 1-indexed pageNumber to offset conversion.
CONVENTIONS.md
Document Axios interceptor behavior and a checklist for adapting to upstream API changes.
  • Summarize existing Axios response interceptors for read-only detection and auth token refresh and how errors propagate via query hooks.
  • Provide a 9-step checklist for handling OpenAPI spec changes, covering regeneration, query/context updates, constants, interceptors, and manual types.
  • Clarify where to add new centralized HTTP error handling via initInterceptors().
CONVENTIONS.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The “Regenerating the client” and “Adapting to upstream API changes” sections overlap quite a bit; consider either cross‑referencing them or deduplicating the shared steps so there’s a single authoritative checklist for regeneration vs. a shorter delta for upstream changes.
  • In the pagination request flow, the note that each context provider MUST add total: true is critical; it may be worth explicitly calling out an example context file or a small code snippet showing the pattern so future additions are less likely to omit it.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The “Regenerating the client” and “Adapting to upstream API changes” sections overlap quite a bit; consider either cross‑referencing them or deduplicating the shared steps so there’s a single authoritative checklist for regeneration vs. a shorter delta for upstream changes.
- In the pagination request flow, the note that each context provider MUST add `total: true` is critical; it may be worth explicitly calling out an example context file or a small code snippet showing the pattern so future additions are less likely to omit it.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@mrizzi mrizzi closed this May 15, 2026
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