Roll back failed dynamic descriptor builds

This commit is contained in:
2026-10-25 21:20:41 +00:00
parent 2736ddfbf2
commit deb9aa5c69
4 changed files with 109 additions and 0 deletions

View File

@@ -40,9 +40,11 @@ func (o *valueOperation) dynamicDescriptor(current reflect.Type, path Path) (*ty
builder := schemaBuilder{cache: o.schema.types, building: make(map[reflect.Type]bool), secrets: o.schema.secrets}
descriptor, issue := builder.describe(current, path)
if issue != nil {
builder.rollback()
return nil, &projectionIssue{code: CodeSchemaDynamicType, path: path.clone(), message: "dynamic configuration value has an unsupported type"}
}
if descriptorContainsSecret(descriptor, make(map[*typeDescriptor]bool)) {
builder.rollback()
return nil, &projectionIssue{code: CodeSchemaDynamicType, path: path.clone(), message: "dynamic configuration values cannot establish secret-reference semantics"}
}
return descriptor, nil