Fix 5 bugs in templates, config, and hand-written files#75
Open
luke-hagar-sp wants to merge 1 commit intomainfrom
Open
Fix 5 bugs in templates, config, and hand-written files#75luke-hagar-sp wants to merge 1 commit intomainfrom
luke-hagar-sp wants to merge 1 commit intomainfrom
Conversation
- Fix undefined + "/v3" producing "undefined/v3" instead of triggering fallback in baseApi - Add null check for configuration.retriesConfig before calling axiosRetry - Fix same operator precedence bug in request URL construction in common - Sync generic package version from 1.6.7 to 1.7.16 and add to Makefile build target - Preserve stack trace by throwing error directly instead of wrapping in new Error Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5ea29ef to
b1f36a8
Compare
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
Cross-SDK audit identified 5 bugs in the TypeScript SDK across mustache templates, build config, and hand-written files. Template fixes will propagate to generated code on next
make build.Bug Fixes
Critical
T1:
undefined + "/v3"produces"undefined/v3"— fallbackbasePathnever triggerssdk-resources/resources/baseApi.mustacheL45: Whenconfiguration.basePathisundefined, the expressionconfiguration.basePath + "/v3"evaluates to"undefined/v3"(a truthy string), so the|| this.basePathfallback never activates.(configuration.basePath != null ? (configuration.basePath + "/{apiVersion}") : undefined) || this.basePath.T2: Null dereference on optional
configurationparametersdk-resources/resources/common.mustacheL140:axiosRetry(axios, configuration.retriesConfig)— no null check, but theconfigurationparameter is optional (configuration?: Configuration). When called without a configuration, this throws a null reference error.if (configuration?.retriesConfig) { axiosRetry(axios, configuration.retriesConfig); }.T3: Same operator precedence bug as T1 in request URL construction
sdk-resources/resources/common.mustacheL156:configuration?.basePath + "/v3" || basePathhas the sameundefined + "/v3"="undefined/v3"problem.Medium
T4: Generic package version
1.6.7out of sync with other packages at1.7.22sdk-resources/generic-config.yamlL8:npmVersion: 1.6.7while all other packages (v3, beta, v2024, v2025, v2026) are at1.7.22.1.7.22.Makefile: Generic package was missing from thebuild:target.Low
T5:
throw new Error(error)destroys original stack tracesdk-output/configuration.tsL253: Wrapping the caught error innew Error(error)loses the original stack trace and coerces the error to a string.throw errorto preserve the original error object and stack.Verification
make buildnpmVersionacross all*-config.yamlfilesnpx tsc --noEmitshows only pre-existingesModuleInteroperrors unrelated to our changesTest plan
make build && npm run buildto verify generated code compiles with template fixesbasePathto confirm fallback works correctlymake build🤖 Generated with Claude Code