fix(central-ui): mirror WaitForAttribute on inbound-script analysis RouteTarget

Add WaitForAttribute(attributeName, targetValue, timeout, cancellationToken)
to InboundScriptHost.RouteTarget and SandboxInboundScriptHost.RouteTarget,
mirroring the shipped runtime signature in RouteHelper. Eliminates the false
CS error the editor raised against valid Route.To("X").WaitForAttribute(...)
calls in inbound API method scripts. Test asserts the call diagnoses clean
under ScriptKind.InboundApi.
This commit is contained in:
Joseph Doherty
2026-06-17 11:04:13 -04:00
parent a1186685a9
commit bee295d3ee
3 changed files with 47 additions and 0 deletions
@@ -644,4 +644,20 @@ public class ScriptAnalysisServiceTests
Assert.All(lines, l => Assert.Equal($"S{i}", l.Trim()));
}
}
// ── Inbound-script analysis surface ──────────────────────────────────
[Fact]
public void InboundScript_WaitForAttribute_DiagnosesClean()
{
// WaitForAttribute is a shipped inbound-script helper. The editor must
// not flag it as an error: the InboundScriptHost mirror must expose the
// method so Roslyn resolves it during static analysis.
var resp = _svc.Diagnose(new DiagnoseRequest(
Code: "var ok = await Route.To(\"site-a\").WaitForAttribute(\"Flag\", true, System.TimeSpan.FromSeconds(5));",
Kind: ScriptKind.InboundApi));
Assert.DoesNotContain(resp.Markers, m => m.Code.StartsWith("CS"));
Assert.DoesNotContain(resp.Markers, m => m.Code.StartsWith("SCADA"));
}
}