Skip to content

fix: isolate axios instance and token redaction per check - #1198

Merged
mcm1957 merged 1 commit into
masterfrom
fix/issue-1193-isolate-axios-per-check
Oct 14, 2026
Merged

mcm1957 merged 1 commit into
masterfrom
fix/issue-1193-isolate-axios-per-check

Conversation

@mcm1957

@mcm1957 mcm1957 commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

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) — added context as first argument; uses context.axios (the per-check instance set by initAxios) instead of the module-level axiosInstance. Falls back to axiosInstance so existing CLI usage is unaffected.
  • getFilesList(context) — now resolves the axios instance from context.axios for both the jsdelivr request and the GitHub API fallback, instead of using the module-level variable.
  • getFile(context, ...) — passes context through to downloadURL.
  • redactString — replaced the single effectiveGithubToken module-level variable with a Set (knownTokens) that accumulates every token registered by any initAxios() call. All known tokens are redacted regardless of which check is currently active.
  • All external callers of downloadURL updated: M1000_IOPackageJson.js (×3) and M5500__JsonConfig.js (×1).

Test plan

see: #1193

🤖 Generated with Claude Code

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>
Comment thread lib/common.js
//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);
@mcm1957
mcm1957 merged commit d7a6fd1 into master Oct 14, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants