Repository navigation
One exact-ref reader for git ls-remote output - #9687
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.rsreturns the SHA of the line whose ref equals an exact full ref name ingit ls-remoteoutput, and every reader uses it. It encodes an invariant: git matches ls-remote patterns against slash-delimited tails, sorefs/heads/x/refs/heads/<b>can be listed forrefs/heads/<b>(the doc comment onexact_remote_branch_sha; ORB-24726).Evidence (pinned agent-main
046958492249).crates/orbit-engine/src/executor/automation/vcs/remote_probe.rs:138-145exact_remote_branch_sha(stdout, branch): buildsrefs/heads/<branch>, whitespace split, exact compare.crates/orbit-engine/src/executor/automation/vcs/pr/head_lag.rs:192-195(inremote_ref_sha): tab split, exact compare against anyreference, returnsString.crates/orbit-engine/src/executor/automation/vcs/pr/source_identity.rs:217-221(inverify_publication): tab split, exact compare, returns&str.crates/orbit-engine/src/executor/automation/vcs/pr/infrastructure.rs:85-101(exact_remotecheck): runsls-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.
refs/heads/<branch>onlyOption<String>exact_remote_ref_sha(stdout, full_ref); keepexact_remote_branch_shaas a thin wrapper or update its callersOption<String>Option<&str>shaviasafe_text) is unchangedevidence.head_shaDeadline::executebudget are keptScope and non-goals. Parsing only; probes, retries and deadlines stay. Estimated net: about −10 lines; value is one owner for the invariant.
Conventions
Acceptance Criteria
remote_probe.rs,pr/head_lag.rs,pr/source_identity.rsandpr/infrastructure.rsread ls-remote output through one exact-ref function;infrastructure.rsno longer takes the first token without a ref-name check.make goldenspasses with goldens unchanged (the required PR checks gate the full suite; AGENTS.md Gates).crates/,plugin/orscripts/.Execution Summary
Click to expand
ORB-25024 execution summary
One exact-ref reader for
git ls-remoteoutput. All four readers now go througha 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.rspub(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 forrefs/heads/<b>).exact_remote_branch_sha(stdout, branch)as a thin wrapper over it(per the brief's allowed option), so the existing
divergence.rscaller isuntouched.
remote_ref_outputdoc line to point at the shared parser.crates/orbit-engine/src/executor/automation/vcs/pr/head_lag.rsremote_ref_shanow returnsexact_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.rsverify_publicationusesexact_remote_ref_sha; adapted the projection tosha.as_deref().map(safe_text). Evidence JSON shape (shaviasafe_text)unchanged.
crates/orbit-engine/src/executor/automation/vcs/pr/infrastructure.rsexact_remotebuildsreference = refs/heads/<head_branch>once, passes itto
ls-remote --headsand checksexact_remote_ref_sha(&remote.stdout, &reference)againstevidence.head_sha. A tail-matched unrelated ref no longer stands in forthe head; the "changed or was deleted" stop and the
Deadline::executebudget are kept. This is the one intended behaviour change (a tightening).
No new crate edge (all within
orbit-engine), so noARCHITECTURE.mdorscripts/check-dependency-direction.shchange. No behavioural difference beyondthe table; the fifth
exact_remote_branch_shacaller (freshness/divergence.rs)already used the shared wrapper and is behaviour-identical.
Acceptance criteria
infrastructure first-token-without-ref-check is gone — met (grep shows all
four reference
exact_remote_ref_sha; nosplit_once('\t')or baresplit_whitespace().next()remains in those files).behaviour changes — met (whitespace/tab equivalence via the shared split;
&str→Stringadaptation keeps the evidence shape; only the namedinfrastructure tightening).
make goldenspasses with goldensunchanged — met (see Validation;
git statusshows only the 4 source files).vacuously: no named identifier was deleted (
remote_ref_sha,exact_remote,exact_remote_branch_shaall kept by design; the removedduplicates were anonymous inline closures).
Validation (all in-worktree, foreground)
cargo fmt --all -- --checkmake ci-guardsscripts/build-budget.py -- cargo clippy -p orbit-engine --lib --bins -- -D warnings -A clippy::disallowed_methodsscripts/build-budget.py -- cargo clippy -p orbit-engine --all-targets -- -D warnings -A clippy::disallowed_methodsRUSTDOCFLAGS="-D warnings" scripts/with-test-build-lint.sh scripts/build-budget.py -- cargo doc --no-deps -p orbit-enginecargo test -p orbit-engine --lib executor::automation::vcs::tests::remote_probe(1 passed; exercises the new shared fn through
remote_branch_shawithtab-separated ls-remote output)
make goldens(exit 0; no golden files in the diff)git diff --checkper AGENTS.md Gates; focused coverage above is green)
Reconciliation
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.context_fileschange needed.make goldensprobe was terminatedbefore 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 itlives under
.orbit/tmp/(git-ignored, not delivered).Risks / deviations
lines became +5 because the invariant docs plus wrapper were kept explicitly
(allowed option) and formatting split one long line.
Validation
Branch Freshness
refs/remotes/origin/agent-mainorbit/ORB-25024-9e2a1278