Deduplicate AWF_TOKEN_LOG_DIR setup across token-tracker tests#3360
Conversation
There was a problem hiding this comment.
Pull request overview
This PR reduces maintenance drift in the API proxy’s token-tracker Jest suites by centralizing the AWF_TOKEN_LOG_DIR temp-directory initialization into a shared helper, ensuring token-persistence.js reads a writable log directory at module load time.
Changes:
- Added
containers/api-proxy/test-helpers/token-tracker-setup.jsto setprocess.env.AWF_TOKEN_LOG_DIR(creating a temp dir when unset). - Updated the HTTP, WebSocket, and schema token-tracker test suites to
require()the shared setup helper instead of duplicating inline env setup.
Show a summary per file
| File | Description |
|---|---|
| containers/api-proxy/token-tracker.websocket.test.js | Replaces inline temp-dir/env setup with shared helper require. |
| containers/api-proxy/token-tracker.schema.test.js | Replaces inline temp-dir/env setup with shared helper require. |
| containers/api-proxy/token-tracker.http.test.js | Replaces inline temp-dir/env setup with shared helper require. |
| containers/api-proxy/test-helpers/token-tracker-setup.js | New shared helper that initializes AWF_TOKEN_LOG_DIR for tests. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 4/4 changed files
- Comments generated: 0
🧪 Smoke Test Results
Overall: PASS PR by
|
|
✅ GitHub API: 2 PR entries verified Overall: PASS ✅
|
🔥 Smoke Test: Copilot BYOK (Offline) Mode
Running in BYOK offline mode ( PR by Overall: PARTIAL (MCP + BYOK inference confirmed ✅; pre-step connectivity data unavailable due to unexpanded template variables)
|
Smoke Test✅ PR review: chore: recompile all workflow lock files; refactor: split token-tracker.js into four focused modules Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "registry.npmjs.org"See Network Configuration for more information.
|
🏗️ Build Test Suite Results
Overall: 8/8 ecosystems passed — ✅ PASS
|
Smoke Test Results
Overall: FAIL —
|
Chroot Version Comparison Results
Overall: ❌ Not all tests passed — Python and Node.js versions differ between host and chroot.
|
Smoke Test Results
Overall status: PASS Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "localhost"See Network Configuration for more information.
|
|
@copilot address review feedback |
The automated review from |
The token-tracker test suite repeated the same
AWF_TOKEN_LOG_DIRtemp-dir initialization block in three files, creating maintenance drift risk for environment setup changes. This PR centralizes that setup into a single shared test helper and updates each suite to use it.What changed
containers/api-proxy/test-helpers/token-tracker-setup.jsAWF_TOKEN_LOG_DIRtemp-dir initialization logic into that helpertoken-tracker.http.test.jstoken-tracker.schema.test.jstoken-tracker.websocket.test.jsResult