[PR #3510] [WIP] Fix broken tests in the codebase #10682

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

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

State: closed
Merged: No


Summary of Broken Tests in opencode Repository

After running the test suite, I've identified the following broken tests:

Test Failures:

  • Identify all broken tests
  • Document each broken test with details

Broken Tests Found:

  1. test/keybind.test.ts - 1 failure

    • Test: "should parse meta/alt modifier"
    • Issue: Expected meta: true but received meta: false
    • The Keybind.parse() function is not correctly parsing the "meta" modifier
  2. test/tool/bash.test.ts - 1 failure

    • Test: "cd ../ should fail outside of project root"
    • Issue: Expected promise to reject with error about paths outside project, but it resolved successfully
    • The bash tool is not properly validating/blocking navigation outside project root
  3. test/tool/patch.test.ts - Setup error

    • Issue: Macro exception when trying to fetch https://models.dev/api.json
    • Error: "Unable to connect. Is the computer able to access the url?" (ConnectionRefused)
    • All tests in this file fail to run due to macro initialization failure
  4. test/config/config.test.ts - Setup error

    • Same issue as patch.test.ts - models.dev API connection failure
  5. test/session/retry.test.ts - Setup error

    • Same issue - models.dev API connection failure
  6. test/session/session.test.ts - Setup error

    • Same issue - models.dev API connection failure
  7. test/snapshot/snapshot.test.ts - Setup error

    • Same issue - models.dev API connection failure

Root Cause Analysis:

Network Connection Issue (5 test files affected):

  • The src/provider/models.ts file uses a macro that attempts to fetch data from https://models.dev/api.json
  • This macro executes at compile/load time: import { data } from "./models-macro" with { type: "macro" }
  • The connection is refused, causing all test files that import this module (directly or indirectly) to fail

Code Logic Issues (2 test files with actual test failures):

  • Keybind parser doesn't recognize "meta" modifier
  • Bash tool doesn't validate paths outside project root
Original prompt

what tests are broken?


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/3510 **State:** closed **Merged:** No --- ## Summary of Broken Tests in opencode Repository After running the test suite, I've identified the following broken tests: ### Test Failures: - [x] Identify all broken tests - [ ] Document each broken test with details ### Broken Tests Found: 1. **test/keybind.test.ts** - 1 failure - Test: "should parse meta/alt modifier" - Issue: Expected `meta: true` but received `meta: false` - The Keybind.parse() function is not correctly parsing the "meta" modifier 2. **test/tool/bash.test.ts** - 1 failure - Test: "cd ../ should fail outside of project root" - Issue: Expected promise to reject with error about paths outside project, but it resolved successfully - The bash tool is not properly validating/blocking navigation outside project root 3. **test/tool/patch.test.ts** - Setup error - Issue: Macro exception when trying to fetch https://models.dev/api.json - Error: "Unable to connect. Is the computer able to access the url?" (ConnectionRefused) - All tests in this file fail to run due to macro initialization failure 4. **test/config/config.test.ts** - Setup error - Same issue as patch.test.ts - models.dev API connection failure 5. **test/session/retry.test.ts** - Setup error - Same issue - models.dev API connection failure 6. **test/session/session.test.ts** - Setup error - Same issue - models.dev API connection failure 7. **test/snapshot/snapshot.test.ts** - Setup error - Same issue - models.dev API connection failure ### Root Cause Analysis: **Network Connection Issue (5 test files affected):** - The `src/provider/models.ts` file uses a macro that attempts to fetch data from https://models.dev/api.json - This macro executes at compile/load time: `import { data } from "./models-macro" with { type: "macro" }` - The connection is refused, causing all test files that import this module (directly or indirectly) to fail **Code Logic Issues (2 test files with actual test failures):** - Keybind parser doesn't recognize "meta" modifier - Bash tool doesn't validate paths outside project root <!-- START COPILOT CODING AGENT SUFFIX --> <details> <summary>Original prompt</summary> > what tests are broken? </details> <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey).
yindo added the pull-request label 2026-02-16 18:15:24 -05:00
yindo closed this issue 2026-02-16 18:15:24 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10682