Fix redact_secrets gateway-token tests after MCP config path refactor#26681
Fix redact_secrets gateway-token tests after MCP config path refactor#26681
Conversation
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/d4d8acf5-7ed0-48dd-b144-a5bda3554cdd Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/d4d8acf5-7ed0-48dd-b144-a5bda3554cdd Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Fixes failing redact_secrets gateway-token tests by updating the test-time script rewriting to match the current runtime construction of MCP_GATEWAY_CONFIG_PATHS.
Changes:
- Update test string replacements to target
path.join(process.env.RUNNER_TEMP || "/tmp", "gh-aw/mcp-config/...")expressions instead of stale hardcoded"/tmp/gh-aw/..."literals. - Restore correctness of MCP gateway token extraction/redaction assertions by ensuring fixtures are injected at the right config paths.
Show a summary per file
| File | Description |
|---|---|
| actions/setup/js/redact_secrets.test.cjs | Adjusts script-patching in tests so mocked MCP gateway config paths align with the implementation after the config-path refactor. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 1
| const script = redactScript | ||
| .replace('"/tmp/gh-aw/mcp-config/gateway-output.json"', `"${gatewayOutput.replace(/\\/g, "\\\\")}"`) | ||
| .replace('"/tmp/gh-aw/mcp-config/mcp-servers.json"', `"${path.join(configDir, "mcp-servers.json").replace(/\\/g, "\\\\")}"`); | ||
| .replace('path.join(process.env.RUNNER_TEMP || "/tmp", "gh-aw/mcp-config/gateway-output.json")', `"${gatewayOutput.replace(/\\/g, "\\\\")}"`) | ||
| .replace('path.join(process.env.RUNNER_TEMP || "/tmp", "gh-aw/mcp-config/mcp-servers.json")', `"${path.join(configDir, "mcp-servers.json").replace(/\\/g, "\\\\")}"`); |
There was a problem hiding this comment.
These tests rely on exact string matching of the implementation expression (path.join(process.env.RUNNER_TEMP || "/tmp", ...)) in multiple places. This is brittle (any formatting/refactor breaks the replacements) and duplicated across several test cases. Consider extracting these source substrings into shared constants/helpers in the test, or (since redact_secrets.cjs exports MCP_GATEWAY_CONFIG_PATHS and the array is mutable) requiring the module and overriding the array entries directly instead of patching the script text.
🧪 Test Quality Sentinel ReportTest Quality Score: 83/100✅ Excellent test quality
Nature of This PRAll changes are mechanical fixes — the 7 modified test blocks update their script-patching Test Classification DetailsView All 7 Modified Test Blocks
Language SupportTests analyzed:
Verdict
📖 Understanding Test ClassificationsDesign Tests (High Value) verify what the system does:
Implementation Tests (Low Value) verify how the system does it:
Goal: Shift toward tests that describe the system's behavioral contract — the promises it makes to its users and collaborators. References: §24521822809
|
There was a problem hiding this comment.
✅ Test Quality Sentinel: 83/100. Test quality is excellent — 0% of modified tests are implementation tests (threshold: 30%). This PR correctly fixes 7 test blocks to match the refactored MCP config path construction, preserving all behavioral assertions intact.
CI was failing in
actions/setup/js/redact_secrets.test.cjsbecause test-time string patching no longer matched the runtime construction ofMCP_GATEWAY_CONFIG_PATHS. As a result, gateway config fixtures were not injected, and token extraction/redaction assertions regressed.Root cause alignment
path.join(process.env.RUNNER_TEMP || "/tmp", "gh-aw/mcp-config/gateway-output.json")path.join(process.env.RUNNER_TEMP || "/tmp", "gh-aw/mcp-config/mcp-servers.json")"/tmp/gh-aw/..."literals.Scope of impact
extractMCPGatewayTokenscases (direct token extraction, ****** split, dedup behavior).main().