Skip to content

Handle a Qualified --target Spelling Consistently in local_review #2109

Closed

Description

@ptr727

Problem

scripts/local_review.py treats --target as a branch name, and a value already spelled as a qualified ref is handled inconsistently across the engine. Each case below predates the #1235 change and was found by the local review passes on it.

  1. A refs/remotes/... target whose ref is absent falls through to the as-written step. target_ref then resolves the value with rev-parse, which also looks the full name up under refs/heads/, so a local branch literally named refs/remotes/upstream/main defines the review scope. The short spelling upstream/main refuses in the same repository.
  2. Other qualified spellings are still tried under origin/. --target remotes/origin/develop resolves to refs/remotes/origin/remotes/origin/develop where an origin branch carries that nested name, and --target refs/heads/develop resolves to refs/remotes/origin/refs/heads/develop rather than the local branch the caller named. Only the refs/remotes/ spelling skips the origin/ candidate.
  3. same_target does not match a qualified spelling. target_ref resolves develop and refs/remotes/origin/develop to the same ref, but same_target("develop", "refs/remotes/origin/develop") is false. A pass recorded with --target develop then does not cover check --target refs/remotes/origin/develop, and check reports a wrong-scope mismatch although the merge base and digest are identical. It fails closed.

Decision needed first

Whether a qualified spelling is in contract at all. The --target help calls the value a target branch. If qualified refs are out of contract, the fix is to refuse any value starting with refs/ or remotes/ with a message naming the branch form. If they are in contract, all three cases need the same normalization in one place, shared by target_ref and same_target.

Activity

  1. added
    bug
    pre-existing
    script
    on Sep 29, 2026
  2. ptr727 commented on Oct 23, 2026

    @ptr727
    OwnerAuthor

    Closed under the maintainer's decision (ptr727, 2026-10-23) on #3391: the backlog keeps real bugs with a stated failure, features the maintainer wants, and open decisions. A finding the review loop filed on code or text a change did not touch, a refactor or consolidation chore, a tracker, a wording item, or a guard shape no session has produced is closed rather than worked. Reopen with the input and the wrong result if this issue states one.

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

    bugpre-existingscript

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions