refactor: extract PromiseGuard and DebouncerMap shared utilities#6566
Merged
Conversation
Extract duplicated concurrency patterns into reusable utilities: - PromiseGuard: deduplicates concurrent async init (parser, embedding, git-service) - Debouncer: single-key debounce (HookManager) - DebouncerMap: keyed debounce with limit enforcement (DaemonServer, handlers) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
noanflaherty
added a commit
that referenced
this pull request
May 12, 2026
Follow-up to the catalog-driven auth refactor (#30411 in this same branch + #6566 on the web side). The codebase has been using two words for the same concept: - User-facing UI: 'Platform (managed by Vellum)' - Auth-type wire value: 'platform' (AuthType.platform on Swift, "platform" in TS connection JSON) - Internal symbols: MANAGED_PROVIDER_META, supportsManagedAuth, isManagedCapable, managedCapableProviders, managed-proxy/ directory This commit aligns the internal symbols with the user-facing 'platform' terminology so future readers don't have to mentally translate. Renames ------- Symbols (word-boundary-safe sed across .ts/.swift/.tsx/.json): MANAGED_PROVIDER_META -> PLATFORM_PROVIDER_META supportsManagedAuth -> supportsPlatformAuth isManagedCapable -> isPlatformCapable managedCapableProviders -> platformCapableProviders Files / paths: assistant/src/providers/managed-proxy/ -> .../platform-proxy/ assistant/src/__tests__/managed-proxy-context.test.ts -> .../platform-proxy-context.test.ts assistant/src/__tests__/provider-managed-proxy-integration.test.ts -> .../provider-platform-proxy-integration.test.ts assistant/src/__tests__/secret-routes-managed-proxy.test.ts -> .../secret-routes-platform-proxy.test.ts Import-path string substitutions inside source files: './managed-proxy/...' -> './platform-proxy/...' What is NOT renamed (out of scope) ---------------------------------- * User-facing copy 'Platform (managed by Vellum)' — that's the UX label disambiguating what 'Platform' means; renaming would degrade clarity for end users. * Runtime routing-source discriminator string 'managed-proxy' — used in ProviderRoutingSource union type and several runtime checks. Leaving for a separate follow-up if Noa wants it tightened. * MANAGED_USAGE_LIMIT error code — wire-format contract with the macOS/iOS clients; out-of-scope structural rename. * ManagedProxyCredentials / ManagedProxyContext type names — left for a separate follow-up. Test ---- * bunx tsc --noEmit on assistant/ — clean. * bun test platform-proxy-context, provider-platform-proxy-integration, secret-routes-platform-proxy, llm-catalog-parity, satellite-connection-routing, credential-security-invariants — 110 tests pass. * bun run scripts/sync-llm-catalog.ts --check — clean.
credence-the-bot Bot
pushed a commit
that referenced
this pull request
May 13, 2026
Follow-up to the catalog-driven auth refactor (#30411 in this same branch + #6566 on the web side). The codebase has been using two words for the same concept: - User-facing UI: 'Platform (managed by Vellum)' - Auth-type wire value: 'platform' (AuthType.platform on Swift, "platform" in TS connection JSON) - Internal symbols: MANAGED_PROVIDER_META, supportsManagedAuth, isManagedCapable, managedCapableProviders, managed-proxy/ directory This commit aligns the internal symbols with the user-facing 'platform' terminology so future readers don't have to mentally translate. Renames ------- Symbols (word-boundary-safe sed across .ts/.swift/.tsx/.json): MANAGED_PROVIDER_META -> PLATFORM_PROVIDER_META supportsManagedAuth -> supportsPlatformAuth isManagedCapable -> isPlatformCapable managedCapableProviders -> platformCapableProviders Files / paths: assistant/src/providers/managed-proxy/ -> .../platform-proxy/ assistant/src/__tests__/managed-proxy-context.test.ts -> .../platform-proxy-context.test.ts assistant/src/__tests__/provider-managed-proxy-integration.test.ts -> .../provider-platform-proxy-integration.test.ts assistant/src/__tests__/secret-routes-managed-proxy.test.ts -> .../secret-routes-platform-proxy.test.ts Import-path string substitutions inside source files: './managed-proxy/...' -> './platform-proxy/...' What is NOT renamed (out of scope) ---------------------------------- * User-facing copy 'Platform (managed by Vellum)' — that's the UX label disambiguating what 'Platform' means; renaming would degrade clarity for end users. * Runtime routing-source discriminator string 'managed-proxy' — used in ProviderRoutingSource union type and several runtime checks. Leaving for a separate follow-up if Noa wants it tightened. * MANAGED_USAGE_LIMIT error code — wire-format contract with the macOS/iOS clients; out-of-scope structural rename. * ManagedProxyCredentials / ManagedProxyContext type names — left for a separate follow-up. Test ---- * bunx tsc --noEmit on assistant/ — clean. * bun test platform-proxy-context, provider-platform-proxy-integration, secret-routes-platform-proxy, llm-catalog-parity, satellite-connection-routing, credential-security-invariants — 110 tests pass. * bun run scripts/sync-llm-catalog.ts --check — clean.
credence-the-bot Bot
pushed a commit
that referenced
this pull request
May 13, 2026
Follow-up to the catalog-driven auth refactor (#30411 in this same branch + #6566 on the web side). The codebase has been using two words for the same concept: - User-facing UI: 'Platform (managed by Vellum)' - Auth-type wire value: 'platform' (AuthType.platform on Swift, "platform" in TS connection JSON) - Internal symbols: MANAGED_PROVIDER_META, supportsManagedAuth, isManagedCapable, managedCapableProviders, managed-proxy/ directory This commit aligns the internal symbols with the user-facing 'platform' terminology so future readers don't have to mentally translate. Renames ------- Symbols (word-boundary-safe sed across .ts/.swift/.tsx/.json): MANAGED_PROVIDER_META -> PLATFORM_PROVIDER_META supportsManagedAuth -> supportsPlatformAuth isManagedCapable -> isPlatformCapable managedCapableProviders -> platformCapableProviders Files / paths: assistant/src/providers/managed-proxy/ -> .../platform-proxy/ assistant/src/__tests__/managed-proxy-context.test.ts -> .../platform-proxy-context.test.ts assistant/src/__tests__/provider-managed-proxy-integration.test.ts -> .../provider-platform-proxy-integration.test.ts assistant/src/__tests__/secret-routes-managed-proxy.test.ts -> .../secret-routes-platform-proxy.test.ts Import-path string substitutions inside source files: './managed-proxy/...' -> './platform-proxy/...' What is NOT renamed (out of scope) ---------------------------------- * User-facing copy 'Platform (managed by Vellum)' — that's the UX label disambiguating what 'Platform' means; renaming would degrade clarity for end users. * Runtime routing-source discriminator string 'managed-proxy' — used in ProviderRoutingSource union type and several runtime checks. Leaving for a separate follow-up if Noa wants it tightened. * MANAGED_USAGE_LIMIT error code — wire-format contract with the macOS/iOS clients; out-of-scope structural rename. * ManagedProxyCredentials / ManagedProxyContext type names — left for a separate follow-up. Test ---- * bunx tsc --noEmit on assistant/ — clean. * bun test platform-proxy-context, provider-platform-proxy-integration, secret-routes-platform-proxy, llm-catalog-parity, satellite-connection-routing, credential-security-invariants — 110 tests pass. * bun run scripts/sync-llm-catalog.ts --check — clean.
noanflaherty
added a commit
that referenced
this pull request
May 13, 2026
…#30432) * refactor(providers): rename managed→platform for catalog auth symbols Follow-up to the catalog-driven auth refactor (#30411 in this same branch + #6566 on the web side). The codebase has been using two words for the same concept: - User-facing UI: 'Platform (managed by Vellum)' - Auth-type wire value: 'platform' (AuthType.platform on Swift, "platform" in TS connection JSON) - Internal symbols: MANAGED_PROVIDER_META, supportsManagedAuth, isManagedCapable, managedCapableProviders, managed-proxy/ directory This commit aligns the internal symbols with the user-facing 'platform' terminology so future readers don't have to mentally translate. Renames ------- Symbols (word-boundary-safe sed across .ts/.swift/.tsx/.json): MANAGED_PROVIDER_META -> PLATFORM_PROVIDER_META supportsManagedAuth -> supportsPlatformAuth isManagedCapable -> isPlatformCapable managedCapableProviders -> platformCapableProviders Files / paths: assistant/src/providers/managed-proxy/ -> .../platform-proxy/ assistant/src/__tests__/managed-proxy-context.test.ts -> .../platform-proxy-context.test.ts assistant/src/__tests__/provider-managed-proxy-integration.test.ts -> .../provider-platform-proxy-integration.test.ts assistant/src/__tests__/secret-routes-managed-proxy.test.ts -> .../secret-routes-platform-proxy.test.ts Import-path string substitutions inside source files: './managed-proxy/...' -> './platform-proxy/...' What is NOT renamed (out of scope) ---------------------------------- * User-facing copy 'Platform (managed by Vellum)' — that's the UX label disambiguating what 'Platform' means; renaming would degrade clarity for end users. * Runtime routing-source discriminator string 'managed-proxy' — used in ProviderRoutingSource union type and several runtime checks. Leaving for a separate follow-up if Noa wants it tightened. * MANAGED_USAGE_LIMIT error code — wire-format contract with the macOS/iOS clients; out-of-scope structural rename. * ManagedProxyCredentials / ManagedProxyContext type names — left for a separate follow-up. Test ---- * bunx tsc --noEmit on assistant/ — clean. * bun test platform-proxy-context, provider-platform-proxy-integration, secret-routes-platform-proxy, llm-catalog-parity, satellite-connection-routing, credential-security-invariants — 110 tests pass. * bun run scripts/sync-llm-catalog.ts --check — clean. * style(providers): re-sort imports after managed→platform rename The rename in the parent commit shifted import path prefixes (`managed-proxy/*` → `platform-proxy/*`), which puts them later in the alphabetical order simple-import-sort enforces. * assistant/src/__tests__/llm-catalog-parity.test.ts: swap PROVIDER_CATALOG / PLATFORM_PROVIDER_META order so `model-catalog` (m) precedes `platform-proxy/constants` (p). * assistant/src/providers/registry.ts: move the `./platform-proxy/context.js` import block after `./model-intents.js` for the same reason. Test ---- * bunx tsc --noEmit clean. * No behavior change. * chore(openapi): regenerate spec to include /v1/skills/import The skills-import route handler shipped in #29915 but openapi.yaml was not regenerated as part of that merge. Rebasing #30432 onto main surfaces the staleness via the OpenAPI Spec Check job. Pure regen — no code change in this commit. --------- Co-authored-by: credence-the-bot[bot] <226841098+credence-the-bot[bot]@users.noreply.github.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.
Summary
PromiseGuard<T>utility that deduplicates concurrent async factory calls with automatic clear-on-failure, replacing hand-rolledinitPromisepatterns inparser.ts,embedding-local.ts, andgit-service.tsDebouncer(single-key) andDebouncerMap(multi-key with limit enforcement and protected key prefixes) utilities, replacing manualsetTimeout/clearTimeoutpatterns inHookManager,DaemonServer, and all handler filesOriginal prompt
Extract shared utility patterns (PromiseGuard, Debounce) — Promise guard logic is duplicated in LazyTool, sessionCreating map, and elsewhere. Debounce patterns duplicated in HookManager and DaemonServer. Extract to shared utilities.
🤖 Generated with Claude Code