Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions documentation/architecture/decisions/D616.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
## D616 — Remove five dead and redundant client API methods

**Issue:** #1316 · S16, found by #1165's audit (areas 6 and 7). **Frontend only; no migration.**

### What was decided

Five client methods in `frontend/src/lib/api.js` were identified during #1165's audit of uncalled API methods. None of them are called by any screen in `frontend/src`, and each is either dead or duplicates an existing method that is actively in use:

1. **`emailSendDeal`**: Dead route. Has no Worker route in production (returns 404). Its missing status was recorded in `scripts/api-drift-baseline.json` as `POST /api/email/send-deal`. The deal room invite flow already handles emailing invitations.
2. **`adminVoidContract`**: Dead method. Sent no reason payload, causing the route to consistently reject requests with 400. `adminVoidContractWithReason` is the active method used by `AdminPage.jsx`.
3. **`fundLPs`**: Redundant alias. Called `GET /funds/:id/lps`, which duplicates `fundsLpsList` already utilized across five screens.
4. **`fundsListByStatus`**: Redundant alias. Implemented as `fundsList` with an optional status filter (`/funds?status=...`), identical in behavior to `fundsList` where no screens filter by status.
5. **`trustSanctions`**: Redundant alias. Identical endpoint to `trustListSanctions` (`/trust/sanctions`), which is the canonical method used by `/trust` in `TrustCenterPage.jsx`.

### Retained near-twins

As specified in #1316, two near-twins are preserved:
- `fundGet`: the research fund read, which is actively in use.
- `fundsGet`: retained for the fund page read in area 6 design.

### Impact on #1165 uncalled methods count

Audit #1165 originally identified 155 uncalled API client methods across 8 areas. Removing these five dead and redundant methods reduces that count by five (down to 150), eliminating dead routes and aliases from areas 6 and 7 without requiring new UI surfaces or backend modifications.

### Drift baseline update

The baseline debt ledger `scripts/api-drift-baseline.json` removed `"POST /api/email/send-deal"` from `missing_route`, reducing known pre-existing drift entries from 7 to 6.

### Verified

- `node scripts/check-api-drift.mjs` confirms 1,808 examined SPA calls (5 fewer), 0 new drift, and baseline ledger reduced to 6 entries.
- `node scripts/check-decision-ids.mjs` validates D616 conforms to decision ID conventions.
- `git grep` verifies zero occurrences of `emailSendDeal`, `fundLPs`, `fundsListByStatus`, `trustSanctions`, or `adminVoidContract` in `frontend/src`.
- No tests pinned the removed methods by name; existing test suites continue to pass.
5 changes: 0 additions & 5 deletions frontend/src/lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -2028,7 +2028,6 @@ export const api = {
body: JSON.stringify({ publishable_key: publishableKey }),
}),

adminVoidContract: (uid) => request(`/admin/contracts/${uid}/void`, { method: 'POST' }),
adminDownloadContractUrl: (uid) => `/api/admin/contracts/${uid}/download`,
adminIssueContractShareLink: (uid, ttl_seconds = 300) =>
request(`/admin/contracts/${uid}/download-url?ttl_seconds=${ttl_seconds}`, { method: 'POST' }),
Expand Down Expand Up @@ -3043,11 +3042,9 @@ export const api = {
infraReembedMetrics: (hours = 24) => request(`/infra/reembed-metrics?hours=${hours}`),

// ---------- Funds & LPs ----------
fundsListByStatus: (status) => request(`/funds${status ? `?status=${status}` : ''}`),
fundGet: (id) => request(`/funds/${id}`),
fundCreate: (data) => request('/funds', { method: 'POST', body: JSON.stringify(data) }),
fundUpdate: (id, data) => request(`/funds/${id}`, { method: 'PATCH', body: JSON.stringify(data) }),
fundLPs: (id) => request(`/funds/${id}/lps`),
fundAddLP: (id, data) => request(`/funds/${id}/lps`, { method: 'POST', body: JSON.stringify(data) }),
fundCapitalCall: (id, amount, note) =>
request(`/funds/${id}/capital-call`, { method: 'POST', body: JSON.stringify({ amount, note }) }),
Expand Down Expand Up @@ -3156,7 +3153,6 @@ export const api = {
request(`/funds/distributions/${id}/mark-paid`, { method: 'POST', body: JSON.stringify({}) }),

// ---------- Branded email (Gmail) ----------
emailSendDeal: (data) => request('/email/send-deal', { method: 'POST', body: JSON.stringify(data) }),
emailSendReferralInvites: (contacts, custom_message) =>
request('/email/send-referral-invites', {
method: 'POST',
Expand Down Expand Up @@ -3940,7 +3936,6 @@ export const api = {
request(`/trust/intro/status?founder=${encodeURIComponent(founder_user_id)}`),
trustObligationStart: (key) =>
request(`/trust/obligation/${encodeURIComponent(key)}/start`, { method: 'POST' }),
trustSanctions: () => request('/trust/sanctions'),
trustMySigningUrl: (envelope_uuid) =>
request(`/trust/agreements/${encodeURIComponent(envelope_uuid)}/my_signing_url`),
// Trust Center v2's per-agreement timeline, fetched when a row is expanded.
Expand Down
1 change: 0 additions & 1 deletion scripts/api-drift-baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"GET /api/capital/lp-portal",
"GET /api/dashboard/stats",
"GET /api/pipeline/votes/leaderboard",
"POST /api/email/send-deal",
"POST /api/legal/incorporate",
"POST /api/legal/spinout/:p"
],
Expand Down