fix: find the versions directory through symlinks - #55
mergify[bot] merged 1 commit into
Conversation
`_discover_versions_dir` compared each frame's resolved path with this package's unresolved directory, and returned the caller's resolved directory. Two setups broke: - The package imported through a symlinked path (for instance `uv sync --link-mode symlink`, where every site-packages file is a symlink into the cache): its own frames were not recognized, so the package directory was returned as the versions directory and building the chain failed on `_chain.py`. - A `versions/` directory that is itself a symlink: the CLI writes `revision_chain.json` beside the path it is given, but discovery resolved the symlink and looked for the file beside its target. Compare against the resolved package directory, and return the caller's directory as alembic loaded it (absolute, symlinks kept). Both cases get a regression test that fails before this change. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Change-Id: I3921767a64f5c44b4dbbb711eb17030122b71d75
|
This pull request is part of a Mergify stack:
|
Merge Protections🟢 All 6 merge protections satisfied — ready to merge. Show 6 satisfied protections🟢 🤖 Continuous Integration
🟢 👀 Review Requirements
🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 🔎 Reviews
🟢 📕 PR description
🟢 🚦 Auto-queueWhen all merge protections are satisfied, this pull request will be queued automatically. |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The changes are covered by regression tests and no unresolved issues remain.
Review effort: Lite
Findings: None
What changed in this PR
Fixes version-directory discovery when package or migration paths use symlinks.
Changes:
- Resolves package paths for stack-frame matching.
- Preserves absolute symlinked migration paths.
- Adds regression tests for both scenarios.
| File | Description |
|---|---|
tests/test_chain.py |
Adds symlink regression coverage. |
alembic_git_revisions/_chain.py |
Updates symlink-aware directory discovery. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Merge Queue Status
This pull request spent 13 seconds in the queue, including 1 second running CI. ReasonHintYou should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Required conditions to merge
Requeued — the merge queue status continues in this comment ↓. |
Merge Queue Status
This pull request spent 14 seconds in the queue, including 2 seconds running CI. ReasonHintYou should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it. Required conditions to merge
Requeued — the merge queue status continues in this comment ↓. |
Merge Queue Status
This pull request spent 22 seconds in the queue, including 1 second running CI. Required conditions to merge
|
_discover_versions_dircompared each frame's resolved path with thispackage's unresolved directory, and returned the caller's resolved
directory. Two setups broke:
uv sync --link-mode symlink, where every site-packages file is asymlink into the cache): its own frames were not recognized, so the
package directory was returned as the versions directory and building
the chain failed on
_chain.py.versions/directory that is itself a symlink: the CLI writesrevision_chain.jsonbeside the path it is given, but discoveryresolved the symlink and looked for the file beside its target.
Compare against the resolved package directory, and return the caller's
directory as alembic loaded it (absolute, symlinks kept). Both cases get
a regression test that fails before this change.
🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 5.5 (1M context) noreply@anthropic.com