Repository navigation
chore: migrate shared infrastructure writes to FileHelper - #5543
Merged
Merged
Conversation
Use atomic FileHelper writes for shared scripts, templates, and the managed gitignore while retaining caller-owned overwrite decisions and lifecycle hooks. Assisted-by: GitHub Copilot (model: GPT-6.2 Sol, autonomous) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
The shared-write backend migration couples deny-mode path validation, staged-file permissions and publication, and lifecycle snapshot/rollback behavior across workflows and platforms, exceeding the conservative limited-consequence review scope.
No open issues 🎉
What changed in this PR
Migrates shared infrastructure content writes to FileHelper’s atomic writer in deny mode, while preserving caller-owned overwrite decisions, script permissions, and file-change hooks.
Changes:
- Routes shared script, template, and managed
.gitignorewrites through FileHelper. - Adds tests for atomic overwrites, failed-write cleanup, and symlink rejection.
- Updates the design document to reflect the migration’s scope.
| File | Description |
|---|---|
tests/test_shared_infra_script_mode.py |
Adds coverage for atomic writes, permissions, hooks, failure cleanup, and symlink denial. |
src/specify_cli/shared_infra.py |
Uses FileHelper for shared writes and translates symlink errors to the existing shared-path exception. |
design/file-helper.md |
Documents migrated content writes and unchanged caller responsibilities. |
Review effort: Balanced (adaptive)
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.
Description
Route shared script, template, and managed
.gitignorecontent writes through FileHelper's atomic writer in deny mode. The caller still decides what to overwrite or skip, supplies the script mode, and runs the existing file-change hooks. Asset discovery, downloads, locks, and manifest operations are unchanged. Builds on #5498.Testing
Set up this checkout's
.venvand editable install using the local development guide. Run commands from the checkout root.Tested locally with
.venv/bin/specify --help(Windows PowerShell:.\.venv\Scripts\specify.exe --help)Ran relevant existing tests with
.venv/bin/python -m pytest tests -q(Windows PowerShell:.\.venv\Scripts\python.exe -m pytest tests -q); use affected test paths for focused checks andLC_ALL=en_US.UTF-8on macOSTested with a sample project (if applicable)
.venv/bin/specify --help— passed.LC_ALL=en_US.UTF-8 .venv/bin/python -m pytest -q tests/test_shared_infra_script_mode.py tests/test_shared_infra_gitignore.py tests/test_file_helper.py tests/contract/test_file_helper_migration_guard.py tests/integrations/test_file_changes.py tests/integrations/test_cli.py tests/specify_cli/integrations/test_command_switch.py tests/specify_cli/integrations/test_command_upgrade.py— 937 passed, 81 skipped on macOS.LC_ALL=en_US.UTF-8 .venv/bin/python -m pytest -q tests/test_shared_infra_script_mode.py— all 18 passed after tightening the symlink assertion..venv/bin/python .github/scripts/check_file_helper_migration.py --base HEAD --head "$tree"— passed against the pending source diff, with$treebuilt from a temporary index before commit.No manual sample-project run or native Windows run was performed.
AI Disclosure
AI disclosure: GitHub Copilot (GPT-6.2 Sol, autonomous agent mode; reasoning effort not independently verified) implemented the migration, wrote tests and documentation, ran validation, and drafted this PR on behalf of @mnriem.