Repository navigation
Store query expression files relative to the current directory - #4811
Merged
Merged
Conversation
Query expressions store the caller's file for error messages. With an absolute path, a copy of the project that reuses its build (git worktree, copy-on-write clone) reported the original checkout's files. Elixir's own stacktraces and diagnostics are relative to the current directory too.
v0idpwn
approved these changes
Oct 31, 2026
Member
|
@onnimonni fantastic work throughout, thank you!!! |
Member
|
💚 💙 💜 💛 ❤️ |
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.
Query expressions (
QueryExpr,BooleanExpr,JoinExpr,FromExpr, ...) store the caller'sfileat compile time; it is shown inEcto.QueryErrormessages. It was the absolute path, so a copy of a project that reuses its_buildreported the original checkout's files. Examples of such copies: git worktrees for parallel coding agents, copy-on-write clones, restored CI caches (see phoenixframework/phoenix#6855).This adds
Ecto.Query.Builder.file/1, which stores the file relative to the current directory when the file is inside it. That matches Elixir's own stacktraces and diagnostics. All 28env.fileuses in the query builders now go through it. Files outside the project stay absolute.Exception.format_file_line/2prints relative paths fine.With this change, the only remaining absolute paths in a generated Phoenix app's compiled modules (with the related Phoenix/LiveView PRs) are compile metadata (
:source, debug info). Queries were the last place where the path ended up in literals.Test: a new test in
query_test.exschecks thatfrom,where,selectandorder_bystore the relative file. It fails on master. Full suite: 1617 passed.