Skip to content

adopt-project.py: remove the temp work roots it makes without --work-dir, keep a recorded --source clone, and point the tests' TMPDIR at their basetemp #526

Closed

Description

@brettheap

Without --work-dir, every plan, check and execute leaves an openreposhape-adopt-* directory in the system temp folder, and plan --source records a clone there that the OS may later remove. The tool half and the test half land together.

From the v1.1.0 triage of the v1.0.0 known limits on #457 and #461. One pull request covers the lines below.

Lines

  • Without --work-dir, each plan, check and execute leaves an openreposhape-adopt-* temp dir; execute's holds full working trees. Where: adopt-project.py _work_root. Effort S; all. On main 3121945: _work_root still tempfile.mkdtemp with no removal; the file's only rmtree calls are a scratch dir and the symlink probe. (source)
  • plan --source org/repo records a temp clone; once the OS cleans it, check and execute refuse source-unclonable. Where: adopt-project.py Plan.open_source. Effort S; all. On main 3121945: open_source prefers local_path over repository (adopt-project.py:2880). (source)
  • Test runs leave one openreposhape-adopt-* dir per adopt plan/check/execute in the system temp folder. Where: tests/conftest.py (no TMPDIR fixture); adopt-project.py:8780-8784 _work_root. Effort S; all. On main 3121945: Cost to the team: the only autouse fixture in conftest.py is gh_guard (:763), no adopt suite sets TMPDIR, and _work_root still mkdtemps with no cleanup (the tool-side half is Tracking: adopt-project.py, converting an existing repository in place #457's). (source)

Each line above is marked → this issue on its tracking issue. Tick it there too when this closes.

The lines as written on the tracking issues

plan, check and execute each make a fresh openreposhape-adopt-XXXXXXXX directory in the system temp folder when --work-dir is not given (_work_root, adopt-project.py:6028-6032, called at :2088, :3543 and :5100) and nothing ever removes it: plan and check of a local source leave it empty, execute leaves both legs' and the split's working trees in it, and 2,992 of the first 3,000 such directories in one container's /tmp (15,206 in all) are empty. Direction: remove a work root that holds nothing when the command ends, and say where execute's stays.
— #457, body

plan --source <org/repo> without --work-dir clones into a temporary directory and records that path. If the directory is cleaned before check or execute, they refuse source-unclonable with text about the repository's name. Passing --source again recovers.
— #457, comment

The test suite never points TMPDIR at its own scratch for the adopt runs (tests/conftest.py sets none, and no adopt suite does; the five that set it are test_cli_reference, test_family_add_refusals and three scaffold suites), so every plan, check and execute a test runs without --work-dir leaves an openreposhape-adopt-* directory in the system temp folder, outside pytest's tmp_path retention: 15,206 sit in one container's /tmp (2,992 of the first 3,000 empty), 226,165 on the family pass's machine. Direction: one autouse fixture pointing TMPDIR into the session's basetemp; the tool-side half is the first line under #457.
— #461, body

Activity

  1. added this to the v1.1.0 milestone on Oct 14, 2026
  2. brettheap commented on Oct 14, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoShape-1, session 300f8f46-004a-4e72-8587-4f192be2e108@Eagle, 2026-10-14T22:32:48Z, for #526

    Logged in lanes/log/openRepoShape-1.md at bec5ac4556bc9497128271b54c57407917b41275.

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

    1. existing `CLAIMED —` comments on opensoft/openRepoShape#526:
       none
    2. `gh pr list --repo opensoft/openRepoShape --state all --search "#526"`, kept where the row or its body names `#526`:
       none
    3. `git ls-remote --heads git@github.com:opensoft/openRepoShape` branches naming `526` 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