Merge branch 'worktree-agent-a5e1884475a5b785e' into feat/flow-debugger-script-entry

This commit is contained in:
Joseph Doherty
2026-09-08 01:16:11 -04:00
2 changed files with 66 additions and 0 deletions
@@ -77,6 +77,44 @@ else
_shapes = ScriptParameterNames.ParseShapes(ParameterDefinitions);
_rootSchema = await ParseRootAsync();
_topLevelFields = _rootSchema?.Type == "object" ? _rootSchema.Fields : Array.Empty<InboundApiSchemaField>();
// Report validity for the freshly-(re)parsed schema so a caller gating a Run
// button on ValidChanged never starts (or carries over from a prior script)
// a stale "valid" reading when required fields are unset. This deliberately
// does NOT call Validate()/populate _parseErrors: the component has no
// "untouched field" concept -- RenderError paints whatever is in
// _parseErrors unconditionally -- so doing that here would immediately
// paint every required field red before the user has touched anything. The
// silent check below computes the same answer without that side effect;
// _parseErrors (and the visible red text) still only appears once editing
// drives it through Emit()/Validate() as before.
await ValidChanged.InvokeAsync(ComputeIsValid());
}
// Mirrors Validate()'s schema pass (plus any raw-text parse markers already
// parked in _parseErrors) WITHOUT writing to _parseErrors, so it can run on
// every schema (re)parse without painting untouched required fields red.
private bool ComputeIsValid()
{
if (_parseErrors.Count > 0)
{
return false;
}
if (_rootSchema is null)
{
return true;
}
try
{
var element = JsonSerializer.SerializeToElement(Values);
var errors = new List<string>();
_rootSchema.Validate(element, string.Empty, errors);
return errors.Count == 0;
}
catch (JsonException)
{
return false;
}
}
/// <summary>