Skip to content

One exact-ref reader for git ls-remote output - #9687

Merged
orbit-agent-01 merged 1 commit into
agent-mainfrom
orbit/ORB-25024-9e2a1278
Nov 15, 2026
Merged

orbit-agent-01 merged 1 commit into
agent-mainfrom
orbit/ORB-25024-9e2a1278

Conversation

@orbit-agent-01

Copy link
Copy Markdown
Contributor

Task

ORB-25024 — One exact-ref reader for git ls-remote output

Description

Outcome. One function in crates/orbit-engine/src/executor/automation/vcs/remote_probe.rs returns the SHA of the line whose ref equals an exact full ref name in git ls-remote output, and every reader uses it. It encodes an invariant: git matches ls-remote patterns against slash-delimited tails, so refs/heads/x/refs/heads/<b> can be listed for refs/heads/<b> (the doc comment on exact_remote_branch_sha; ORB-24726).

Evidence (pinned agent-main 046958492249).

  • crates/orbit-engine/src/executor/automation/vcs/remote_probe.rs:138-145 exact_remote_branch_sha(stdout, branch): builds refs/heads/<branch>, whitespace split, exact compare.
  • crates/orbit-engine/src/executor/automation/vcs/pr/head_lag.rs:192-195 (in remote_ref_sha): tab split, exact compare against any reference, returns String.
  • crates/orbit-engine/src/executor/automation/vcs/pr/source_identity.rs:217-221 (in verify_publication): tab split, exact compare, returns &str.
  • crates/orbit-engine/src/executor/automation/vcs/pr/infrastructure.rs:85-101 (exact_remote check): runs ls-remote --heads origin refs/heads/<b> and takes the first whitespace token of the whole output, with no ref-name check.

Behavioural differences and resolution.

Copy Split Ref matched Returns Resolution
remote_probe whitespace refs/heads/<branch> only Option<String> Unified: generalise to exact_remote_ref_sha(stdout, full_ref); keep exact_remote_branch_sha as a thin wrapper or update its callers
head_lag tab any full ref Option<String> Unified on the shared function (ls-remote separates with a tab, so results are identical)
source_identity tab full ref Option<&str> Unified; the evidence JSON shape (sha via safe_text) is unchanged
infrastructure first token of output none compares to evidence.head_sha Unified to exact match: a tail-matched unrelated ref no longer stands in for the head. This is the one intended behaviour change, a tightening; the "changed or was deleted" stop and its Deadline::execute budget are kept

Scope and non-goals. Parsing only; probes, retries and deadlines stay. Estimated net: about −10 lines; value is one owner for the invariant.

Conventions

  • Behaviour-preserving. CLI, MCP, HTTP API, plugin protocol, goldens and
    persisted serde shapes stay identical unless this task names the change.
  • Delete dead code together with its tests, docs and config entries. Leave no
    allow(dead_code) behind.
  • Unify duplicates into the lowest crate that owns the concept per
    ARCHITECTURE.md. A new crate edge updates ARCHITECTURE.md and
    scripts/check-dependency-direction.sh in the same change.
  • A behavioural difference between copies that this task does not list is a
    stop-and-report, not a judgement call.
  • No layout-only moves; code-org-sweep owns those. Narrow visibility in
    code you touch.

Acceptance Criteria

  • remote_probe.rs, pr/head_lag.rs, pr/source_identity.rs and pr/infrastructure.rs read ls-remote output through one exact-ref function; infrastructure.rs no longer takes the first token without a ref-name check.
  • Every listed behavioural difference is handled exactly as the description's table specifies; no other behaviour changes.
  • The focused tests for each affected surface pass (the listed engine/runtime test targets), Clippy is clean on the touched crates, and make goldens passes with goldens unchanged (the required PR checks gate the full suite; AGENTS.md Gates).
  • A word-boundary grep for each deleted identifier finds nothing in crates/, plugin/ or scripts/.
  • The execution summary reports the net line delta and lists every non-mechanical edit with its reason.

Execution Summary

Click to expand

ORB-25024 execution summary

One exact-ref reader for git ls-remote output. All four readers now go through
a single shared parser; the only intended behaviour change is the infrastructure
check tightening named in the brief.

What changed (4 files, +26/−21, net +5)

  • crates/orbit-engine/src/executor/automation/vcs/remote_probe.rs
    • Added pub(super) fn exact_remote_ref_sha(stdout, full_ref) -> Option<String>:
      whitespace split, exact full-ref compare. It owns the tail-match invariant
      (git matches ls-remote patterns against slash-delimited tails, so
      refs/heads/x/refs/heads/<b> must not stand in for refs/heads/<b>).
    • Kept exact_remote_branch_sha(stdout, branch) as a thin wrapper over it
      (per the brief's allowed option), so the existing divergence.rs caller is
      untouched.
    • Updated the remote_ref_output doc line to point at the shared parser.
  • crates/orbit-engine/src/executor/automation/vcs/pr/head_lag.rs
    • remote_ref_sha now returns exact_remote_ref_sha(&probe.stdout, reference)
      instead of its own tab-split closure. Tab-separated ls-remote output is
      matched identically by the whitespace split; probe/error/budget handling
      unchanged.
  • crates/orbit-engine/src/executor/automation/vcs/pr/source_identity.rs
    • verify_publication uses exact_remote_ref_sha; adapted the projection to
      sha.as_deref().map(safe_text). Evidence JSON shape (sha via safe_text)
      unchanged.
  • crates/orbit-engine/src/executor/automation/vcs/pr/infrastructure.rs
    • exact_remote builds reference = refs/heads/<head_branch> once, passes it
      to ls-remote --heads and checks
      exact_remote_ref_sha(&remote.stdout, &reference) against
      evidence.head_sha. A tail-matched unrelated ref no longer stands in for
      the head; the "changed or was deleted" stop and the Deadline::execute
      budget are kept. This is the one intended behaviour change (a tightening).

No new crate edge (all within orbit-engine), so no ARCHITECTURE.md or
scripts/check-dependency-direction.sh change. No behavioural difference beyond
the table; the fifth exact_remote_branch_sha caller (freshness/divergence.rs)
already used the shared wrapper and is behaviour-identical.

Acceptance criteria

  1. All four files read ls-remote output through one exact-ref function; the
    infrastructure first-token-without-ref-check is gone — met (grep shows all
    four reference exact_remote_ref_sha; no split_once('\t') or bare
    split_whitespace().next() remains in those files).
  2. Every listed behavioural difference handled exactly per the table; no other
    behaviour changes — met (whitespace/tab equivalence via the shared split;
    &str→String adaptation keeps the evidence shape; only the named
    infrastructure tightening).
  3. Focused tests pass, Clippy clean, make goldens passes with goldens
    unchanged — met (see Validation; git status shows only the 4 source files).
  4. Word-boundary grep for each deleted identifier finds nothing — met
    vacuously: no named identifier was deleted (remote_ref_sha,
    exact_remote, exact_remote_branch_sha all kept by design; the removed
    duplicates were anonymous inline closures).
  5. This summary reports the net delta and every non-mechanical edit — met here.

Validation (all in-worktree, foreground)

  • passed: cargo fmt --all -- --check
  • passed: make ci-guards
  • passed: scripts/build-budget.py -- cargo clippy -p orbit-engine --lib --bins -- -D warnings -A clippy::disallowed_methods
  • passed: scripts/build-budget.py -- cargo clippy -p orbit-engine --all-targets -- -D warnings -A clippy::disallowed_methods
  • passed: RUSTDOCFLAGS="-D warnings" scripts/with-test-build-lint.sh scripts/build-budget.py -- cargo doc --no-deps -p orbit-engine
  • passed: cargo test -p orbit-engine --lib executor::automation::vcs::tests::remote_probe
    (1 passed; exercises the new shared fn through remote_branch_sha with
    tab-separated ls-remote output)
  • passed: make goldens (exit 0; no golden files in the diff)
  • passed: git diff --check
  • not_run: full PR suite / test shards (required PR checks gate the full suite
    per AGENTS.md Gates; focused coverage above is green)

Reconciliation

  • Delivery paths (tracked modifications, all within the task selectors):
    crates/orbit-engine/src/executor/automation/vcs/remote_probe.rs,
    crates/orbit-engine/src/executor/automation/vcs/pr/head_lag.rs,
    crates/orbit-engine/src/executor/automation/vcs/pr/source_identity.rs,
    crates/orbit-engine/src/executor/automation/vcs/pr/infrastructure.rs.
  • No paths outside the task's selectors; no context_files change needed.
  • Cleanup: one self-started background make goldens probe was terminated
    before re-running it in the foreground to completion; no scratch files written
    outside .orbit/tmp/; this summary file is the only new untracked path and it
    lives under .orbit/tmp/ (git-ignored, not delivered).
  • Leftovers: none. Changes left uncommitted for the pipeline.

Risks / deviations

  • None. No deviation from the workspace guide; the brief's estimated −10 net
    lines became +5 because the invariant docs plus wrapper were kept explicitly
    (allowed option) and formatting split one long line.

Validation

  • Not reported

Branch Freshness

  • Base ref: refs/remotes/origin/agent-main
  • Head ref: orbit/ORB-25024-9e2a1278
  • Behind base: 0
  • Ahead of base: 1

@orbit-agent-01 orbit-agent-01 added the orbit orbit related label Nov 15, 2026
@orbit-agent-01
orbit-agent-01 merged commit 9dc8233 into agent-main Nov 15, 2026
19 checks passed
@orbit-agent-01
orbit-agent-01 deleted the orbit/ORB-25024-9e2a1278 branch November 15, 2026 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

orbit orbit related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant