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:
+16
@@ -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"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user