[PR #10371] fix(tests): Prevent tests from overwriting auth.json (#10370) #13419

Closed
opened 2026-02-16 18:18:16 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/10371

State: closed
Merged: No


Problem

Tests overwrite the user's auth.json because the test preload imports Global before XDG test env vars are set, so xdg-basedir resolves to the real home directory.

Solution

  • Defer the Global import until after the test XDG/OPENCODE_TEST_HOME env vars are set
  • Fail fast if Global.Path.data resolves outside the temp test directory

Notes

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/10371 **State:** closed **Merged:** No --- ## Problem Tests overwrite the user's auth.json because the test preload imports Global before XDG test env vars are set, so xdg-basedir resolves to the real home directory. ## Solution - Defer the Global import until after the test XDG/OPENCODE_TEST_HOME env vars are set - Fail fast if Global.Path.data resolves outside the temp test directory ## Notes - Closes #10370 - AI Assistance: OpenCode + gpt-5.2-codex - Testing: `bun turbo typecheck` (pre-push hook) - Review: Human operator reviewed
yindo added the pull-request label 2026-02-16 18:18:16 -05:00
yindo closed this issue 2026-02-16 18:18:16 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13419