fix(worktree): bind publication to dispatch grants
Worktree RPC used to accept repository coordinates from the sandbox. It now accepts only an opaque per-dispatch grant, and the daemon derives the repository path and branch from grant-owned state. Repository worktree paths also move from an ambiguous flattened key to encoded owner/repo components. Origin-matched legacy clones migrate safely; mismatched legacy paths are preserved.
This commit is contained in:
1 parent
7df2ae3626
commit
dbb6550ab3
19 files changed
+494
-175
No files matched your search
@@ -24,6 +24,7 @@ func TestRequestJSONRoundTrip(t *testing.T) {
|
||||
Providers: map[string]agentexec.Provider{
|
||||
"anthropic": {Class: "anthropic", APIKeyEnv: "ANTHROPIC_API_KEY"},
|
||||
},
|
||||
WorktreeGrant: "grant",
|
||||
}
|
||||
|
||||
data, err := json.Marshal(req)
|
||||
@@ -48,6 +49,9 @@ func TestRequestJSONRoundTrip(t *testing.T) {
|
||||
if got.Providers["anthropic"].APIKeyEnv != "ANTHROPIC_API_KEY" {
|
||||
t.Fatalf("Providers did not round-trip: %+v", got.Providers)
|
||||
}
|
||||
if got.WorktreeGrant != "grant" {
|
||||
t.Fatalf("WorktreeGrant did not round-trip: %q", got.WorktreeGrant)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRequestValidateRequiresPositiveTaskID(t *testing.T) {
|
||||
@@ -59,7 +63,8 @@ func TestRequestValidateRequiresPositiveTaskID(t *testing.T) {
|
||||
{name: "missing task", wantErr: true},
|
||||
{name: "zero ID", request: Request{Task: &store.Task{}}, wantErr: true},
|
||||
{name: "negative ID", request: Request{Task: &store.Task{ID: -1}}, wantErr: true},
|
||||
{name: "positive ID", request: Request{Task: &store.Task{ID: 1}}},
|
||||
{name: "missing worktree grant", request: Request{Task: &store.Task{ID: 1}}, wantErr: true},
|
||||
{name: "valid request", request: Request{Task: &store.Task{ID: 1}, WorktreeGrant: "grant"}},
|
||||
} {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
err := test.request.Validate()
|
||||
|
||||
Reference in new issue
Block a user