Skip to content

chore: migrate shared infrastructure writes to FileHelper - #5543

Merged
mnriem merged 1 commit into
github:mainfrom
mnriem:chore/shared-infrastructure-writes
Nov 24, 2026
Merged

mnriem merged 1 commit into
github:mainfrom
mnriem:chore/shared-infrastructure-writes

Conversation

@mnriem

@mnriem mnriem commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

Description

Route shared script, template, and managed .gitignore content 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 .venv and 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 and LC_ALL=en_US.UTF-8 on macOS

  • Tested 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 $tree built from a temporary index before commit.

No manual sample-project run or native Windows run was performed.

AI Disclosure

  • I did not use AI assistance for this contribution
  • I did use AI assistance (fill in the disclosure below)

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.

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>
Copilot AI adaptive review requested due to automatic review settings November 23, 2026 18:58

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.

🔵 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 .gitignore writes 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)

@mnriem mnriem added the triage-nice-to-have Verdict: evidence-backed fix or greenlit feature — land after review label Nov 23, 2026
@mnriem
mnriem merged commit 4d7cb8e into github:main Nov 24, 2026
14 checks passed
@mnriem
mnriem deleted the chore/shared-infrastructure-writes branch November 24, 2026 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage-nice-to-have Verdict: evidence-backed fix or greenlit feature — land after review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants