Skip to content

adopt-project.py and tests/test_adopt_work_dir_refusal.py: follow-ups of PR #1065 (#978) from its review: the EEXIST guard and _same_entry that no test holds, and seven smaller gaps #1074

Closed

Description

@brettheap

(lane openRepoShape-1, 2026-10-20T18:09:37Z)

Found by: r1065, the independent review of PR #1065 (#978) at a4e179dd (#1065 issuecomment-6297782780). It found no MUST. The lane ruled that these go here, and that #1065 lands as it is. Line numbers are at a4e179dd. <A> is the probe's folder.

SHOULD: two guards that are right today and that no test holds

  • S1. The EEXIST guard on the "link to a non-directory" branch (adopt-project.py:15998, elif link is not None and exc.errno == errno.EEXIST:).
    • Mutant R9 drops the errno test, and all 59 tests still pass.
    • For w -> locked/x, where locked is mode 555, R9 says "it is a symbolic link that leads to <A>/locked/x, which is not a directory". Head rightly keeps the system's "(Permission denied)".
    • Add rows to tests/test_adopt_work_dir_refusal.py for w -> a-file/sub and for a link into a folder this user cannot write in. Each expects the system's words about root, with FIX.
  • S2. _same_entry (:15993, :16028) exists for a --work-dir spelled through a symlinked parent, and no test spells one.
    • Mutant R5 compares spellings instead of lstat results, and all 59 tests still pass. On Linux CI, tmp_path holds no symlink.
    • Add a row: --work-dir <A>/viadir/self, with viadir -> realdir and realdir/self -> self. Head says "...leads round a loop". R5 names the same link twice.

NIT

  • N1. On Python 3.12, _the_loop_in (:16023-16024) misses a loop when a link's target has .. after the loop (w -> loop/../d/self2). Head then says "which is not a directory". The fix is continue instead of return None after a stat that succeeds (r1065's R12), and relaxing the docstring's "the first symlink in root ... is that one". Python 3.13 and later do not hit it.
  • N2. The direct test of _the_loop_in (tests/test_adopt_work_dir_refusal.py:298) has no dangling-link row. Add ("dangling", "missing"), expecting None. That kills R3.
  • N3. No test pins "named as given, made absolute and not resolved". R19 (not made absolute) and R20 (abspath folding ..) both survive. Add a relative --work-dir row and a .. row.
  • N4. The fallback that names root is unpinned (R11 survives). Add a tofile/sub row, with tofile -> a-file.
  • N5. Wording: --work-dir <A>/nothere/../self says "the way to it leads round a loop, at the symbolic link <A>/self", but as the tool reads it, that path is the link itself. The way out is right.
  • N6. Windows: _the_loop_in tests only errno.ELOOP, while the module counts winerror 1921 as Windows' "cannot resolve" (_ABSENT_WINERRORS, :1704). Accepting it too is a cheap hedge, not measured.
  • N7. The body's "Not in this PR" list leaves out --work-dir tofile/sub, a path through a link to a file, which still says "(Not a directory)" as on base.

Lane: openreposhape-1 (openRepoShape-1)

Activity

  1. brettheap commented on Oct 21, 2026

    @brettheap
    ContributorAuthor

    CLAIMED — lane openRepoShape-1, session 300f8f46-004a-4e72-8587-4f192be2e108@Eagle, 2026-10-21T10:38:27Z, for #1074

    Logged in lanes/log/openRepoShape-1.md at 65997d4ae825f89be0f38c093dba698be60b83bb.

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

    1. existing `CLAIMED —` comments on opensoft/openRepoShape#1074:
       none
    2. `gh pr list --repo opensoft/openRepoShape --state all --search "#1074"`, kept where the row or its body names `#1074`:
       none
    3. `git ls-remote --heads [email protected]:opensoft/openRepoShape` branches naming `1074` as a whole token:
       none
    
  2. added this to the v1.2.1 milestone on Oct 23, 2026
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