{{ message }}
fix(cli): mount test file's directory so \ir includes resolve#5619
Merged
Conversation
When `db test <file.sql>` was given a single file, only that file was bind-mounted into the pg_prove container, so psql `\ir ./sibling.sql` includes (which resolve relative to the test file's own directory) failed with "No such file or directory". The whole-suite run worked because the entire tests directory was mounted. Mount the file's containing directory instead, deduped by container target so multiple files in the same directory don't emit duplicate `-v` mounts. The full file path is still passed to pg_prove, so only the requested file runs and the TAP output is unchanged. Closes #4850 Fixes CLI-1139
avallete
approved these changes
Jun 18, 2026
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.

What kind of change does this PR introduce?
Bug fix.
What is the current behavior?
Running
supabase db test <single_file.sql>fails when that file pulls in a sibling via psql's\ir ./other.sqlinclude:Running the whole suite (
supabase db test) works, and so does running a file with no includes.Root cause:
buildLegacyPgProveArgsbind-mounted each test path exactly as given. For a single file that mounts only that one file into the pg_prove container. psql's\ir(include-relative) resolves relative to the test file's own directory, so it looks for<dir>/sibling.sqlinside the container — which was never mounted. The whole-suite run works because the entiretestsdirectory is mounted, so all siblings are present.Closes #4850
Fixes CLI-1139
What is the new behavior?
When a test path is a file, its containing directory is bind-mounted read-only instead of the lone file, so
\ir/\isiblings resolve. Directories are still mounted as-is. Binds are deduped by container target so multiple files in the same directory don't emit duplicate-vmounts (which Docker rejects). The full file path is still passed topg_prove, so only the requested file runs and the TAP output is byte-identical.Scope is the TS legacy port only (the stable channel). The Go reference has the same latent bug; this is a deliberate, output-preserving divergence noted in the code.