Skip to content

[Bug]: the destructive-home test guard only recognises single-line rmSync(getConfigDir()) #4705

Description

@lidge-jun

Client or integration

Other

Area

Other

Summary

tests/ci-workflows/test-home-guard.test.ts exists because a test once deleted the real OpenCodex home. The source scan it performs recognises only same-line forms — rmSync(getConfigDir()) and const x = getConfigDir().

Multiline calls, let aliases, helper wrappers, fs.rmSync(...), and the sibling resolvers getConfigPath() and usageLogPath() all pass it. A future test could reintroduce the exact incident while CI stays green.

The specific quota test that caused the original incident is correctly fixed (tests/usage/quota-reset-seen-store.test.ts:39-46,111-119 creates and pins a temporary home and deletes only that), and no other committed test currently deletes the real home. This is about the guard, not a live defect.

Reproduction

  1. Read the source scan in tests/ci-workflows/test-home-guard.test.ts:552.
  2. Write a test that resolves the home through a let alias or a helper wrapper and deletes it, or that splits the call across lines.
  3. The guard does not flag it.

Suggested fix: use an AST scan instead of line matching, or require destructive tests to delete only paths handed out by an ownership-tracking fixture, with adversarial false-negative cases in the guard's own tests.

Version

2.56.0 (e4a8539)

Operating system

macOS 15.5

Logs or error output

(static analysis; no runtime output)

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions