fix(test): isolate usage-log fixtures from the real OpenCodex home - #997
Open
Yuxin-Qiao wants to merge 1 commit into
Open
fix(test): isolate usage-log fixtures from the real OpenCodex home#997Yuxin-Qiao wants to merge 1 commit into
Yuxin-Qiao wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe test setup creates a temporary ChangesManagement API test isolation
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
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
tests/management-api-logs-metrics.test.tsexercisesGET /api/logsdisplay metrics throughaddRequestLog, which persists every row tousage.jsonl. Unlike its sibling suites that also persist (usage-failure-persistence.test.ts,api-key-attribution.test.ts), it did not redirectOPENCODEX_HOMEitself and relied entirely on thebunfig.tomlpreload (tests/preload.ts).bunfig.tomlfrom the current directory. Runningbun test <absolute path>from outside the repo (agent/IDE pattern) skips it, and the fixture rows (ok-a/ok-b/fail,no-such-model,unpriced-model,combo/my-combo, ...) are appended to the developer's real~/.opencodex/usage.jsonl. The GUI Usage page then renders never-used models with real token counts.OPENCODEX_HOME(mkdtemp, restored and cleaned inafterEach), matching the established pattern in the two sibling suites.Reproduction before the fix
Verification
OPENCODEX_HOME: 11 fixture rows were written before the fix.usage.jsonluntouched.bun run typecheckandbun run privacy:scanpass.management-provider-validation.test.tscases that fail only in this dev environment becausechatgpt.comresolves to a non-global address (write-time DNS/SSRF gate returns 400); upstream CI fordevis green.Summary by CodeRabbit