Skip to content

Drop the Unused leading_cd and moved Parameters From the Write Guard's Bare-Push Reader #3723

Closed

Description

@ptr727

Raised by the local strict review of #3722, the fix for #3716.

_bare_push_branch in host-setup/agent-safety/claude/gh-write-guard.py takes leading_cd and moved, and runs an if not moved branch that depends on them. Since #3722, both production callers pass the constants None, False: branch_of in _bypass_denial and the _push_repo_selftest harness. A cd reaches the function already resolved through _cd and _join_dir, never as leading_cd. So the two parameters are reached only from TestBarePushRootedDirectoryOnWindows in host-setup/agent-safety/claude/test_install.py, which tests a path the hook never takes.

#3722 kept the signature because test_install.py was held by an open pull request at the time.

Fix:

  • Reduce the function to (cwd, c_dirs, git_dir), composing _moved(_msys_drive_path(cwd), c_dirs).
  • Point the class's two -C tests at that form.
  • Rewrite its three cd tests to pass the directory _cd produces as cwd, or None where a rooted path with no drive stays unresolved on Windows.

Activity

  1. ptr727 commented on Nov 1, 2026

    @ptr727
    OwnerAuthor

    Decision needed (decision triage, 2026-11-01)

    Question: Is the cleanup approved that drops the unused leading_cd and moved parameters from _bare_push_branch in host-setup/agent-safety/claude/gh-write-guard.py and repoints TestBarePushRootedDirectoryOnWindows in test_install.py?

    Options, recommended first:

    1. Approve as proposed (recommended): The only production caller passes the constants None, False (gh-write-guard.py:922), so the if not moved path runs only in a test of a path the hook never takes. Read env's Directory and Environment Options in the Write Guard #3722 kept the signature because test_install.py was held by an open PR, and there are now no open PRs. Sequence it with Read a Bare Push's Branch After an Earlier Branch Switch in the Same Command in the Write Guard #3729/Decide Whether Every Bare Push With an Undetermined Repository Fails Closed in the Write Guard #3730, which edit the same function.
    2. Approve, fold into the Read a Bare Push's Branch After an Earlier Branch Switch in the Same Command in the Write Guard #3729/Decide Whether Every Bare Push With an Undetermined Repository Fails Closed in the Write Guard #3730 guard PR: Same cleanup in the PR that next rewrites _bare_push_branch, avoiding a merge conflict and giving one strict review over the function. Slightly mixes scope. No work in flight.
    3. Decline: Keeps dead parameters and a test of an unreachable path, with no reason left now the PR hold is gone. No work in flight.

    Evidence: Signature at gh-write-guard.py:779-785, the single call site at line 922, the test at test_install.py:2448 and 2472.

    Blocks: none

  2. added
    decision
    on Nov 1, 2026
  3. ptr727 commented on Nov 1, 2026

    @ptr727
    OwnerAuthor

    Maintainer answer (decision triage, 2026-11-01): Approved, folded in. Drop the unused leading_cd and moved parameters from _bare_push_branch and repoint TestBarePushRootedDirectoryOnWindows, in the same PR that implements #3729 and #3730. This agent-safety edit is approved for implementation.

  4. removed
    decision
    on Nov 1, 2026
  5. ptr727 commented on Nov 1, 2026

    @ptr727
    OwnerAuthor

    Released (2026-11-01): worktree and branch removed, so this claim holds no files. Its fix merged to develop in PR #3764. The issue closes when that is promoted.

    Backlog burndown claim (round 1, group G2). Branch: feature/burn-3729. Issues: #3729, #3730, #3723.

    Predicted file set:

    • host-setup/agent-safety/claude/gh-write-guard.py
    • host-setup/agent-safety/claude/test_install.py
    • host-setup/agent-safety/README.md
    • tests/test_guard_size.py

    This edits the agent-safety tree: the worker drives the pull request to the Merge Gate and does not merge it. The merge waits on the maintainer's go-ahead after reading the diff.

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

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions