Skip to content

feat(gates): own the git process and the engine list in internal/workspace - #619

Merged
andybons merged 2 commits into
mainfrom
feat/workspace-engine-list
Oct 14, 2026
Merged

andybons merged 2 commits into
mainfrom
feat/workspace-engine-list

Conversation

@andybons

@andybons andybons commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Nothing stops other code from starting git or from walking engines in its own order, so the engine seam can leak. This is VCS step 6, PR 3 of vcs-engine-plan.md section 5. It is based on #618.

Design

Spec: docs/architecture.md workspace (the engine list) and CI gates (the Structure row).

Changes walks one ordered engineList, and the first engine whose Open reports a work tree answers. The list holds the git engine only. Two structure rules own the seam in internal/gates/structure.go: git_subprocess checks the program argument only (Args[0], or Args[1] for CommandContext), compares it with strconv.Unquote, and follows string constants and package-level variables of the module, such as protocol.EngineGit; it lets only gitCmd and gitCmdMagicPathspecs of internal/workspace/git.go, and the git helper of internal/gates/git.go, call os/exec with the program git; engine_list_walker skips the defining identifier of engineList and 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 stray exec.Command("git") and a stray use of engineList fail the gate, and the owners pass. TestStructureOfTheRepository passes on the tree. golangci-lint run ./... reports 0 issues. go build ./... && go vet ./... && go test -race ./... && test -z "$(gofmt -l .)" passes.

CI job times

Job main (s) PR (s)
Browser 115 103
Contract 93 70
Gates 41 30
Node wasm 84 64
Runtime contract 57 47
Static 49 40
Unit 71 65
WebAssembly 30 25

No job grew by more than 5 s. The new gate rows run in milliseconds inside the Unit job.

Copilot AI balanced review requested due to automatic review settings October 14, 2026 03:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

Comment thread internal/gates/structure.go Outdated
Comment thread internal/gates/structure.go Outdated
@andybons
andybons force-pushed the feat/workspace-engine-list branch from 70e3bba to 94d14c0 Compare October 14, 2026 03:55
@andybons
andybons force-pushed the feat/workspace-engine-interface branch from c42dedd to 0e3a493 Compare October 14, 2026 03:55
@andybons
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
andybons force-pushed the feat/workspace-engine-list branch from 94d14c0 to 98a50bd Compare October 14, 2026 04:11
@andybons
andybons merged commit 776a0a7 into main Oct 14, 2026
8 checks passed
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