📌 Description
metricsApi.test.ts has a dedicated test, "passes the abort signal through", asserting fetchMetrics(controller.signal) forwards the signal to the underlying fetch call. anchorsApi.ts's fetchAnchors(signal?) and fetchAnchor(id, signal?), and settlementsApi.ts's fetchSettlements(options) (whose options.signal is documented as forwarded) and fetchSettlement(id, signal?), all accept and are expected to forward an AbortSignal the exact same way fetchMetrics does — each is used with a signal from useAsync's abortable loader elsewhere in the app (e.g. AnchorDetail, AnchorsPanel, SettlementDetail). Yet neither anchorsApi.test.ts nor settlementsApi.test.ts has any test asserting the signal actually reaches the outgoing fetch call for any of these functions — a regression that silently broke cancellation (e.g. a request no longer aborting on unmount/reload) would go unnoticed by either suite.
🧩 Requirements and context
- Add test coverage verifying that
fetchAnchors, fetchAnchor, registerAnchor/deregisterAnchor (where applicable), fetchSettlements, and fetchSettlement each forward a supplied AbortSignal to the underlying fetch call, mirroring metricsApi.test.ts's existing pattern for fetchMetrics.
- No production code changes are expected; this is purely closing a test-coverage gap on already-shipped signal-forwarding behavior.
🛠️ Suggested execution
- In
src/lib/anchorsApi.test.ts and src/lib/settlementsApi.test.ts, add a test per function that accepts a signal, passing a real AbortController's signal and asserting the mocked fetch's second argument's signal property is that same object — following metricsApi.test.ts's existing "passes the abort signal through" test as the template.
✅ Acceptance criteria
🔒 Security notes
No new attack surface; a test-coverage task on already-shipped request-cancellation plumbing.
📋 Guidelines
- Minimum 95% test coverage
- Clear documentation
- Timeframe: 96 hours
📌 Description
metricsApi.test.tshas a dedicated test, "passes the abort signal through", assertingfetchMetrics(controller.signal)forwards the signal to the underlyingfetchcall.anchorsApi.ts'sfetchAnchors(signal?)andfetchAnchor(id, signal?), andsettlementsApi.ts'sfetchSettlements(options)(whoseoptions.signalis documented as forwarded) andfetchSettlement(id, signal?), all accept and are expected to forward anAbortSignalthe exact same wayfetchMetricsdoes — each is used with a signal fromuseAsync's abortable loader elsewhere in the app (e.g.AnchorDetail,AnchorsPanel,SettlementDetail). Yet neitheranchorsApi.test.tsnorsettlementsApi.test.tshas any test asserting the signal actually reaches the outgoingfetchcall for any of these functions — a regression that silently broke cancellation (e.g. a request no longer aborting on unmount/reload) would go unnoticed by either suite.🧩 Requirements and context
fetchAnchors,fetchAnchor,registerAnchor/deregisterAnchor(where applicable),fetchSettlements, andfetchSettlementeach forward a suppliedAbortSignalto the underlyingfetchcall, mirroringmetricsApi.test.ts's existing pattern forfetchMetrics.🛠️ Suggested execution
src/lib/anchorsApi.test.tsandsrc/lib/settlementsApi.test.ts, add a test per function that accepts a signal, passing a realAbortController's signal and asserting the mockedfetch's second argument'ssignalproperty is that same object — followingmetricsApi.test.ts's existing "passes the abort signal through" test as the template.✅ Acceptance criteria
anchorsApi.ts's signal-accepting functions have test coverage asserting the signal reachesfetch.settlementsApi.ts's signal-accepting functions have test coverage asserting the signal reachesfetch.metricsApi.test.ts's existing test.🔒 Security notes
No new attack surface; a test-coverage task on already-shipped request-cancellation plumbing.
📋 Guidelines