Feat v0.9.2 Starlark converter consolidation + snapshot cleanup (#75)
All checks were successful
CI/CD / detect-changes (pull_request) Successful in 4s
CI/CD / test-frontend (pull_request) Has been skipped
CI/CD / test-runners (pull_request) Has been skipped
CI/CD / e2e-smoke (pull_request) Has been skipped
CI/CD / test-go-pg (pull_request) Successful in 2m43s
CI/CD / test-sqlite (pull_request) Successful in 2m52s
CI/CD / build-and-deploy (pull_request) Successful in 2m15s
All checks were successful
CI/CD / detect-changes (pull_request) Successful in 4s
CI/CD / test-frontend (pull_request) Has been skipped
CI/CD / test-runners (pull_request) Has been skipped
CI/CD / e2e-smoke (pull_request) Has been skipped
CI/CD / test-go-pg (pull_request) Successful in 2m43s
CI/CD / test-sqlite (pull_request) Successful in 2m52s
CI/CD / build-and-deploy (pull_request) Successful in 2m15s
Consolidate duplicate Go↔Starlark converters into sandbox/convert.go and snapshot parsers into models/snapshot.go. Standardize snapshot creation on wrapped format. Net -393 lines across 21 files. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -112,7 +112,7 @@ func workflowGetInstance(ctx context.Context, stores store.Stores) func(*starlar
|
||||
if json.Unmarshal(inst.StageData, &dataMap) == nil {
|
||||
starlarkData := starlark.NewDict(len(dataMap))
|
||||
for k, v := range dataMap {
|
||||
starlarkData.SetKey(starlark.String(k), goValToStarlark(v))
|
||||
starlarkData.SetKey(starlark.String(k), GoToStarlark(v))
|
||||
}
|
||||
d.SetKey(starlark.String("stage_data"), starlarkData)
|
||||
} else {
|
||||
@@ -155,36 +155,5 @@ func workflowListInstances(ctx context.Context, stores store.Stores) func(*starl
|
||||
}
|
||||
}
|
||||
|
||||
// goValToStarlark converts a Go value to a Starlark value.
|
||||
func goValToStarlark(v interface{}) starlark.Value {
|
||||
switch val := v.(type) {
|
||||
case nil:
|
||||
return starlark.None
|
||||
case bool:
|
||||
return starlark.Bool(val)
|
||||
case float64:
|
||||
if val == float64(int(val)) {
|
||||
return starlark.MakeInt(int(val))
|
||||
}
|
||||
return starlark.Float(val)
|
||||
case string:
|
||||
return starlark.String(val)
|
||||
case map[string]interface{}:
|
||||
d := starlark.NewDict(len(val))
|
||||
for k, v := range val {
|
||||
d.SetKey(starlark.String(k), goValToStarlark(v))
|
||||
}
|
||||
return d
|
||||
case []interface{}:
|
||||
elems := make([]starlark.Value, len(val))
|
||||
for i, v := range val {
|
||||
elems[i] = goValToStarlark(v)
|
||||
}
|
||||
return starlark.NewList(elems)
|
||||
default:
|
||||
return starlark.String(fmt.Sprintf("%v", v))
|
||||
}
|
||||
}
|
||||
|
||||
// workflowRoute routes the workflow to a named stage.
|
||||
// Starlark: workflow.route(instance_id, target_stage, reason)
|
||||
|
||||
Reference in New Issue
Block a user