Skip to content

Fix/unify service request options#103

Open
nelly439 wants to merge 2 commits into
Adamantine-guild:mainfrom
nelly439:fix/unify-service-request-options
Open

Fix/unify service request options#103
nelly439 wants to merge 2 commits into
Adamantine-guild:mainfrom
nelly439:fix/unify-service-request-options

Conversation

@nelly439

Copy link
Copy Markdown
Contributor

Description

Batch fields leaked into HTTP layer
tests passes
closes #82

nelly439 added 2 commits June 25, 2026 20:58
- 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
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