fix(init): refuse an install it cannot finish before asking to overwrite - #226
Merged
Merged
Conversation
`pharn init` ran its destination pre-flight (a symlink on the way, a type in the way) only after the "Continue and overwrite?" prompt, so a user could answer yes and then be told the install was refused. init now runs the same read-only pre-flight (`preflightInstall` → `prepareInstall`) over the manifest it already built, before that prompt. The checks under the lock and before the copy stay, and stay authoritative: the tree can change while the prompt is open. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0199owRmYfskqYQVQrVP679o
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
What this changes
pharn initchecked the destination (a symlink on the way, or the wrong kind of entry where it writes) only after the Continue and overwrite? prompt. So a user could answer yes and then be toldRefusing to install: … is in the way: the question was never real.initnow runs the same read-only pre-flight before that prompt:preflightInstallcallsprepareInstallover the manifestinitalready builds. A refusal takes init's existing error path: exit 1, with the temporary clone cleaned up first.The checks under the project lock (before the backup) and in
installCapabilities(before the copy) stay unchanged, and they remain the authoritative ones, because the tree can change while the prompt is open.Type of change
feat— new stack option, wizard step, or command capabilityfix— bug fixdocs— docs-only changechore/refactor— tooling or internal restructure, no behavior changeArea(s) touched
commands/init | steps/install-archetype | docs
Checklist
.js-extension import convention.tests/*.test.ts. All three new cases failed on the unchanged code. The whole-runInitcase failed because the overwrite warning appeared before the refusal.docs/page (docs/commands/init.md,docs/troubleshooting.md).Quality gates
npm run checkpasses locally (1666 tests). I ran it as root with the DAC-override capabilities dropped (CI-equivalent).npm run buildsucceeds.npm run test:coveragepasses.Notes for the reviewer
PHARN_DEBUGhint, as the lock-time refusal always has.🤖 Generated with Claude Code
https://claude.ai/code/session_0199owRmYfskqYQVQrVP679o
Generated by Claude Code