Fix/unify service request options#103
Open
nelly439 wants to merge 2 commits into
Open
Conversation
- Remove the RequestOptions alias from src/http/http.types.ts (was Pick<HttpRequestOptions, 'timeoutMs' | 'signal'>). This type lived alongside the canonical RequestOptions in src/types/common.ts, causing every service to carry two import statements for the same identifier. - Expand the canonical RequestOptions in src/types/common.ts to include signal?: AbortSignal so it is a superset of the old http-layer alias. All per-request caller options (timeoutMs, retry, signal) now come from one place. - Fix all four service files (access, guilds, membership, roles) to import RequestOptions via a single 'import type' from ../types/common. The stale import from ../http/http.types has been removed from each. - Add 'no-duplicate-imports' ESLint rule (includeExports: true) so any future file that imports the same specifier from two paths is caught during linting. - Add a 'ci' npm script (typecheck && lint) that CI can use to verify both type correctness and import hygiene in one command. No public method signatures or runtime behaviour have changed.
- Add pickRequestOptions() helper in src/types/common.ts to safely extract only timeoutMs, retry, and signal from RequestOptions - Fix checkAccess/checkRoleAccess in access.service.ts to forward signal and avoid leaking batch-specific fields via ...options spread - Fix getMembership in membership.service.ts to forward signal (was missing from timeoutMs/retry-only forwarding) - Unify roles.service.ts and guilds.service.ts to use pickRequestOptions instead of passing raw options object or using ternary - Add tests for signal forwarding, combined options, and batch-key non-leakage in access.service.test.ts and guilds.service.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Batch fields leaked into HTTP layer
tests passes
closes #82