feat(inbound-api): surface method compile errors to operators — api-method validate/recompile + compile state on get (ScadaBridge#75)

The data plane answers a broken inbound method with the generic "Script
compilation failed for this method"; the Roslyn diagnostic reached only the
central log, and the known-bad cache could not be observed or reset per method.

- InboundScriptExecutor keeps the diagnostics with each known-bad record and
  exposes GetCompileState(name, currentScript): IsCompiled / IsKnownBad /
  LastCompileError, judged against the current script text (a record for older
  text is reported as not compiled yet).
- Management: ValidateApiMethodCommand (compile the stored script, return
  ApiMethodCompileResult, register nothing, cache untouched) and
  RecompileApiMethodCommand (CompileAndRegister without re-sending the entity,
  drops the node's ApiMethodCache row, audited "Recompile"). Both Designer, like
  UpdateApiMethod; dispatched through the shared ApiMethodCompileOperations.
  GetApiMethod keeps the entity fields top-level and adds isCompiled,
  isKnownBad, lastCompileError and compileStateNode. Compile state is per
  central node and every result names the node.
- CLI: api-method validate --id, api-method recompile --id.
- Central UI: the API-method edit page shows the saved script's compile state
  and last error, with Validate and Recompile actions (same operations, same
  Designer gate, fresh DI scope).
- RequiredRoleMatrixTests entries; ManagementSurfaceParityTests covers the new
  CLI leaves; ApiMethodCompileDiagnosticsTests + an executor CompileState test.
- Docs: CLI README, Component-CLI/ManagementService/InboundAPI, components/*.

Claude-Session: https://claude.ai/code/session_01GT67AEHd2Acv1YPwGfXEoV
This commit is contained in:
Joseph Doherty
2026-11-09 15:28:41 -05:00
parent 65ffa1dad4
commit 3dd492a77f
18 changed files with 542 additions and 15 deletions
+38 -1
View File
@@ -2342,7 +2342,13 @@ scadabridge --url <url> api-method list
#### `api-method get`
Get a single inbound API method by ID.
Get a single inbound API method by ID. Besides the method's fields the reply carries the
answering central node's compile state for the stored script: `isCompiled`, `isKnownBad`
(the script failed to compile and requests fast-fail with the generic
`Script compilation failed for this method`), `lastCompileError` (the real compiler /
trust-model diagnostics when `isKnownBad`) and `compileStateNode`. Each central node
compiles independently, so the state is per node; the fields are null on a host with no
inbound API executor.
```sh
scadabridge --url <url> api-method get --id <int>
@@ -2352,6 +2358,37 @@ scadabridge --url <url> api-method get --id <int>
|--------|----------|-------------|
| `--id` | yes | API method ID |
#### `api-method validate`
Compile the method's **stored** script on the central node and return
`{ apiMethodId, name, success, errors, node }` — the same compile the data plane runs, with
the diagnostics the data plane deliberately hides from API-key callers. Nothing is
registered and the known-bad cache is untouched. Requires `Designer`.
```sh
scadabridge --url <url> api-method validate --id <int>
```
| Option | Required | Description |
|--------|----------|-------------|
| `--id` | yes | API method ID |
#### `api-method recompile`
Re-run `CompileAndRegister` on the method's stored script on the central node, without
re-sending the entity: a success replaces the cached handler and clears a stale compile
failure (for example one caused by something outside the script that has since been
fixed); a failure records the new diagnostics. Returns the same shape as `validate` and is
audited as `Recompile`. Affects the answering node only. Requires `Designer`.
```sh
scadabridge --url <url> api-method recompile --id <int>
```
| Option | Required | Description |
|--------|----------|-------------|
| `--id` | yes | API method ID |
#### `api-method create`
Create a new inbound API method.