Repository navigation
fix: isolate axios instance and token redaction per check - #1198
Merged
Merged
Conversation
When the repochecker runs as a library with parallel checks, each check now uses its own per-check axios instance (context.axios) rather than a shared module-level axiosInstance. This prevents a check started later from overwriting the authorized instance used by an earlier check still in flight. Token redaction is also now per-check-aware: a Set (knownTokens) collects every token registered via initAxios() so that redactString() redacts all known tokens regardless of which check is currently active. Changes: - downloadURL() now receives context as its first argument and uses context.axios (falling back to axiosInstance for safety) - getFilesList() uses context.axios instead of the module-level instance - getFile() passes context through to downloadURL() - All external callers of downloadURL() updated to pass context - effectiveGithubToken module-level var replaced by knownTokens Set Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| //const response = await axios(githubUrl + (path || ''), options); | ||
| // @ts-expect-error options work this way | ||
| const response = await axiosInstance(url, options); | ||
| const response = await instance(url, options); |
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
Fixes the race condition described in issue #1193 where concurrent checks run by the dev-portal share a module-level axios instance and token-redaction state.
downloadURL(context, url, binary)— addedcontextas first argument; usescontext.axios(the per-check instance set byinitAxios) instead of the module-levelaxiosInstance. Falls back toaxiosInstanceso existing CLI usage is unaffected.getFilesList(context)— now resolves the axios instance fromcontext.axiosfor both the jsdelivr request and the GitHub API fallback, instead of using the module-level variable.getFile(context, ...)— passescontextthrough todownloadURL.redactString— replaced the singleeffectiveGithubTokenmodule-level variable with aSet(knownTokens) that accumulates every token registered by anyinitAxios()call. All known tokens are redacted regardless of which check is currently active.downloadURLupdated:M1000_IOPackageJson.js(×3) andM5500__JsonConfig.js(×1).Test plan
see: #1193
🤖 Generated with Claude Code