Fix server file workspace root
This commit is contained in:
@@ -2125,7 +2125,7 @@ func (svc *CoreService) ApproveServerConfigWriteForSession(sessionID string, app
|
||||
Capability: domain.JobCapabilityConfigWrite,
|
||||
TargetKey: approval.Key,
|
||||
InputRef: approval.ProposedContentInputRef,
|
||||
ExecutionInput: domain.JobExecutionInput{WorkspaceScope: svc.runtimeProfileScope(instance.ID), Content: approval.ProposedContent, ExpectedVersion: approval.ExpectedConfigVersion, ExpectedChecksum: preview.Checksum, MaxReadBytes: 64 * 1024},
|
||||
ExecutionInput: domain.JobExecutionInput{WorkspaceScope: svc.runtimeProfileScope(instance.ID), Content: approval.ProposedContent, ExpectedVersion: approval.ExpectedConfigVersion, ExpectedChecksum: preview.Checksum, MaxReadBytes: 64 * 1024, Deployment: deploymentPlanForDispatch(instance.Deployment)},
|
||||
IdempotencyKey: approval.IdempotencyKey,
|
||||
Progress: domain.JobProgress{Percent: 0, Message: "config write queued"},
|
||||
})
|
||||
@@ -2199,7 +2199,7 @@ func (svc *CoreService) DispatchFileOperationForSession(sessionID string, reques
|
||||
Capability: capability,
|
||||
TargetKey: request.Key,
|
||||
InputRef: request.InputRef,
|
||||
ExecutionInput: domain.JobExecutionInput{WorkspaceScope: svc.runtimeProfileScope(instance.ID), Content: content, ExpectedVersion: request.ExpectedConfigVersion, ExpectedChecksum: request.ExpectedChecksum, MaxReadBytes: 64 * 1024},
|
||||
ExecutionInput: domain.JobExecutionInput{WorkspaceScope: svc.runtimeProfileScope(instance.ID), Content: content, ExpectedVersion: request.ExpectedConfigVersion, ExpectedChecksum: request.ExpectedChecksum, MaxReadBytes: 64 * 1024, Deployment: deploymentPlanForDispatch(instance.Deployment)},
|
||||
IdempotencyKey: request.IdempotencyKey,
|
||||
Progress: domain.JobProgress{Percent: 0, Message: message},
|
||||
})
|
||||
|
||||
@@ -927,6 +927,7 @@ func TestPluginFileWorkspaceDoesNotConstrainServerFileDispatch(t *testing.T) {
|
||||
RunEndpointID: endpoint.ID,
|
||||
Name: "File Workspace Server",
|
||||
State: domain.ServerInstanceStateRunning,
|
||||
Deployment: domain.ServerDeploymentDefinition{Mode: domain.ServerDeploymentModeGuided, ServerRoot: `C:\scumserver`},
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("create server: %v", err)
|
||||
@@ -943,7 +944,7 @@ func TestPluginFileWorkspaceDoesNotConstrainServerFileDispatch(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatalf("dispatch declared file read: %v", err)
|
||||
}
|
||||
if allowed.Job.TargetKey != "scum-server-settings" || allowed.Job.Capability != domain.JobCapabilityFilesRead {
|
||||
if allowed.Job.TargetKey != "scum-server-settings" || allowed.Job.Capability != domain.JobCapabilityFilesRead || allowed.Job.ExecutionInput.Deployment == nil || allowed.Job.ExecutionInput.Deployment.ServerRoot != `C:\scumserver` {
|
||||
t.Fatalf("unexpected declared file dispatch: %+v", allowed)
|
||||
}
|
||||
unknown, err := svc.DispatchFileOperationForSession(ownerSession, domain.FileOperationDispatchRequest{
|
||||
@@ -965,7 +966,7 @@ func TestPluginFileWorkspaceDoesNotConstrainServerFileDispatch(t *testing.T) {
|
||||
Content: "line",
|
||||
IdempotencyKey: "idem-file-workspace-log-write",
|
||||
})
|
||||
if err != nil || written.Job.TargetKey != "scum-chat-log" || written.Job.Capability != domain.JobCapabilityFilesWrite {
|
||||
if err != nil || written.Job.TargetKey != "scum-chat-log" || written.Job.Capability != domain.JobCapabilityFilesWrite || written.Job.ExecutionInput.Deployment == nil || written.Job.ExecutionInput.Deployment.ServerRoot != `C:\scumserver` {
|
||||
t.Fatalf("expected declared log write to queue, dispatch=%+v err=%v", written, err)
|
||||
}
|
||||
}
|
||||
@@ -978,14 +979,14 @@ func TestServerFileListReportsFailedRuntimeRefresh(t *testing.T) {
|
||||
t.Fatalf("update file list capability: %v", err)
|
||||
}
|
||||
ownerSession := createServiceUserAndLogin(t, svc, domain.User{ID: "user-file-list-failure", DisplayName: "File List Failure", Email: "file-list-failure@example.test", Roles: []string{"server-owner"}, PasswordHash: "secret-password"})
|
||||
instance, err := svc.CreateServerInstanceForSession(ownerSession, domain.ServerInstance{ID: "server-file-list-failure", PluginID: plugin.ID, RunEndpointID: endpoint.ID, Name: "File List Failure Server", State: domain.ServerInstanceStateRunning})
|
||||
instance, err := svc.CreateServerInstanceForSession(ownerSession, domain.ServerInstance{ID: "server-file-list-failure", PluginID: plugin.ID, RunEndpointID: endpoint.ID, Name: "File List Failure Server", State: domain.ServerInstanceStateRunning, Deployment: domain.ServerDeploymentDefinition{Mode: domain.ServerDeploymentModeGuided, ServerRoot: `C:\scumserver`}})
|
||||
if err != nil {
|
||||
t.Fatalf("create server: %v", err)
|
||||
}
|
||||
createCompleteRuntimeBinding(t, svc, instance, "local")
|
||||
|
||||
refresh, err := svc.RefreshServerFileListForSession(ownerSession, domain.ServerFileListRequest{ServerInstanceID: instance.ID, DirectoryKey: "server-root", IdempotencyKey: "idem-file-list-failure"})
|
||||
if err != nil || refresh.State != "pending" || refresh.Job.ID == "" {
|
||||
if err != nil || refresh.State != "pending" || refresh.Job.ID == "" || refresh.Job.ExecutionInput.Deployment == nil || refresh.Job.ExecutionInput.Deployment.ServerRoot != `C:\scumserver` {
|
||||
t.Fatalf("refresh file list: result=%+v err=%v", refresh, err)
|
||||
}
|
||||
failedJob := refresh.Job
|
||||
|
||||
@@ -173,7 +173,7 @@ func (svc *CoreService) RefreshServerFileListForSession(sessionID string, reques
|
||||
Capability: domain.JobCapabilityFilesList,
|
||||
TargetKey: request.DirectoryKey,
|
||||
InputRef: "",
|
||||
ExecutionInput: domain.JobExecutionInput{WorkspaceScope: svc.runtimeProfileScope(ctx.Instance.ID), Inputs: map[string]string{
|
||||
ExecutionInput: domain.JobExecutionInput{WorkspaceScope: svc.runtimeProfileScope(ctx.Instance.ID), Deployment: deploymentPlanForDispatch(ctx.Instance.Deployment), Inputs: map[string]string{
|
||||
"directoryKey": request.DirectoryKey,
|
||||
"path": request.Path,
|
||||
"recursive": strconv.FormatBool(request.Recursive),
|
||||
@@ -229,7 +229,7 @@ func (svc *CoreService) UploadServerFileForSession(sessionID string, request dom
|
||||
Capability: domain.JobCapabilityFilesWrite,
|
||||
TargetKey: targetKey,
|
||||
InputRef: inputRef,
|
||||
ExecutionInput: domain.JobExecutionInput{WorkspaceScope: svc.runtimeProfileScope(ctx.Instance.ID), ExpectedChecksum: request.Checksum, Inputs: map[string]string{
|
||||
ExecutionInput: domain.JobExecutionInput{WorkspaceScope: svc.runtimeProfileScope(ctx.Instance.ID), Deployment: deploymentPlanForDispatch(ctx.Instance.Deployment), ExpectedChecksum: request.Checksum, Inputs: map[string]string{
|
||||
"directoryKey": request.DirectoryKey,
|
||||
"relativePath": relativePath,
|
||||
"filename": request.Filename,
|
||||
|
||||
Reference in New Issue
Block a user