Repository navigation
feat(gates): own the git process and the engine list in internal/workspace - #619
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The new gates have matching and allowance gaps that permit ownership-rule bypasses.
2 open findings
What changed in this PR
Adds workspace ownership for engine selection and Git subprocess creation.
Changes:
- Introduces ordered engine selection in
Changes. - Adds and tests structure ownership gates.
- Updates the architecture specification.
| File | Description |
|---|---|
internal/workspace/workspace.go |
Walks the ordered engine list. |
internal/gates/structure.go |
Adds ownership rules for Git and engines. |
internal/gates/structure_test.go |
Tests the new structure rules. |
docs/architecture.md |
Documents the ownership constraints. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
andybons
force-pushed
the
feat/workspace-engine-list
branch
from
October 14, 2026 03:55
70e3bba to
94d14c0
Compare
andybons
force-pushed
the
feat/workspace-engine-interface
branch
from
October 14, 2026 03:55
c42dedd to
0e3a493
Compare
andybons
changed the base branch from
feat/workspace-engine-interface
to
main
October 14, 2026 04:10
…space Problem: nothing stops other code from starting git or from walking engines in its own order, so the engine seam can leak. Design: Changes walks one ordered engineList, and the first engine that opens the directory answers. Two structure rules own the seam: git_subprocess lets only the git helpers of internal/workspace and internal/gates call exec with the program git, and engine_list_walker lets only Changes name engineList. The spec Structure row lists both. Semantic change: none. The list holds the git engine only. Verification: new structure rows failed first with no violation, and pass with the rules. go build, go vet, go test -race ./..., gofmt.
…tion exactly
Problem: git_subprocess matched a literal git anywhere in the arguments, so exec.Command("echo", "git") failed and a program held in a constant passed. engine_list_walker exempted every top-level declaration of workspace.go, so a package-level copy of the list passed.
Design: git_subprocess checks the program argument only (Args[0], or Args[1] for CommandContext). It compares the value with strconv.Unquote, so a raw string counts, and it resolves a constant or a package-level variable of the same package or of the module, such as protocol.EngineGit. A local variable is not resolved. engine_list_walker exempts the defining identifier of the list and the walker function, and no other declaration.
Semantic change: none at run time.
Verification: structure rows for a raw string, a constant, a package variable, protocol.EngineGit, a local variable, echo with a git argument, and a top-level copy of the list failed first and pass now. TestStructureOfTheRepository passes on the tree.
andybons
force-pushed
the
feat/workspace-engine-list
branch
from
October 14, 2026 04:11
94d14c0 to
98a50bd
Compare
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.

Problem
Nothing stops other code from starting
gitor from walking engines in its own order, so the engine seam can leak. This is VCS step 6, PR 3 ofvcs-engine-plan.mdsection 5. It is based on #618.Design
Spec: docs/architecture.md
workspace(the engine list) andCI gates(theStructurerow).Changeswalks one orderedengineList, and the first engine whoseOpenreports a work tree answers. The list holds the git engine only. Two structure rules own the seam ininternal/gates/structure.go:git_subprocesschecks the program argument only (Args[0], orArgs[1]forCommandContext), compares it withstrconv.Unquote, and follows string constants and package-level variables of the module, such asprotocol.EngineGit; it lets onlygitCmdandgitCmdMagicPathspecsofinternal/workspace/git.go, and thegithelper ofinternal/gates/git.go, callos/execwith the programgit;engine_list_walkerskips the defining identifier ofengineListand lets only the walker function name it; a package-level copy fails. Each engine owns its detection marker, so the list order does not assume that two engines share a marker.Semantic change
None at run time.
Verification
Two new structure rows failed first with no violation (
violations = [], want [git_subprocess:... ]), then pass with the rules: a strayexec.Command("git")and a stray use ofengineListfail the gate, and the owners pass.TestStructureOfTheRepositorypasses on the tree.golangci-lint run ./...reports 0 issues.go build ./... && go vet ./... && go test -race ./... && test -z "$(gofmt -l .)"passes.CI job times
No job grew by more than 5 s. The new gate rows run in milliseconds inside the Unit job.