fix: proxy auth cleanup & lockfile hygiene#345
Merged
Conversation
Creates src/auth.ts with a shared buildAuthHeaders() utility that replaces the duplicated auth header logic in both StitchToolClient (client.ts) and StitchProxy (proxy/client.ts). The shared function includes a defensive throw when neither apiKey nor accessToken is provided, removing the unsafe config.apiKey! non-null assertion from PR #314. Follow-up to #314.
PR #253 (ADK support) added @google/adk and @google/genai to devDependencies and updated package-lock.json, but did not run bun install to update bun.lock. Since CI uses bun install (reading bun.lock), these packages were never installed, causing adk tests to fail with 'Cannot find module @google/adk'.
This repo uses Bun (packageManager: bun@1.3.1) and CI runs bun install. The stale package-lock.json misled PR #253 into thinking npm install was sufficient, causing devDependencies to go unresolved in CI. Single lockfile (bun.lock) prevents split-brain dependency resolution.
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.
fix: proxy auth cleanup & lockfile hygiene
Fixes a duplicated auth pattern, an unsafe non-null assertion, and a split-brain lockfile that broke ADK tests in CI.
Changes
1. Extract shared
buildAuthHeadersutilityFiles:
src/auth.ts(new),src/client.ts,src/proxy/client.tsPR #314 introduced a second
buildAuthHeadersfunction in the proxy module that duplicated the logic already inStitchToolClient. Both are now backed by a single shared utility insrc/auth.ts.The shared function also includes a defensive
throwwhen neitherapiKeynoraccessTokenis provided, replacing the unsafeconfig.apiKey!non-null assertion from #314.2. Sync
bun.lockwith devDependencies from #253File:
bun.lockPR #253 (ADK support) added
@google/adkand@google/genaitodevDependenciesand updatedpackage-lock.json— but this repo uses Bun (packageManager: bun@1.3.1) and CI runsbun install. Thebun.lockwas never updated, so these packages were never installed, causing all 5 ADK tests to fail withCannot find module '@google/adk'.3. Remove
package-lock.json, gitignore itFiles:
package-lock.json(deleted),.gitignoreHaving two lockfiles is the root cause of issue #2. The
package-lock.jsonmisled the #253 contributor into thinkingnpm installwas sufficient. Removing it and adding it to.gitignoreensures all contributors usebun installand onlybun.lockis the source of truth.Test plan
tsc --noEmit— cleanvitest run— 147 tests passing (20 test files, 0 failures)adk-adapter.test.ts(3),adk-subpath.test.ts(2)