Skip to content

fix: resolve fish test path correctly with fishtape - #1071

Closed
shunkakinoki wants to merge 2 commits into
mainfrom
fix/fish-test-path-resolution
Closed

fix: resolve fish test path correctly with fishtape#1071
shunkakinoki wants to merge 2 commits into
mainfrom
fix/fish-test-path-resolution

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Mar 12, 2026

Copy link
Copy Markdown
Owner

The issue was that (status dirname) returns unexpected values when fish test files are run via fishtape in CI. This caused the path resolution to fail, resulting in 'Unknown command' errors.

Fix: Use relative path ../../home-manager/programs/fish/functions directly instead of relying on status dirname, since fishtape runs with the test file's directory as the current working directory.


Summary by cubic

Fixes fishtape path resolution in fish tests to stop "Unknown command" errors in CI. Also pins Elixir to elixir_1_19 for consistent builds.

  • Bug Fixes

    • Load fish functions via ../../home-manager/programs/fish/functions instead of (status dirname).
    • Aligns with fishtape running tests from the test file’s directory, restoring CI reliability.
  • Dependencies

    • Switch elixir to elixir_1_19 in Home Manager for a stable toolchain.

Written for commit eed18e2. Summary will update on new commits.

The issue was that (status dirname) returns unexpected values when
fish test files are run via fishtape in CI. This caused the
path resolution to fail, resulting in 'Unknown command' errors.

Fix: Use relative path ../../home-manager/programs/fish/functions
directly instead of relying on status dirname, since fishtape runs
with the test file's directory as the current working directory.
Copilot AI review requested due to automatic review settings March 12, 2026 20:36
@mesa-dot-dev

mesa-dot-dev Bot commented Mar 12, 2026

Copy link
Copy Markdown

You do not have enough credits to review this pull request. Please purchase more credits to continue.

@coderabbitai

coderabbitai Bot commented Mar 12, 2026

Copy link
Copy Markdown
📝 Walkthrough

Summary by CodeRabbit

  • Chores

    • Updated Elixir to version 1.19
  • Tests

    • Refactored test configuration paths for improved portability across environments

Walkthrough

This PR updates the Elixir package version from elixir to elixir_1_19 in the home-manager configuration and simplifies path resolution across 46 fish test files by replacing status dirname-derived paths with direct relative paths.

Changes

Cohort / File(s) Summary
Elixir Package Update
home-manager/programs/elixir/default.nix
Replaced package reference from elixir to elixir_1_19 in the home.packages list.
Fish Test Path Simplification
spec/fish/_cliproxyapi_function_test.fish, spec/fish/_cltxe_function_test.fish, spec/fish/_cltxeh_function_test.fish, spec/fish/_clwxe_function_test.fish, spec/fish/_clwxeh_function_test.fish, spec/fish/_clxe_function_test.fish, spec/fish/_clxeh_function_test.fish, spec/fish/_coxe_function_test.fish, spec/fish/_coxeh_function_test.fish, spec/fish/_coxel_function_test.fish, spec/fish/_coxelh_function_test.fish, spec/fish/_dev_function_test.fish, spec/fish/_fish_shortcuts_test.fish, spec/fish/_fzf_chrome_history_test.fish, spec/fish/_fzf_directory_picker_test.fish, spec/fish/_fzf_file_picker_test.fish, spec/fish/_fzf_ghq_picker_test.fish, spec/fish/_fzf_git_branch_test.fish, spec/fish/_fzf_git_worktree_test.fish, spec/fish/_fzf_preview_cmd_test.fish, spec/fish/_fzf_preview_name_test.fish, spec/fish/_fzf_shell_history_test.fish, spec/fish/_gco_function_test.fish, spec/fish/_grco_function_test.fish, spec/fish/_grcr_function_test.fish, spec/fish/_hm_load_env_file_test.fish, spec/fish/_kyber_function_test.fish, spec/fish/_kyberd_function_test.fish, spec/fish/_kyberm_function_test.fish, spec/fish/_ocxe_function_test.fish, spec/fish/_ocxeh_function_test.fish, spec/fish/_pixe_function_test.fish, spec/fish/_pixeh_function_test.fish, spec/fish/_ssh_add_github_test.fish, spec/fish/_tdo_function_test.fish, spec/fish/_tmo_function_test.fish, spec/fish/_tpo_function_test.fish, spec/fish/_tsh_function_test.fish, spec/fish/_tsk_function_test.fish, spec/fish/_tss_function_test.fish, spec/fish/_tsw_function_test.fish, spec/fish/_two_function_test.fish, spec/fish/_zdo_function_test.fish, spec/fish/_zmo_function_test.fish, spec/fish/_zpo_function_test.fish, spec/fish/fish_user_key_bindings_test.fish
Changed path resolution from (status dirname)/../../home-manager/programs/fish/functions to ../../home-manager/programs/fish/functions in function sourcing setup across all fish test files, affecting how test files locate the functions directory.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~18 minutes

Possibly related PRs

Suggested labels

bug

Poem

🐰 A rabbit hops through paths once complex and long,
Now simpler routes make the test suite strong,
Elixir bounces to version new,
Forty-six functions find clearer view—
Status dirname no more in sight, all feels right! 🌿

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main fix: resolving fish test paths for fishtape, which is the primary focus of the changeset.
Description check ✅ Passed The description clearly explains the issue (status dirname failure in fishtape CI), the fix (using relative paths), and the reasoning, directly related to the bulk of changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/fish-test-path-resolution
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request primarily addresses a critical path resolution bug affecting Fish shell tests when executed in a Continuous Integration environment using fishtape. The (status dirname) command was yielding unexpected results, causing test failures due to incorrect function sourcing. The fix involves standardizing path references within these test files to direct relative paths, ensuring consistent execution regardless of the current working directory context set by fishtape. Additionally, the Elixir package in the Home Manager configuration has been updated to a newer version.

Highlights

  • Fish Test Path Resolution: Corrected an issue where (status dirname) returned incorrect paths when Fish shell tests were run via fishtape in CI, leading to "Unknown command" errors.
  • Direct Relative Paths: Implemented a fix by changing path references in Fish test files to use direct relative paths (e.g., ../../home-manager/programs/fish/functions) instead of relying on (status dirname).
  • Elixir Package Update: Updated the elixir package to elixir_1_19 in the Home Manager configuration.
Changelog
  • home-manager/programs/elixir/default.nix
    • Updated the elixir package to elixir_1_19.
  • spec/fish/*.fish
    • Corrected path resolution in Fish test files by replacing (status dirname)/... with direct relative paths ../... to ensure proper function sourcing in fishtape CI environments.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@mesa-dot-dev

mesa-dot-dev Bot commented Mar 12, 2026

Copy link
Copy Markdown

Mesa Description

TL;DR

Fixed an issue with fish test path resolution in CI when using fishtape by directly specifying a relative path.

What changed?

Modified the fish test path resolution to use the relative path ../../home-manager/programs/fish/functions directly, addressing the issue where (status dirname) returned unexpected values when fish test files were run via fishtape in CI.

Description generated by Mesa. Update settings

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses a path resolution issue in the fish shell tests that was causing failures in CI. The fix involves using a static relative path instead of a dynamic one with (status dirname). Additionally, the Elixir version is pinned to ensure build consistency. While the fix is effective, it has been applied across a large number of test files, leading to significant code duplication. My review focuses on this maintainability issue and suggests a refactoring to centralize the path definition in a shared test helper script.

Comment on lines +1 to 2
set fn ../../home-manager/programs/fish/functions
source $fn/_cliproxyapi_function.fish

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

While this change fixes the path resolution issue, it introduces significant code duplication by repeating the path definition across more than 40 test files. This will make future maintenance difficult, as any change to the directory structure would require updating all these files.

A better approach would be to centralize this path definition in a single test helper file. For example, you could create a spec/fish/test_helper.fish with the following content:

# spec/fish/test_helper.fish
set -g TEST_FUNCTIONS_PATH ../../home-manager/programs/fish/functions

Then, you could replace these two lines in every test file with something like this:

source test_helper.fish # Assuming test_helper.fish is in the same directory
source $TEST_FUNCTIONS_PATH/_cliproxyapi_function.fish

This refactoring would greatly improve the maintainability of the test suite.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to fix CI failures in the fish function test suite by changing how spec files locate and source fish functions when executed via fishtape.

Changes:

  • Update spec/fish/*_test.fish files to source functions using a fixed relative path instead of (status dirname).
  • Pin the Home Manager Elixir package selection from elixir to elixir_1_19.

Reviewed changes

Copilot reviewed 47 out of 47 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
spec/fish/fish_user_key_bindings_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_zpo_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_zmo_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_zdo_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_two_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_tsw_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_tss_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_tsk_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_tsh_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_tpo_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_tmo_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_tdo_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_ssh_add_github_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_pixeh_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_pixe_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_ocxeh_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_ocxe_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_kyberm_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_kyberd_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_kyber_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_hm_load_env_file_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_grcr_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_grco_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_gco_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_fzf_shell_history_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_fzf_preview_name_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_fzf_preview_cmd_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_fzf_git_worktree_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_fzf_git_branch_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_fzf_ghq_picker_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_fzf_file_picker_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_fzf_directory_picker_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_fzf_chrome_history_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_fish_shortcuts_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_dev_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_coxelh_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_coxel_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_coxeh_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_coxe_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_clxeh_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_clxe_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_clwxeh_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_clwxe_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_cltxeh_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_cltxe_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
spec/fish/_cliproxyapi_function_test.fish Switch functions directory resolution to a fixed relative path for fishtape runs
home-manager/programs/elixir/default.nix Pin Elixir package from elixir to elixir_1_19

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@@ -1,4 +1,4 @@
set fn (status dirname)/../../home-manager/programs/fish/functions
set fn ../../home-manager/programs/fish/functions

Copilot AI Mar 12, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hard-coded relative path assumes the current working directory is spec/fish (so that ../../home-manager/... resolves correctly). However, make fish-test invokes fishtape spec/fish/*_test.fish from the repo root, so this becomes brittle and may break depending on whether fishtape changes directories internally. Consider deriving the functions directory from the repo root (or passing it in via an environment variable / adjusting the test runner to cd spec/fish first) so path resolution is robust across runners.

Copilot uses AI. Check for mistakes.
Comment on lines +4 to 5
elixir_1_19
elixir-ls

Copilot AI Mar 12, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is described as fixing fishtape path resolution, but this change pins Elixir to elixir_1_19, which appears unrelated to the fish test failure. Please either split this into a separate PR/commit or update the PR description to explain why this version change is included here (and how it relates to the reported issue).

Copilot uses AI. Check for mistakes.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 47 files

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
spec/fish/_fzf_shell_history_test.fish (1)

1-1: Consider centralizing the shared fn base path in one test helper.

This same literal path is duplicated across many specs; extracting it once will reduce future churn if test layout changes.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@spec/fish/_fzf_shell_history_test.fish` at line 1, The literal base path
"../../home-manager/programs/fish/functions" assigned to the variable fn is
duplicated; extract it into a single test helper (e.g., a shared spec helper
that exports a FN_BASE variable or a get_fn_path function) and update this test
to source that helper and use the shared symbol (fn or FN_BASE/get_fn_path)
instead of the hardcoded string so all specs reference the single source of
truth.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@spec/fish/_fzf_shell_history_test.fish`:
- Line 1: The literal base path "../../home-manager/programs/fish/functions"
assigned to the variable fn is duplicated; extract it into a single test helper
(e.g., a shared spec helper that exports a FN_BASE variable or a get_fn_path
function) and update this test to source that helper and use the shared symbol
(fn or FN_BASE/get_fn_path) instead of the hardcoded string so all specs
reference the single source of truth.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: bc23fa23-d8c7-476b-a5a6-7da4429587b1

📥 Commits

Reviewing files that changed from the base of the PR and between f41c728 and eed18e2.

📒 Files selected for processing (47)
  • home-manager/programs/elixir/default.nix
  • spec/fish/_cliproxyapi_function_test.fish
  • spec/fish/_cltxe_function_test.fish
  • spec/fish/_cltxeh_function_test.fish
  • spec/fish/_clwxe_function_test.fish
  • spec/fish/_clwxeh_function_test.fish
  • spec/fish/_clxe_function_test.fish
  • spec/fish/_clxeh_function_test.fish
  • spec/fish/_coxe_function_test.fish
  • spec/fish/_coxeh_function_test.fish
  • spec/fish/_coxel_function_test.fish
  • spec/fish/_coxelh_function_test.fish
  • spec/fish/_dev_function_test.fish
  • spec/fish/_fish_shortcuts_test.fish
  • spec/fish/_fzf_chrome_history_test.fish
  • spec/fish/_fzf_directory_picker_test.fish
  • spec/fish/_fzf_file_picker_test.fish
  • spec/fish/_fzf_ghq_picker_test.fish
  • spec/fish/_fzf_git_branch_test.fish
  • spec/fish/_fzf_git_worktree_test.fish
  • spec/fish/_fzf_preview_cmd_test.fish
  • spec/fish/_fzf_preview_name_test.fish
  • spec/fish/_fzf_shell_history_test.fish
  • spec/fish/_gco_function_test.fish
  • spec/fish/_grco_function_test.fish
  • spec/fish/_grcr_function_test.fish
  • spec/fish/_hm_load_env_file_test.fish
  • spec/fish/_kyber_function_test.fish
  • spec/fish/_kyberd_function_test.fish
  • spec/fish/_kyberm_function_test.fish
  • spec/fish/_ocxe_function_test.fish
  • spec/fish/_ocxeh_function_test.fish
  • spec/fish/_pixe_function_test.fish
  • spec/fish/_pixeh_function_test.fish
  • spec/fish/_ssh_add_github_test.fish
  • spec/fish/_tdo_function_test.fish
  • spec/fish/_tmo_function_test.fish
  • spec/fish/_tpo_function_test.fish
  • spec/fish/_tsh_function_test.fish
  • spec/fish/_tsk_function_test.fish
  • spec/fish/_tss_function_test.fish
  • spec/fish/_tsw_function_test.fish
  • spec/fish/_two_function_test.fish
  • spec/fish/_zdo_function_test.fish
  • spec/fish/_zmo_function_test.fish
  • spec/fish/_zpo_function_test.fish
  • spec/fish/fish_user_key_bindings_test.fish

@shunkakinoki

Copy link
Copy Markdown
Owner Author

Closing this PR to replace with corrected fix on new branch

@shunkakinoki
shunkakinoki deleted the fix/fish-test-path-resolution branch March 21, 2026 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants