forked from longtao.wu/droboticflow
🛠️ Preserve inline outputs for scoped organizations
This commit is contained in:
parent
88e6d08ef0
commit
cfbb451879
@ -41,7 +41,7 @@ ancestor as `poc-org-storage`. It carries the storage feature without the unrela
|
||||
schema retirement. It never merges or deploys Fanyu/dev code. Build images only
|
||||
under `dataflow-poc`; client packages are not installed by this rollout.
|
||||
|
||||
Release build version is `1.0.17`, following the previous generated POC `1.0.16`.
|
||||
Release build version is `1.0.18`; `1.0.17` was built first, then an inline-artifact regression was corrected before final rollout.
|
||||
The main `poc` branch should receive the additive provisioning changes as well, so
|
||||
a future full cutover keeps the same new-organization policy.
|
||||
|
||||
|
||||
@ -258,6 +258,20 @@ func (runtime *Runtime) normalizeOutputArtifacts(ctx context.Context, workflow *
|
||||
result := make([]domain.ExecutionArtifact, len(artifacts))
|
||||
for index, artifact := range artifacts {
|
||||
result[index] = artifact
|
||||
if artifact.Payload != nil && artifact.Payload.Mode == domain.ArtifactTransferModeInline {
|
||||
if err := domain.ValidateArtifactPayload(*artifact.Payload, artifact.Type); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
continue
|
||||
}
|
||||
if artifact.Type == domain.PortTypeJSON && artifact.Path == "" && artifact.Data != nil {
|
||||
inline := domain.ArtifactPayload{Mode: domain.ArtifactTransferModeInline, Type: domain.PortTypeJSON, Inline: artifact.Data}
|
||||
if err := domain.ValidateArtifactPayload(inline, artifact.Type); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result[index].Payload = &inline
|
||||
continue
|
||||
}
|
||||
if artifact.Payload != nil && artifact.Payload.Mode == domain.ArtifactTransferModeRef {
|
||||
if err := domain.ValidateArtifactPayload(*artifact.Payload, artifact.Type); err != nil {
|
||||
return nil, fmt.Errorf("artifact_ref_invalid: %w", err)
|
||||
|
||||
@ -1901,7 +1901,7 @@ func (runtime *Runtime) resolveScanWorkflow(ctx context.Context, workflow *domai
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if organization != nil && organization.StorageRootPrefix != "" && (workflow.ScanConfig.ConnectionID != organization.StorageConnectionID || !strings.EqualFold(workflow.ScanConfig.DataSource, "BOS")) {
|
||||
if organization != nil && organization.StorageRootPrefix != "" && (workflow.ScanConfig.ConnectionID != organization.StorageConnectionID || (strings.TrimSpace(workflow.ScanConfig.DataSource) != "" && !strings.EqualFold(workflow.ScanConfig.DataSource, "BOS"))) {
|
||||
return nil, domain.ErrStorageScope
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package worker
|
||||
|
||||
import (
|
||||
"droboticflow/internal/domain"
|
||||
"droboticflow/internal/store"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
@ -26,3 +28,23 @@ func TestScopedArtifactPathsRejectSymlinkEscape(t *testing.T) {
|
||||
t.Fatal("symlink escape accepted")
|
||||
}
|
||||
}
|
||||
|
||||
func TestScopedOrganizationKeepsInlineArtifacts(t *testing.T) {
|
||||
data := store.NewMemoryStore()
|
||||
org := domain.OrganizationRecord{ID: "scoped-org", StorageRootPrefix: "company-a/", StorageBucket: "testxyz", StorageConnectionID: "scoped-connection", StorageState: "ready"}
|
||||
data.UpsertOrganization(t.Context(), org)
|
||||
data.UpsertStorageConnection(t.Context(), domain.StorageConnectionRecord{ID: org.StorageConnectionID, OrganizationID: org.ID, RootPrefix: org.StorageRootPrefix, Bucket: org.StorageBucket, Provider: "BOS", Endpoint: "https://bj.bcebos.com"})
|
||||
rt := &Runtime{store: data}
|
||||
wf := &domain.WorkflowRecord{OrganizationID: org.ID}
|
||||
run := &domain.RunRecord{ID: "run-inline", OrganizationID: org.ID}
|
||||
artifacts := []domain.ExecutionArtifact{{ID: "inline", Type: domain.PortTypeJSON, Payload: &domain.ArtifactPayload{Mode: domain.ArtifactTransferModeInline, Type: domain.PortTypeJSON, Inline: map[string]any{"ok": true}}}, {ID: "json-data", Type: domain.PortTypeJSON, Data: map[string]any{"value": 1}}}
|
||||
out, err := rt.normalizeOutputArtifacts(t.Context(), wf, run, "node", artifacts)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, a := range out {
|
||||
if a.Payload == nil || a.Payload.Mode != domain.ArtifactTransferModeInline {
|
||||
t.Fatalf("inline artifact lost: %+v", a)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
18
tools/drosync/Cargo.lock
generated
18
tools/drosync/Cargo.lock
generated
@ -1194,7 +1194,7 @@ checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76"
|
||||
|
||||
[[package]]
|
||||
name = "drosync-cli"
|
||||
version = "1.0.17"
|
||||
version = "1.0.18"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"clap",
|
||||
@ -1210,7 +1210,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "drosync-core"
|
||||
version = "1.0.17"
|
||||
version = "1.0.18"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"drosync-protocol",
|
||||
@ -1226,7 +1226,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "drosync-daemon"
|
||||
version = "1.0.17"
|
||||
version = "1.0.18"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"drosync-core",
|
||||
@ -1247,7 +1247,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "drosync-gui"
|
||||
version = "1.0.17"
|
||||
version = "1.0.18"
|
||||
dependencies = [
|
||||
"drosync-daemon",
|
||||
"drosync-platform",
|
||||
@ -1259,7 +1259,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "drosync-platform"
|
||||
version = "1.0.17"
|
||||
version = "1.0.18"
|
||||
dependencies = [
|
||||
"directories",
|
||||
"keyring",
|
||||
@ -1271,7 +1271,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "drosync-protocol"
|
||||
version = "1.0.17"
|
||||
version = "1.0.18"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"serde",
|
||||
@ -1280,7 +1280,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "drosync-state"
|
||||
version = "1.0.17"
|
||||
version = "1.0.18"
|
||||
dependencies = [
|
||||
"drosync-core",
|
||||
"drosync-protocol",
|
||||
@ -1293,7 +1293,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "drosync-transfer"
|
||||
version = "1.0.17"
|
||||
version = "1.0.18"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"drosync-protocol",
|
||||
@ -1309,7 +1309,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "drosync-updater"
|
||||
version = "1.0.17"
|
||||
version = "1.0.18"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"drosync-protocol",
|
||||
|
||||
@ -13,7 +13,7 @@ members = [
|
||||
]
|
||||
|
||||
[workspace.package]
|
||||
version = "1.0.17"
|
||||
version = "1.0.18"
|
||||
edition = "2024"
|
||||
license = "Apache-2.0"
|
||||
rust-version = "1.89"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user