Skip to content

perf(api): cap or paginate the /analysis/{id}/architecture payload #508

Open

Description

@parthrohit22

Problem

GET /analysis/{repository_id}/architecture returned about 9.6 MB (343 nodes, 13,834 edges) for PARTHA's own repository. The frontend now avoids rendering all of it (#502), but the full payload is still downloaded and parsed on every visit.

Idea

Keep the sealed-snapshot contract intact while letting clients ask for less: for example a default summary (nodes plus an edge count and per-type totals) and a separate endpoint or query parameters to fetch the edges for one node or one page.

Acceptance criteria

  • Default response size on the repository above drops substantially.
  • Full data is still reachable and consistent with the snapshot (same hash, same revision identity).
  • The OpenAPI contract is regenerated and drift-checked (npm --prefix apps/frontend run generate:api-contract -- --check).
  • Backend tests added; existing owner-scoping behaviour unchanged (another owner still gets 404).

Pointers

apps/backend/app/api/routes/analysis.py, docs/CAPABILITIES.md.

Activity

  1. SHAURYAKSHARMA24 commented on Oct 8, 2026

    @SHAURYAKSHARMA24
    Collaborator

    Audit F11 remediation and remaining compatibility decision

    PR #550 now bounds endpoint SQL parameters and omits nested symbol keys unused by module inventory. All 28 architecture/authentication-explanation tests pass. The public response is unchanged: an 88-node/640-edge disposable fixture remains 399,311 bytes and its JSON is identical before/after. PR #554 adds measured browser coverage, #549 finer extraction progress, and #558 an explicit edge-type filter. No evidence is silently capped.

    The default response-size acceptance criterion is still open. Existing consumers expect complete ArchitectureResponse.nodes and .edges; silently replacing either with a partial set would be a breaking contract change, reserved to Parth by the remediation request.

    Options:

    • Retain the complete legacy endpoint and approve an additive versioned summary/page contract with snapshot/revision identity, totals and explicit continuation; move the frontend to that contract. Recommended compatibility path.
    • Approve a breaking default summary response and coordinate every consumer plus API documentation.
    • Retain the complete response for the supervised beta, document the size limit, and defer the default-contract change.

    Recommendation: the additive compatibility path, followed by representative large-repository benchmarks. The present PR is intentionally partial and does not close #508. No snapshot schema/hash change is proposed. Approval is needed for the default-contract transition, not for the internal fixes already implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions