Skip to content

fix: unify RequestOptions forwarding across access, membership, roles, and guild services#146

Open
Neziahtech wants to merge 1 commit into
Adamantine-guild:mainfrom
Neziahtech:main
Open

fix: unify RequestOptions forwarding across access, membership, roles, and guild services#146
Neziahtech wants to merge 1 commit into
Adamantine-guild:mainfrom
Neziahtech:main

Conversation

@Neziahtech

Copy link
Copy Markdown

closes #82

summary

Fixes inconsistent forwarding of per-request options (timeoutMs, retry, signal) to HttpClient across service methods. Some methods only forwarded a subset of options while others spread the full object, causing cancellation signals and timeout overrides to silently no-op in certain code paths.

Problem
HttpClient calls were inconsistent between services:
ts// access.service.ts — only forwards timeoutMs and retry
await this.http.get(url, { timeoutMs: options?.timeoutMs, retry: options?.retry });

// membership.service.ts — spreads the full options object
await this.http.get(url, { ...options });
This meant signal worked in some methods and was silently dropped in others, so AbortController-based cancellation was unreliable depending on which service method was called. There was also no single shared type for request options, so each service either redefined its own shape or imported conflicting versions.

What Changed

Added a single shared RequestOptions type in src/http/http.types.ts (re-exported from src/types/common.ts where applicable) covering timeoutMs, retry, and signal
Updated all public methods in access.service.ts, membership.service.ts, roles.service.ts, and guilds.service.ts to accept RequestOptions and forward it consistently to HttpClient via a single shared helper/spread rather than manually picking fields
Removed duplicate/conflicting local RequestOptions definitions and imports
No changes to public method names, signatures (beyond accepting the shared options type), or response types

Testing

Added cancellation tests (signal + AbortController) for access, membership, roles, and guild service methods
Added per-request timeoutMs override tests confirming the value reaches HttpClient
Added per-request retry override tests confirming the value reaches HttpClient
Verified existing tests for all four services still pass unchanged
Verified no duplicate RequestOptions imports remain (grep check across src/)

Notes

This is a forwarding/plumbing fix only — no behavioral changes to retry logic, timeout logic, or response shapes inside HttpClient itself
Future request-level options can now be added to RequestOptions once and will automatically propagate to all four services.

- Changed all service methods to use spread pattern for RequestOptions
- Added signal, timeoutMs, and retry options forwarding to access.service.ts
- Added signal forwarding to membership.service.ts
- Simplified roles.service.ts to always pass options to http.get
- Simplified guilds.service.ts to always pass options to http.get
- Updated checkAccessBatch to extract only request options (not batch options)
- Added comprehensive tests for signal and options forwarding
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.

Propagate request options consistently across service methods

1 participant