Skip to content

adopt-project.py plan: an --out in a missing folder, an existing folder, or a folder nobody can write in ends in a traceback after the whole plan is built, so a mistyped --out gets no refusal and no way out #799

Closed

Description

@brettheap

Goal: plan checks that it can write --out before it does any work, and refuses a path it cannot write, by name. Once the plan is on disk, plan says so before any later read can stop it.

Filed by lane openRepoShape-1 from #457's lines L1-89 (#457, comment) and L1-79 (#457, comment), on Brett Heap's word of 2026-10-17T10:21:32Z, under lane 3's v1.1.1 rule (#473, issuecomment-6216697223). Measured on main bf1f099b with a stub gh and git 2.43.0.

Milestone: v1.1.1, not a regression. A mistyped --out folder is an ordinary slip.

Lines

  • L1-89. Each case below fails after the plan is built, at write_lf(out, …) in cmd_plan. None prints a REFUSED line or a remedy:
    • --out <dir>/nope/adoption-plan.yaml ends in FileNotFoundError: [Errno 2] No such file or directory, exit 1;
    • --out <an existing folder> ends in IsADirectoryError: [Errno 21];
    • --out <a folder nobody can write in>/adoption-plan.yaml ends in PermissionError: [Errno 13].
  • L1-79 (rider). plan writes the plan before _print_plan_report's reads. So a git-failed there leaves the plan on disk, exits 2, and prints no "plan written to" line.
    • rev-list --count now fails before the write. The read left after it is symlink_targets' cat-file --batch.
    • With that read made to fail, the run exited 2, the plan was on disk, and "plan written to" was never printed.

Direction

  • Check --out with the flag-only refusals at the top of cmd_plan, before _work_root and Source.open. Its folder must exist and be a folder that this user can write in, and the path itself must not be a folder.
  • Refuse each case by name (a new code such as plan-out-unwritable), with PLAN_NOT_WRITTEN and the remedy: make the folder, or pass another --out.
  • Turn an OSError from write_lf into the same refusal, as a backstop for a race or a full disk.
  • For L1-79, print "plan written to" right after write_lf, or read what the report needs before the write.

Tests

  • Each of the three cases exits 2 with no traceback and makes no work directory. With an org/repo --source, the stub gh is never called.
  • The default --out in a current directory nobody can write in.
  • L1-79: with cat-file --batch failing, "plan written to" is printed.
  • Skip the permission cases where chmod cannot remove write permission.

Overlaps: lane 1's #796 also edits the top of cmd_plan's source handling.

Lane: openreposhape-1 (openRepoShape-1)

🤖 Generated with Claude Code

Activity

  1. added this to the v1.1.1 milestone on Oct 17, 2026
  2. brettheap commented on Oct 17, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoShape-1, session 300f8f46-004a-4e72-8587-4f192be2e108@Eagle, 2026-10-17T10:49:09Z, for #799

    Logged in lanes/log/openRepoShape-1.md at 6bafd3e6bc589e850c62d9f9a58f397e65466929.

    The three reads (lane-collision-protocol Rule 1):

    1. existing `CLAIMED —` comments on opensoft/openRepoShape#799:
       none
    2. `gh pr list --repo opensoft/openRepoShape --state all --search "#799"`, kept where the row or its body names `#799`:
       none
    3. `git ls-remote --heads [email protected]:opensoft/openRepoShape` branches naming `799` as a whole token:
       none
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions