Repository navigation
Conversation
Assisted-by: Claude Code (model: Sonnet 5, autonomous) Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟡 Changes recommended
Failed mutations can incorrectly claim ownership of concurrent changes, risking destructive rollback, and the new completion callback breaks both shared-write failure tests.
2 open issues
What changed in this PR
This PR aims to improve integration lifecycle rollback by completing file-change journal notifications when a mutation raises.
Changes:
- Wraps mutations in
try/finallyso completion is reported on both success and failure. - Adds a regression test for callback ordering and exception propagation after a partial write.
AI-assisted review for the requester (identity unavailable): GitHub Copilot; model unknown; autonomous analysis and review editing. Tests were not run during this review.
| File | Description |
|---|---|
tests/specify_cli/integrations/test_file_changes.py |
Adds exception-path completion coverage. |
src/specify_cli/integrations/_file_changes.py |
Moves completion notification into finally. |
Review effort: Balanced (adaptive)
| finally: | ||
| after_file_change(path) |
| finally: | ||
| _file_changes.file_change_observer.reset(token) | ||
|
|
||
| assert observed == [(path, True, False), (path, False, False)] |
|
Closing after review. Failed mutations are deliberately left pending: Contributor: feiiiiii5. Agent: Claude Code (Claude Sonnet 5), autonomous mode; agent-written from the review thread, no human line-by-line review. |

Description
changing_file()journals a host mutation but only calledafter_file_change()on the success path. When a mutation raised, the lifecycle journal left the pathpending, so rollback could treat a partially changed file as a conflict instead of restoring its snapshot. Theyieldnow runs intry/finally, so completion is reported on both paths. A regression test covers the exception case.Testing
.venv/bin/specify --help.venv/bin/python -m pytest tests/specify_cli/integrations/test_file_changes.py -q(33 passed)Base-red: the new test failed before the source fix. Head-green: 33 passed.
ruff==0.15.0check on both changed files passed;git diff --checkclean.AI Disclosure
AI disclosure: Implemented with Claude Code using Claude Sonnet 5 in agent/autonomous mode, default settings; code generation and offline regression test. No human line-by-line review before commit.