Skip to content

feat(git/exec): a shared environment composer for git commands - #610

Merged
behinddwalls merged 1 commit into
mainfrom
preetam/git-exec-env-composer
Aug 19, 2026
Merged

feat(git/exec): a shared environment composer for git commands#610
behinddwalls merged 1 commit into
mainfrom
preetam/git-exec-env-composer

Conversation

@behinddwalls

@behinddwalls behinddwalls commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add Env(EnvOptions) as the single place that builds a git command's environment: the always-applied scrub set, plus transport variables inherited from the parent when set (SSH agent, PATH, TLS, proxy), plus caller-supplied literals appended last so they override. Re-express Command in terms of Env so there is one composer, not two.

This gives the change provider's repository and the Runway merger one source of truth to build on instead of each keeping its own copy of the scrub set and transport list. HOME is intentionally excluded from the shared transport list, since callers that isolate HOME and callers that inherit it disagree; each supplies it through Literal or Passthrough.

Test Plan

✅ new gitexec unit tests: scrub set always present, transport vars inherited only when set, literals override, and HOME is absent from the shared transport list. Existing Command consumers build unchanged.

Stack

  1. refactor(git): relocate platform/gitexec under platform/git #609
  2. @ feat(git/exec): a shared environment composer for git commands #610
  3. refactor(changeprovider): make the git provider pure logic over a contract #611
  4. refactor(merger): build the git command env from the shared composer #612
  5. refactor(runway): compose the checkout git env from gitexec #613

Base automatically changed from preetam/git-plumbing-relocate to main August 19, 2026 15:38
Add Env(EnvOptions) as the single place that builds a git command's environment: the always-applied scrub set, plus transport variables inherited from the parent when set (SSH agent, PATH, TLS, proxy), plus caller-supplied literals appended last so they override. Re-express Command in terms of Env so there is one composer, not two.

This gives the change provider's repository and the Runway merger one source of truth to build on instead of each keeping its own copy of the scrub set and transport list. HOME is intentionally excluded from the shared transport list, since callers that isolate HOME and callers that inherit it disagree; each supplies it through Literal or Passthrough.
@behinddwalls
behinddwalls force-pushed the preetam/git-exec-env-composer branch from 32d8a16 to 326a76b Compare August 19, 2026 15:38
@behinddwalls
behinddwalls added this pull request to the merge queue Aug 19, 2026
Merged via the queue into main with commit d89eb45 Aug 19, 2026
15 checks passed
@behinddwalls
behinddwalls deployed to stack-rebase August 19, 2026 17:10 — with GitHub Actions Active
@behinddwalls
behinddwalls deleted the preetam/git-exec-env-composer branch August 19, 2026 17:10
behinddwalls added a commit to behinddwalls/submitqueue that referenced this pull request Aug 19, 2026
## Summary

Move the shared git-exec package and its pinned-git test helper under a
single platform/git umbrella: platform/gitexec becomes
platform/git/exec, and platform/gitexec/gitexectest becomes
platform/git/exectest — a sibling rather than nested, so the path no
longer doubles "gitexec".

Package names are unchanged (gitexec, gitexectest), so this is an
import-path move only: no call sites and no behavior change. It is the
first step toward housing the change provider's bare-copy repo and auth
plumbing alongside the shared git-exec package.

## Test Plan

✅ `bazel build`/`test` of the moved packages and every importer; `make
check-gazelle` clean; grep confirms no `platform/gitexec` (old path)
imports remain.

## Stack
1. @ uber#609
1. uber#610
1. uber#611
1. uber#612
1. uber#613
behinddwalls added a commit to behinddwalls/submitqueue that referenced this pull request Aug 19, 2026
…tract (uber#611)

## Summary

Move the git transport plumbing — the bare local copy, fetch, commit
resolution, merge base, the git command environment — and the Auth
contract out of the change provider extension into platform/git/repo,
built on platform/git/exec. The provider now depends on a small
Repository interface it defines and holds no os/exec and no credential
handling: it parses the change URI, picks the stack baseline, reads the
diff and author, and shapes the result, nothing more.

Auth moves with the copy it configures, resolving the review point that
authentication did not belong in the change provider. The wiring's
tokenAuth now implements gitrepo.Auth and SetConfig is
gitrepo.SetConfig. Repository-plumbing tests move to platform/git/repo;
the provider's behavior tests stay and drive a real gitrepo.Repo through
the interface.

## Test Plan

✅ `//platform/git/...`,
`//submitqueue/extension/changeprovider/git/...`,
`//service/submitqueue/orchestrator/server/...` green (incl. the
three-step stack-baseline test); `provider.go` verified free of
`os/exec`.

## Stack
1. uber#609
1. uber#610
1. @ uber#611
1. uber#612
1. uber#613
behinddwalls added a commit to behinddwalls/submitqueue that referenced this pull request Aug 19, 2026
…ber#612)

## Summary

Replace the merger's inline command environment with gitexec.Env: the
isolated HOME/XDG and the pinned runtime paths stay as literals, while
the scrub set and the transport variables now come from
platform/git/exec, the one source of truth every git caller shares.
Delete the merger's own authEnvNames and passthroughEnv.

No control-flow change — the merger still owns its working-tree flow and
GitRuntime; only how each command's environment is assembled moves to
the shared composer.

## Test Plan

✅ full `//runway/extension/merger/git` suite green. Env-plumbing only —
no control-flow change to the land path.

## Stack
1. uber#609
1. uber#610
1. uber#611
1. @ uber#612
1. uber#613
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants