refactor(core)!: drop the deprecated ThrottleOptions.scope alias (canonical pool) - #490
Merged
Merged
Conversation
…onical pool) Extracts the throttle scope→pool slice from #470 (the contract-freeze sweep) into a standalone PR so it can land on its own. `pool` has been the canonical name since the P2 rename; `scope` lingered as a `@deprecated` back-compat alias with `pool ?? scope` fallback reads. This is the hard break (P19): remove the alias field, drop the three fallback reads (seam/resilience/engine), and convert the remaining deprecated `scope: 'host'| 'stitch'` throttle examples across tests + docs to `pool`. The alias-parity test collapses to the canonical spelling; a gen-openapi regression test pins that the emitted TODO uses `pool`, not `scope`. Cache/cookie/oauth tenancy `scope` (`'principal'|'app'`) is a DIFFERENT axis and is untouched. No contract-baseline change — R4 skips `@deprecated` fields, so there was no baselined violation to clear. BREAKING CHANGE: `ThrottleOptions.scope` (the `@deprecated` alias of `pool`, `'stitch'|'host'`) is removed. Use `pool`. Tenancy `scope` on cache / cookie / oauth is unaffected. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
rejifald
enabled auto-merge (squash)
July 24, 2026 09:21
rejifald
added a commit
that referenced
this pull request
Aug 4, 2026
`claude/download-consolidate` was cut 2026-07-06 with a 2026-07-23 merge base. Main has since landed the pre-GA breaking sweep, so replaying the seven commits was only half the work — the other half is what the ratchets then demanded. Core - `download`'s `interpret` composes `verdictOf(res, cfg)` (ADR 0022 Decision 4) and yields `data`, not `value`. The M1 complete-body rule sits AFTER the composed verdict, as the surface's own, and now reads `verdict.accept`: `classifyStatus` consults it only at `>= 400`, so without that read a caller who declared `206` NORMAL would still be rejected — the surface overriding an explicit declaration rather than ruling where none was made. Second test in download-stray-206.spec.ts pins it. - `rebuildError`'s cause-carry lands on top of main's body/url arm instead of replacing it. Test rig + specs - `throttle-host-pooling` keeps the deterministic manual-clock rewrite (the wall-clock flake fix) minus its `scope`-alias half — #490 removed the alias. ADR 0023 Decision 1 ratified exactly the 500ms in-process spacing it asserts. - Rig duration fields drop the `Ms` suffix (D3/P17), matching main's own `stream.chunkDelay`: `ttfbDelayMs` → `ttfbDelay`, `chunkDelayMs` → `chunkDelay`. The rig keeps main's `retryAfterSeconds` (the header's native unit) over the branch's `retryAfter`; four existing specs already depend on it. - Spec config: auth moved to `stitchapi/auth` (ADR 0021) and `apiKey` takes `secret` (#580); `retry.baseMs`/`baseDelay` fold into `retry.backoff.base` (#513); `respectRetryAfter` → `retry.respect` (#608); `AdapterProgress.phase` → `direction`. @stitchapi/download - `DownloadBatch.cancel`/`cancelAll` fold into `cancel(id?)` — R8 landed after this branch was cut and flags the shared prefix (P24). For a verb the optional parameter IS the collapse; an envelope would be the same pair one level deeper. - `hooks` is built unannotated so `onError` infers REQUIRED: the slot is `AtLeastOne<Hooks>` now (P20, #507), which an all-optional annotation cannot satisfy. - Version + vitest to the rc.7 lockstep; lockfile regenerated from main's. - classify.ts and the README no longer claim the engine drops the transport cause — this branch's own core fix carries it through. The hook seam stays: it is strictly wider (it also catches a thrown non-`Error`). Verify: 40/40 workspace projects green (core 1460 passed, download 15/15); check:lint / types / types-d / exports / exports:companions / contract / unknown-keys / release / docs-links / format all clean; core size 23.45 gzip (budget 23.50) and 20.87 for `import { stitch }` (20.90), @stitchapi/download 2.45/2.65 KB; `yakir check` both tiers 0 drift. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
rejifald
added a commit
that referenced
this pull request
Aug 4, 2026
`claude/download-consolidate` was cut 2026-07-06 with a 2026-07-23 merge base. Main has since landed the pre-GA breaking sweep, so replaying the seven commits was only half the work — the other half is what the ratchets then demanded. Core - `download`'s `interpret` composes `verdictOf(res, cfg)` (ADR 0022 Decision 4) and yields `data`, not `value`. The M1 complete-body rule sits AFTER the composed verdict, as the surface's own, and now reads `verdict.accept`: `classifyStatus` consults it only at `>= 400`, so without that read a caller who declared `206` NORMAL would still be rejected — the surface overriding an explicit declaration rather than ruling where none was made. Second test in download-stray-206.spec.ts pins it. - `rebuildError`'s cause-carry lands on top of main's body/url arm instead of replacing it. Test rig + specs - `throttle-host-pooling` keeps the deterministic manual-clock rewrite (the wall-clock flake fix) minus its `scope`-alias half — #490 removed the alias. ADR 0023 Decision 1 ratified exactly the 500ms in-process spacing it asserts. - Rig duration fields drop the `Ms` suffix (D3/P17), matching main's own `stream.chunkDelay`: `ttfbDelayMs` → `ttfbDelay`, `chunkDelayMs` → `chunkDelay`. The rig keeps main's `retryAfterSeconds` (the header's native unit) over the branch's `retryAfter`; four existing specs already depend on it. - Spec config: auth moved to `stitchapi/auth` (ADR 0021) and `apiKey` takes `secret` (#580); `retry.baseMs`/`baseDelay` fold into `retry.backoff.base` (#513); `respectRetryAfter` → `retry.respect` (#608); `AdapterProgress.phase` → `direction`. @stitchapi/download - `DownloadBatch.cancel`/`cancelAll` fold into `cancel(id?)` — R8 landed after this branch was cut and flags the shared prefix (P24). For a verb the optional parameter IS the collapse; an envelope would be the same pair one level deeper. - `hooks` is built unannotated so `onError` infers REQUIRED: the slot is `AtLeastOne<Hooks>` now (P20, #507), which an all-optional annotation cannot satisfy. - Version + vitest to the rc.7 lockstep; lockfile regenerated from main's. - classify.ts and the README no longer claim the engine drops the transport cause — this branch's own core fix carries it through. The hook seam stays: it is strictly wider (it also catches a thrown non-`Error`). Verify: 40/40 workspace projects green (core 1460 passed, download 15/15); check:lint / types / types-d / exports / exports:companions / contract / unknown-keys / release / docs-links / format all clean; core size 23.45 gzip (budget 23.50) and 20.87 for `import { stitch }` (20.90), @stitchapi/download 2.45/2.65 KB; `yakir check` both tiers 0 drift. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
What
Extracts the throttle
scope→poolslice from #470 (the contract-freeze sweep) into a standalone, independently-mergeable PR.poolhas been the canonicalThrottleOptionsfield since the P2 rename;scopelingered as a@deprecatedback-compat alias withpool ?? scopefallback reads. This is the hard break (P19): the alias is removed.Changes
@deprecated ThrottleOptions.scopefield (types.ts) and trim itspoolJSDoc.?? scopefallback reads —seam.ts,resilience.ts,engine.tsnow readpoolonly (and lose theireslint-disable no-deprecated).scope: 'host'|'stitch'throttle examples across tests + docs topool. The alias-parity test inthrottle-host-pooling.spec.tscollapses to the canonical spelling.gen-openapicase pins that the emitted throttle TODO usespool, notscope.scopealias still exists (the P6/*Ms/rateLimitaliases they sit beside are untouched — not part of this slice).Not in scope
check-contract's R4 (scope: 'stitch'|'host') skips@deprecatedfields, so the alias was never a baselined violation. Ratchet stays green (5 known, 0 new).docs/GAP-AUDIT.md,docs/adr/0002-*still reference the old spelling as a point-in-time record; refactor(api)!: contract freeze — hard-break sweep of the entire published surface #470 didn't touch them either.Verification — all gates green
check:types·check:lint·check:format(pre-commit) ·check:types-d(tsd) ·test(core 1213 + openapi 19 incl. the new case) ·check:exports·build-docs(full twoslash) (pre-push) ·check:contract.Relation to #470 / #489
Independent off
main, and disjoint from #489 (query→document). After both land, #470 rebases to drop these two slices.🤖 Generated with Claude Code