Skip to content

docs(workspace): specify the Engine seam for the work-tree diff - #617

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

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

Conversation

@andybons

@andybons andybons commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The spec describes GET /workspace/changes as a git diff, so a second version-control engine has no contract to meet. The plan is VCS step 6, vcs-engine-plan.md section 5, PR 1.

Design

Spec: docs/architecture.md Internal packages (the internal/workspace row), Runtime (WorkspaceChanges), and workspace.

The spec names the Engine and Repo interfaces that internal/workspace consumes. Repo carries no storage path, so an engine can keep its data in any form. workspace.Changes owns the scope check, the path containment, and the 28 s budget, and it is the only code that walks one ordered engine list. Each engine owns its detection marker, and the order does not assume that two engines share a marker. No code branches on an engine name. The git behavior (private index, private object directory, empty tree, merge base) moves into one git engine bullet. branch becomes an optional label that the engine fills. The spec gives the exact method sets of Engine and Repo, the no-match signal of Open (ok false with a nil error means "not this engine"; a non-nil error ends the request), and the engine-neutral read rule: a read may snapshot the working copy, adds no operation when nothing changed, and writes no index, reference, or object that a user could see. The structure-gate row and the contract table are described in the PRs that build them. The stack #617 to #622 merges back to back, so main matches the spec at the end.

Semantic change

None for clients. head, base.sha, and not_a_git_repo stay deprecated and are not removed. This PR changes only the spec.

Verification

go test -race ./internal/gates/ passes (112 s for the package; the CI Gates job runs only TestRepository).

CI job times

Job main (s) PR (s)
Browser 115 99
Contract 93 75
Gates 41 33
Node wasm 84 45
Runtime contract 57 40
Static 49 41
Unit 71 60
WebAssembly 30 23

No job grew by more than 5 s. The change adds no test.

Problem: the spec describes GET /workspace/changes as a git diff, so a second version-control engine has no contract to meet.

Design: the spec names the Engine and Repo interfaces that internal/workspace consumes, the ordered engine list that only Changes walks, and the detection marker that each engine owns. Repo carries no storage path. The git behavior moves into a git engine bullet. Branch becomes an optional label.

Semantic change: none for clients. head, base.sha, and not_a_git_repo stay deprecated.

Verification: go test -race ./internal/gates/.
Copilot AI balanced review requested due to automatic review settings October 14, 2026 03:05

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 spec claims an unimplemented engine seam and does not define its concrete interface contract.

2 open findings
What changed in this PR

Generalizes workspace-change architecture from git-specific behavior to a consumer-owned VCS engine seam.

Changes:

  • Defines conceptual Engine and Repo responsibilities.
  • Separates generic workspace behavior from git-specific behavior.
  • Preserves existing response fields and errors.
File Description
docs/​architecture.md Specifies the engine-neutral workspace diff architecture.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread docs/architecture.md Outdated
Comment thread docs/architecture.md Outdated
Problem: the spec names the Engine operations without signatures or a no-match signal, and it says a read never changes the repository, which an engine that snapshots its working copy cannot meet.

Design: the spec shows the Engine, Repo, Head, and Base method sets, states that Open returns ok false with a nil error for a directory that is not its kind and that a non-nil error ends the request, and states that only a missing base wraps ErrNoBase. The read rule becomes engine-neutral: a read may snapshot the working copy, adds no operation when nothing changed, and writes no index, reference, or object a user could see. Two sentences are reworded.

Semantic change: none for clients.

Verification: go test ./internal/gates/.
@andybons
andybons merged commit 3570d96 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