Skip to content

v1.1.1 - Redundant-fetch performance pass

Choose a tag to compare

@FranprzDev FranprzDev released this 08 Nov 17:29
c64d62d

Second performance pass over the MCP server and API. Four focused changes, each measured before and after on a disposable local Postgres 18 (numbers below are local microbenchmarks, not production latency):

  • On-demand brief/document load in project auth (#183): AuthService.project() eager-loaded the full brief JSON and the latest document version on every call, though most callers only need the project row for the access check. The include is now opt-in; callers that read project.brief/project.document keep the identical shape. Project with ~45 KB brief + document version, 300 rounds: 1.382 ms / 75.5 KB -> 0.365 ms / 0.3 KB per call that skips the include. Same 404/access checks.
  • Scoped requirement-source validation in PATCH /brief (#184): the HTTP controller validated requirement sources by loading every message of the project; it now loads only the referenced ones (the MCP path was already scoped in #179) and skips the query entirely when the brief has no requirements. 1000 messages x 2 KB, 10 referenced sources: 9.72 ms / 2004 KB -> 0.58 ms / 20 KB per save. Validation semantics unchanged.
  • One project fetch per change-request call (#185): logChangeRequest and listChangeRequests each fetched the project twice per call; the access-checked project is now passed down instead. logChangeRequest 3.329 -> 2.995 ms (3 -> 2 project queries, 5 -> 4 total), listChangeRequests 3.254 -> 2.446 ms (-25%) (2 -> 1 project queries, 3 -> 2 total). One redundant project round trip removed per call.
  • Quote tools reuse the access-checked project (#186): getQuote fetched the project up to three times per call (once with the heavy eager include) and saveQuote twice; both now reuse the project already fetched and access-checked. Every role, ownership and share-link check is unchanged. getQuote: 2.770 ms -> 1.114 ms (-60%), project queries 3 -> 1, total queries 4 -> 2.

Full methodology and per-change details are in each PR body.