feat(scripts): realign Test Run with runtime API, add anonymous-object calls and instance binding

The Test Run sandbox and Monaco analysis modelled a script API that had
drifted from the site runtime's ScriptGlobals, so real scripts failed to
compile in Test Run. Realign both to the runtime surface
(Instance/Scripts/ExternalSystem/Attributes/Children/Parent) and drop the
duplicate ScriptHost stub so the two cannot diverge again.

- Script calls (Scripts.CallShared, Instance.CallScript, Route.To().Call)
  accept an anonymous object instead of a hand-built dictionary, via a
  shared ScriptArgs normalizer; existing dictionary calls still compile.
- Test Run can optionally bind to a deployed instance, so Instance/
  Attributes/CallScript route to it cross-site; adds site-side
  RouteToGetAttributes/RouteToSetAttributes handlers.
- Adds Test Run panels to the API method and template script editors.
- Fixes the TestDatabaseQuery seed script, which queried a table that
  never existed.

Also commits unrelated in-progress work already in the tree: the health
monitoring report loop, site streaming changes, and the Admin/Design
data-connection and SMTP page reorganization.
This commit is contained in:
Joseph Doherty
2026-05-16 03:37:56 -04:00
parent d7b05b40e9
commit 295150751f
50 changed files with 2926 additions and 550 deletions

View File

@@ -4,10 +4,23 @@
.sidebar {
min-width: 220px;
max-width: 220px;
min-height: 100vh;
height: 100vh;
background-color: var(--bs-dark);
}
/* Keep the sidebar pinned to the viewport on lg+ so it stays visible even
when the main content scrolls past 100vh. The wrapper is the flex child
of MainLayout; align-self prevents the flex row from stretching it. */
@media (min-width: 992px) {
#sidebar-collapse {
position: sticky;
top: 0;
height: 100vh;
align-self: flex-start;
z-index: 1020;
}
}
.sidebar .nav-link {
color: var(--bs-gray-500);
padding: 0.4rem 1rem;
@@ -51,7 +64,7 @@
.sidebar {
min-width: 100%;
max-width: 100%;
min-height: auto;
height: auto;
}
}

View File

@@ -40,20 +40,23 @@
async function lookupContext(model) {
const empty = {
declaredParameters: [], siblingScripts: [], declaredParameterShapes: [],
selfAttributes: [], children: [], parent: null
selfAttributes: [], children: [], parent: null, scriptKind: 0
};
for (const key in editors) {
if (editors[key].editor.getModel() === model) {
try {
const got = await editors[key].dotNetRef.invokeMethodAsync("GetContext");
if (got) {
const kind = got.ScriptKind != null ? got.ScriptKind
: (got.scriptKind != null ? got.scriptKind : 0);
return {
declaredParameters: got.DeclaredParameters || got.declaredParameters || [],
siblingScripts: got.SiblingScripts || got.siblingScripts || [],
declaredParameterShapes: got.DeclaredParameterShapes || got.declaredParameterShapes || [],
selfAttributes: got.SelfAttributes || got.selfAttributes || [],
children: got.Children || got.children || [],
parent: got.Parent || got.parent || null
parent: got.Parent || got.parent || null,
scriptKind: kind
};
}
} catch (e) { /* fall through */ }
@@ -82,7 +85,8 @@
siblingScripts: ctx.siblingScripts,
selfAttributes: ctx.selfAttributes,
children: ctx.children,
parent: ctx.parent
parent: ctx.parent,
kind: ctx.scriptKind
})
});
if (!resp.ok) return { suggestions: [] };
@@ -269,7 +273,8 @@
body: JSON.stringify({
code: model.getValue(),
declaredParameters: ctx.declaredParameters,
siblingScripts: ctx.siblingScripts
siblingScripts: ctx.siblingScripts,
kind: ctx.scriptKind
})
});
if (!resp.ok) return [];