From 80dc82961e63dcbee9fc31bcce5b74ab8a9f0b2e Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Mon, 23 Jun 2025 15:45:14 +0200 Subject: prog: validate transient unions Ensure that there are no more transient unions in the fully constructed programs. --- prog/validation.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/prog/validation.go b/prog/validation.go index ccaa4b990..48a6efade 100644 --- a/prog/validation.go +++ b/prog/validation.go @@ -261,6 +261,10 @@ func (arg *UnionArg) validate(ctx *validCtx, dir Dir) error { if arg.Index < 0 || arg.Index >= len(typ.Fields) { return fmt.Errorf("union arg %v has bad index %v/%v", arg, arg.Index, len(typ.Fields)) } + if arg.transient && !ctx.opts.ignoreTransient { + // The union must have been patched via Call.setDefaultConditions. + return fmt.Errorf("union arg %v is transient (incomplete)", arg) + } opt := typ.Fields[arg.Index] return ctx.validateArg(arg.Option, opt.Type, opt.Dir(dir)) } -- cgit mrf-deployment