import assert from "node:assert/strict";

import {
  INI_PANEL_ENTRIES,
  controlPageStatusText,
  createControlPageBrowserApiManifest,
  createControlPageBrowserApiMethods,
  createControlPageBrowserApiSchema,
  createIniPanelLaunchApiManifest,
  createIniPanelLaunchApiSchema,
  createIniPanelLauncherLinkViewModel,
  createIniPanelShellControlPageContract,
  createIniPanelShellIntegrationManifest,
  createIniPanelShellIntegrationReadiness,
  createIniPanelShellIntegrationSchema,
  createIniPanelShellIntegrationWorkflowPlan,
  createIniPanelShellSessionHandoffActionPlan,
  createIniPanelShellSessionHandoffChecklist,
  createIniPanelShellSessionHandoffCompatibilityReport,
  createIniPanelShellSessionHandoffDisplayViewModel,
  createIniPanelShellSessionHandoffPackage,
  createIniPanelShellSessionHandoffPackageDisplayViewModel,
  createIniPanelShellSessionHandoffPackageMountDisplayViewModel,
  createIniPanelShellSessionHandoffPackageMountRenderState,
  createIniPanelShellSessionHandoffPackageMountState,
  createIniPanelShellSessionHandoffMountDomContract,
  createIniPanelShellSessionHandoffMountDomReadiness,
  mountIniPanelShellSessionHandoff,
  mountIniPanelShellSessionHandoffFromControlPage,
  readIniPanelShellSessionHandoffStatusFromControlPage,
  createIniPanelShellSessionHandoffWorkflowSummary,
  createIniPanelShellSessionReadinessWorkflowReport,
  createIniPanelShellSessionHandoffWorkflowDisplayViewModel,
  createIniPanelShellSessionHandoffWorkflowRenderState,
  createIniPanelShellSessionHandoffWorkflowDomContract,
  createIniPanelShellSessionHandoffWorkflowDomReadiness,
  createIniPanelShellWorkflowOverviewContract,
  createIniPanelShellWorkflowOverviewReadiness,
  createIniPanelShellWorkflowOverviewEmbeddingReport,
  createIniPanelShellWorkflowOverviewEmbeddingDisplayViewModel,
  createIniPanelShellWorkflowOverviewEmbeddingRenderState,
  createIniPanelShellWorkflowOverviewEmbeddingDomContract,
  createIniPanelShellWorkflowOverviewEmbeddingDomReadiness,
  mountIniPanelShellWorkflowOverviewEmbedding,
  renderIniPanelShellWorkflowOverviewEmbeddingState,
  mountIniPanelShellWorkflowOverviewEmbeddingState,
  createIniPanelShellWorkflowOverviewEmbeddingMountDisplayViewModel,
  createIniPanelShellWorkflowOverviewEmbeddingMountRenderState,
  createIniPanelShellWorkflowOverviewEmbeddingMountDomContract,
  createIniPanelShellWorkflowOverviewEmbeddingMountDomReadiness,
  renderIniPanelShellWorkflowOverviewEmbeddingMountState,
  mountIniPanelShellWorkflowOverviewEmbeddingMountState,
  renderIniPanelShellSessionHandoffWorkflowState,
  mountIniPanelShellSessionHandoffWorkflow,
  renderIniPanelShellSessionHandoffMountState,
  createIniPanelShellSessionHandoffPackageReport,
  createIniPanelShellSessionHandoffPackageRenderState,
  createIniPanelShellSessionHandoffPackageSchema,
  createIniPanelShellSessionHandoffRenderState,
  createIniPanelShellSessionHandoffSnapshot,
  createIniPanelShellSessionHandoffSummary,
  createIniPanelShellSessionHandoffSummarySchema,
  createIniPanelShellViewModel,
  createMachineSessionReadonlyStatus,
  createMachineSessionReadonlyStatusApiManifest,
  createControlPageRefreshState,
  createControlPageSessionLoadState,
  createMachineSessionControlPageController,
  getIniPanelEntryByHref,
  getIniPanelEntryManifest,
  getVisibleIniPanelEntries,
  isSupportedIniPanelControlPageApiManifest,
  isSupportedIniPanelLaunchApiManifest,
  isSupportedIniPanelShellIntegrationManifest,
  isSupportedIniPanelShellSessionHandoffPackage,
  isSupportedIniPanelShellSessionHandoffSummary,
  loadMachineSessionForControlPageWorkflow,
  readMachineSessionReadonlyStatus,
  refreshMachineSessionControlPage,
  renderMachineSessionControlView,
} from "../../../runtime/ui/ini-panel/ui-shell.js";

assert.deepEqual(getIniPanelEntryManifest(), INI_PANEL_ENTRIES);
assert.deepEqual(getVisibleIniPanelEntries(), INI_PANEL_ENTRIES);
assert.equal(controlPageStatusText({ lastAction: "x", runStatus: "ok", error: null }), "x | ok | -");
assert.deepEqual(createControlPageRefreshState({ phase: "waiting", statusText: "waiting for panel" }), {
  phase: "waiting",
  statusText: "waiting for panel",
  view: null,
  renderResult: null,
  error: null,
});
assert.deepEqual(createControlPageSessionLoadState({ phase: "waiting-panel" }), {
  phase: "waiting-panel",
  panelReady: false,
  apiReady: false,
  controlViewReady: false,
  stateBundle: null,
  workflowStatus: null,
  sessionReadiness: null,
  controlView: null,
  error: null,
});
assert.equal(getIniPanelEntryByHref("./index.html")?.id, "edit-run");
assert.equal(typeof createMachineSessionControlPageController, "function");
assert.equal(typeof createMachineSessionReadonlyStatus, "function");
assert.equal(typeof createMachineSessionReadonlyStatusApiManifest, "function");
assert.equal(typeof createControlPageBrowserApiManifest, "function");
assert.equal(typeof createControlPageBrowserApiMethods, "function");
assert.equal(typeof createControlPageBrowserApiSchema, "function");
assert.equal(typeof createIniPanelLaunchApiManifest, "function");
assert.equal(typeof createIniPanelLaunchApiSchema, "function");
assert.equal(typeof createIniPanelShellControlPageContract, "function");
assert.equal(typeof createIniPanelShellIntegrationManifest, "function");
assert.equal(typeof createIniPanelShellIntegrationReadiness, "function");
assert.equal(typeof createIniPanelShellIntegrationSchema, "function");
assert.equal(typeof createIniPanelShellIntegrationWorkflowPlan, "function");
assert.equal(typeof createIniPanelShellSessionHandoffActionPlan, "function");
assert.equal(typeof createIniPanelShellSessionHandoffChecklist, "function");
assert.equal(typeof createIniPanelShellSessionHandoffCompatibilityReport, "function");
assert.equal(typeof createIniPanelShellSessionHandoffDisplayViewModel, "function");
assert.equal(typeof createIniPanelShellSessionHandoffPackage, "function");
assert.equal(typeof createIniPanelShellSessionHandoffPackageDisplayViewModel, "function");
assert.equal(typeof createIniPanelShellSessionHandoffPackageMountDisplayViewModel, "function");
assert.equal(typeof createIniPanelShellSessionHandoffPackageMountRenderState, "function");
assert.equal(typeof createIniPanelShellSessionHandoffPackageMountState, "function");
assert.equal(typeof createIniPanelShellSessionHandoffMountDomContract, "function");
assert.equal(typeof createIniPanelShellSessionHandoffMountDomReadiness, "function");
assert.equal(typeof mountIniPanelShellSessionHandoff, "function");
assert.equal(typeof mountIniPanelShellSessionHandoffFromControlPage, "function");
assert.equal(typeof readIniPanelShellSessionHandoffStatusFromControlPage, "function");
assert.equal(typeof createIniPanelShellSessionHandoffWorkflowSummary, "function");
assert.equal(typeof createIniPanelShellSessionHandoffWorkflowDisplayViewModel, "function");
assert.equal(typeof createIniPanelShellSessionHandoffWorkflowRenderState, "function");
assert.equal(typeof createIniPanelShellSessionHandoffWorkflowDomContract, "function");
assert.equal(typeof createIniPanelShellSessionHandoffWorkflowDomReadiness, "function");
assert.equal(typeof createIniPanelShellWorkflowOverviewContract, "function");
assert.equal(typeof createIniPanelShellWorkflowOverviewReadiness, "function");
assert.equal(typeof createIniPanelShellWorkflowOverviewEmbeddingReport, "function");
assert.equal(typeof createIniPanelShellWorkflowOverviewEmbeddingDisplayViewModel, "function");
assert.equal(typeof createIniPanelShellWorkflowOverviewEmbeddingRenderState, "function");
assert.equal(typeof createIniPanelShellWorkflowOverviewEmbeddingDomContract, "function");
assert.equal(typeof createIniPanelShellWorkflowOverviewEmbeddingDomReadiness, "function");
assert.equal(typeof mountIniPanelShellWorkflowOverviewEmbedding, "function");
assert.equal(typeof renderIniPanelShellWorkflowOverviewEmbeddingState, "function");
assert.equal(typeof mountIniPanelShellWorkflowOverviewEmbeddingState, "function");
assert.equal(typeof createIniPanelShellWorkflowOverviewEmbeddingMountDisplayViewModel, "function");
assert.equal(typeof createIniPanelShellWorkflowOverviewEmbeddingMountRenderState, "function");
assert.equal(typeof createIniPanelShellWorkflowOverviewEmbeddingMountDomContract, "function");
assert.equal(typeof createIniPanelShellWorkflowOverviewEmbeddingMountDomReadiness, "function");
assert.equal(typeof renderIniPanelShellWorkflowOverviewEmbeddingMountState, "function");
assert.equal(typeof mountIniPanelShellWorkflowOverviewEmbeddingMountState, "function");
assert.equal(typeof renderIniPanelShellSessionHandoffWorkflowState, "function");
assert.equal(typeof mountIniPanelShellSessionHandoffWorkflow, "function");
assert.equal(typeof renderIniPanelShellSessionHandoffMountState, "function");
assert.equal(typeof createIniPanelShellSessionHandoffPackageReport, "function");
assert.equal(typeof createIniPanelShellSessionHandoffPackageRenderState, "function");
assert.equal(typeof createIniPanelShellSessionHandoffPackageSchema, "function");
assert.equal(typeof createIniPanelShellSessionHandoffRenderState, "function");
assert.equal(typeof createIniPanelShellSessionHandoffSnapshot, "function");
assert.equal(typeof createIniPanelShellSessionHandoffSummary, "function");
assert.equal(typeof createIniPanelShellSessionHandoffSummarySchema, "function");
assert.equal(typeof loadMachineSessionForControlPageWorkflow, "function");
assert.equal(typeof readMachineSessionReadonlyStatus, "function");
assert.equal(typeof refreshMachineSessionControlPage, "function");
assert.equal(typeof renderMachineSessionControlView, "function");
assert.equal(typeof isSupportedIniPanelControlPageApiManifest, "function");
assert.equal(typeof isSupportedIniPanelLaunchApiManifest, "function");
assert.equal(typeof isSupportedIniPanelShellIntegrationManifest, "function");
assert.equal(typeof isSupportedIniPanelShellSessionHandoffPackage, "function");
assert.equal(typeof isSupportedIniPanelShellSessionHandoffSummary, "function");

const shellManifest = getIniPanelEntryManifest();
shellManifest[0].title = "changed";
assert.equal(INI_PANEL_ENTRIES[0].title, "Open edit and run panel");
const visibleEntries = getVisibleIniPanelEntries();
visibleEntries[0].title = "changed";
assert.equal(INI_PANEL_ENTRIES[0].title, "Open edit and run panel");
assert.deepEqual(createIniPanelLauncherLinkViewModel(), [
  {
    entryId: "edit-run",
    href: "./index.html",
    label: "Open edit and run panel",
  },
  {
    entryId: "control-view",
    href: "./control-page.html",
    label: "Open read-only control view",
  },
  {
    entryId: "workflow-overview",
    href: "./workflow-overview.html",
    label: "Open shell handoff overview",
  },
]);
const launcherLinks = createIniPanelLauncherLinkViewModel();
launcherLinks[0].label = "changed";
assert.equal(INI_PANEL_ENTRIES[0].title, "Open edit and run panel");
const shellViewModel = createIniPanelShellViewModel();
assert.deepEqual(shellViewModel.pages, [
  {
    id: "edit-run",
    href: "./index.html",
    title: "Open edit and run panel",
  },
  {
    id: "control-view",
    href: "./control-page.html",
    title: "Open read-only control view",
  },
  {
    id: "workflow-overview",
    href: "./workflow-overview.html",
    title: "Open shell handoff overview",
  },
]);
assert.deepEqual(shellViewModel.launcherLinks, createIniPanelLauncherLinkViewModel());
assert.deepEqual(shellViewModel.shellIntegrationSchema, createIniPanelShellIntegrationSchema());
assert.deepEqual(shellViewModel.shellIntegrationManifest, createIniPanelShellIntegrationManifest());
assert.deepEqual(
  shellViewModel.shellIntegrationReadiness,
  createIniPanelShellIntegrationReadiness(shellViewModel.shellIntegrationManifest),
);
assert.deepEqual(
  shellViewModel.shellIntegrationWorkflowPlan,
  createIniPanelShellIntegrationWorkflowPlan({
    manifest: shellViewModel.shellIntegrationManifest,
    readiness: shellViewModel.shellIntegrationReadiness,
  }),
);
assert.deepEqual(
  shellViewModel.shellSessionHandoffSummary,
  createIniPanelShellSessionHandoffSummary({
    manifest: shellViewModel.shellIntegrationManifest,
    readiness: shellViewModel.shellIntegrationReadiness,
    workflowPlan: shellViewModel.shellIntegrationWorkflowPlan,
  }),
);
assert.deepEqual(shellViewModel.shellSessionHandoffSummarySchema, createIniPanelShellSessionHandoffSummarySchema());
assert.equal(isSupportedIniPanelShellSessionHandoffSummary(shellViewModel.shellSessionHandoffSummary), true);
assert.deepEqual(
  shellViewModel.shellSessionHandoffCompatibilityReport,
  createIniPanelShellSessionHandoffCompatibilityReport(shellViewModel.shellSessionHandoffSummary),
);
assert.deepEqual(
  shellViewModel.shellSessionHandoffDisplayViewModel,
  createIniPanelShellSessionHandoffDisplayViewModel(shellViewModel.shellSessionHandoffCompatibilityReport),
);
assert.deepEqual(
  shellViewModel.shellSessionHandoffSnapshot,
  createIniPanelShellSessionHandoffSnapshot({
    readiness: shellViewModel.shellIntegrationReadiness,
    summary: shellViewModel.shellSessionHandoffSummary,
    compatibilityReport: shellViewModel.shellSessionHandoffCompatibilityReport,
    displayViewModel: shellViewModel.shellSessionHandoffDisplayViewModel,
  }),
);
assert.deepEqual(
  shellViewModel.shellSessionHandoffRenderState,
  createIniPanelShellSessionHandoffRenderState(shellViewModel.shellSessionHandoffSnapshot),
);
assert.deepEqual(
  shellViewModel.shellSessionHandoffActionPlan,
  createIniPanelShellSessionHandoffActionPlan({
    snapshot: shellViewModel.shellSessionHandoffSnapshot,
    renderState: shellViewModel.shellSessionHandoffRenderState,
  }),
);
assert.deepEqual(
  shellViewModel.shellSessionHandoffChecklist,
  createIniPanelShellSessionHandoffChecklist({
    actionPlan: shellViewModel.shellSessionHandoffActionPlan,
    renderState: shellViewModel.shellSessionHandoffRenderState,
  }),
);
assert.deepEqual(
  shellViewModel.shellSessionHandoffPackage,
  createIniPanelShellSessionHandoffPackage({
    shellIntegrationManifest: shellViewModel.shellIntegrationManifest,
    launchApiManifest: shellViewModel.shellIntegrationManifest.launchApiManifest,
    controlPageApiManifest: shellViewModel.shellIntegrationManifest.controlPageApiManifest,
    snapshot: shellViewModel.shellSessionHandoffSnapshot,
    renderState: shellViewModel.shellSessionHandoffRenderState,
    actionPlan: shellViewModel.shellSessionHandoffActionPlan,
    checklist: shellViewModel.shellSessionHandoffChecklist,
  }),
);
assert.deepEqual(shellViewModel.shellSessionHandoffPackageSchema, createIniPanelShellSessionHandoffPackageSchema());
assert.deepEqual(
  shellViewModel.shellSessionHandoffPackageReport,
  createIniPanelShellSessionHandoffPackageReport(shellViewModel.shellSessionHandoffPackage),
);
assert.deepEqual(
  shellViewModel.shellSessionHandoffPackageDisplayViewModel,
  createIniPanelShellSessionHandoffPackageDisplayViewModel(shellViewModel.shellSessionHandoffPackageReport),
);
assert.deepEqual(
  shellViewModel.shellSessionHandoffPackageRenderState,
  createIniPanelShellSessionHandoffPackageRenderState(shellViewModel.shellSessionHandoffPackageDisplayViewModel),
);
assert.deepEqual(
  shellViewModel.shellSessionHandoffPackageMountState,
  createIniPanelShellSessionHandoffPackageMountState({
    handoffPackage: shellViewModel.shellSessionHandoffPackage,
    packageRenderState: shellViewModel.shellSessionHandoffPackageRenderState,
  }),
);
assert.deepEqual(
  shellViewModel.shellSessionHandoffPackageMountDisplayViewModel,
  createIniPanelShellSessionHandoffPackageMountDisplayViewModel(shellViewModel.shellSessionHandoffPackageMountState),
);
assert.deepEqual(
  shellViewModel.shellSessionHandoffPackageMountRenderState,
  createIniPanelShellSessionHandoffPackageMountRenderState(
    shellViewModel.shellSessionHandoffPackageMountDisplayViewModel,
  ),
);
assert.deepEqual(
  shellViewModel.shellSessionHandoffMountDomContract,
  createIniPanelShellSessionHandoffMountDomContract(),
);
assert.equal(isSupportedIniPanelShellSessionHandoffPackage(shellViewModel.shellSessionHandoffPackage), true);
assert.deepEqual(shellViewModel.shellSessionHandoffDisplayViewModel, {
  phase: "ready",
  title: "Shell handoff compatibility",
  statusText: "Ready",
  detailText: "No blocking reasons",
  rows: [
    {
      id: "summary-supported",
      label: "Summary schema",
      value: "supported",
    },
    {
      id: "handoff-ready",
      label: "Handoff readiness",
      value: "ready",
    },
    {
      id: "missing-fields",
      label: "Missing fields",
      value: "none",
    },
    {
      id: "mismatch-fields",
      label: "Mismatched fields",
      value: "none",
    },
    {
      id: "blocking-reasons",
      label: "Blocking reasons",
      value: "none",
    },
  ],
});
assert.deepEqual(shellViewModel.shellSessionHandoffRenderState, {
  apiName: "ini-panel-shell-session-handoff-render-state",
  renderStateVersion: 1,
  phase: "ready",
  ready: true,
  title: "Shell handoff compatibility",
  statusText: "Ready",
  detailText: "No blocking reasons",
  statusLine: "Ready: No blocking reasons",
  rows: shellViewModel.shellSessionHandoffDisplayViewModel.rows,
  dataset: {
    handoffPhase: "ready",
    handoffReady: "true",
  },
});
assert.deepEqual(shellViewModel.shellSessionHandoffActionPlan, {
  apiName: "ini-panel-shell-session-handoff-action-plan",
  planVersion: 1,
  phase: "ready",
  ready: true,
  statusLine: "Ready: No blocking reasons",
  targetPage: {
    entryId: "control-view",
    href: "./control-page.html",
  },
  requiredMethods: {
    loadSessionState: "loadControlPageSessionState",
    readStatus: "readControlPageStatus",
  },
  blockingReasons: [],
  displayRows: shellViewModel.shellSessionHandoffRenderState.rows,
  nextSteps: [
    {
      id: "open-control-page",
      label: "Open control page target",
      targetPage: {
        entryId: "control-view",
        href: "./control-page.html",
      },
    },
    {
      id: "read-readonly-status",
      label: "Read readonly status",
      methods: {
        loadSessionState: "loadControlPageSessionState",
        readStatus: "readControlPageStatus",
      },
    },
  ],
});
assert.deepEqual(shellViewModel.shellSessionHandoffChecklist, {
  apiName: "ini-panel-shell-session-handoff-checklist",
  checklistVersion: 1,
  phase: "ready",
  ready: true,
  statusLine: "Ready: No blocking reasons",
  checks: [
    {
      id: "render-state",
      label: "Render state",
      status: "pass",
      value: "Ready: No blocking reasons",
    },
    {
      id: "target-page",
      label: "Control target",
      status: "pass",
      value: "./control-page.html",
    },
    {
      id: "load-session-method",
      label: "Load session method",
      status: "pass",
      value: "loadControlPageSessionState",
    },
    {
      id: "read-status-method",
      label: "Read status method",
      status: "pass",
      value: "readControlPageStatus",
    },
    {
      id: "blocking-reasons",
      label: "Blocking reasons",
      status: "pass",
      value: "none",
    },
  ],
  displayRows: shellViewModel.shellSessionHandoffActionPlan.displayRows,
  nextStepIds: ["open-control-page", "read-readonly-status"],
  blockingReasons: [],
});
assert.deepEqual(shellViewModel.shellSessionHandoffPackage, {
  apiName: "ini-panel-shell-session-handoff-package",
  packageVersion: 1,
  phase: "ready",
  ready: true,
  statusLine: "Ready: No blocking reasons",
  manifests: {
    shellIntegration: shellViewModel.shellIntegrationManifest,
    launchApi: shellViewModel.shellIntegrationManifest.launchApiManifest,
    controlPageApi: shellViewModel.shellIntegrationManifest.controlPageApiManifest,
    launchMethods: shellViewModel.shellIntegrationManifest.launchApiManifest.methods,
    controlPageMethods: shellViewModel.shellIntegrationManifest.controlPageApiManifest.methods,
  },
  snapshot: shellViewModel.shellSessionHandoffSnapshot,
  renderState: shellViewModel.shellSessionHandoffRenderState,
  actionPlan: shellViewModel.shellSessionHandoffActionPlan,
  checklist: shellViewModel.shellSessionHandoffChecklist,
});
assert.deepEqual(shellViewModel.shellSessionHandoffPackageSchema, {
  apiName: "ini-panel-shell-session-handoff-package",
  packageVersion: 1,
  fields: [
    "apiName",
    "packageVersion",
    "phase",
    "ready",
    "statusLine",
    "manifests",
    "snapshot",
    "renderState",
    "actionPlan",
    "checklist",
  ],
  manifestFields: [
    "shellIntegration",
    "launchApi",
    "controlPageApi",
    "launchMethods",
    "controlPageMethods",
  ],
});
assert.deepEqual(shellViewModel.shellSessionHandoffPackageReport, {
  apiName: "ini-panel-shell-session-handoff-package-report",
  reportVersion: 1,
  phase: "ready",
  ready: true,
  packageSupported: true,
  packageReady: true,
  statusLine: "Ready: No blocking reasons",
  schema: shellViewModel.shellSessionHandoffPackageSchema,
  package: {
    apiName: "ini-panel-shell-session-handoff-package",
    packageVersion: 1,
    phase: "ready",
    ready: true,
  },
  missingPackageFields: [],
  missingManifestFields: [],
  mismatchFields: [],
  blockingReasons: [],
  rows: [
    {
      id: "package-supported",
      label: "Package schema",
      value: "supported",
    },
    {
      id: "package-ready",
      label: "Package readiness",
      value: "ready",
    },
    {
      id: "missing-package-fields",
      label: "Missing package fields",
      value: "none",
    },
    {
      id: "missing-manifest-fields",
      label: "Missing manifest fields",
      value: "none",
    },
    {
      id: "mismatch-fields",
      label: "Mismatched fields",
      value: "none",
    },
    {
      id: "blocking-reasons",
      label: "Blocking reasons",
      value: "none",
    },
  ],
});
assert.deepEqual(shellViewModel.shellSessionHandoffPackageDisplayViewModel, {
  phase: "ready",
  title: "Shell handoff package",
  statusText: "Ready",
  detailText: "No blocking reasons",
  rows: shellViewModel.shellSessionHandoffPackageReport.rows,
});
assert.deepEqual(shellViewModel.shellSessionHandoffPackageRenderState, {
  apiName: "ini-panel-shell-session-handoff-package-render-state",
  renderStateVersion: 1,
  phase: "ready",
  ready: true,
  title: "Shell handoff package",
  statusText: "Ready",
  detailText: "No blocking reasons",
  statusLine: "Ready: No blocking reasons",
  rows: shellViewModel.shellSessionHandoffPackageDisplayViewModel.rows,
  dataset: {
    handoffPhase: "ready",
    handoffReady: "true",
    handoffScope: "package",
  },
});
assert.deepEqual(shellViewModel.shellSessionHandoffPackageMountState, {
  apiName: "ini-panel-shell-session-handoff-package-mount-state",
  mountStateVersion: 1,
  phase: "blocked",
  ready: false,
  packageReady: true,
  targetReady: true,
  methodsReady: true,
  sessionReady: false,
  statusLine: "Blocked: waiting-panel",
  packageRenderState: shellViewModel.shellSessionHandoffPackageRenderState,
  targetPage: {
    entryId: "control-view",
    href: "./control-page.html",
  },
  requiredMethods: {
    loadSessionState: "loadControlPageSessionState",
    readStatus: "readControlPageStatus",
  },
  sessionLoadState: createControlPageSessionLoadState({ phase: "waiting-panel" }),
  blockingReasons: [],
  checks: [
    {
      id: "package-render-state",
      label: "Package render state",
      status: "pass",
      value: "Ready: No blocking reasons",
    },
    {
      id: "target-page",
      label: "Control target",
      status: "pass",
      value: "./control-page.html",
    },
    {
      id: "required-methods",
      label: "Readonly methods",
      status: "pass",
      value: "loadControlPageSessionState, readControlPageStatus",
    },
    {
      id: "session-load-state",
      label: "Session load state",
      status: "blocked",
      value: "waiting-panel",
    },
    {
      id: "blocking-reasons",
      label: "Blocking reasons",
      status: "pass",
      value: "none",
    },
  ],
});
assert.deepEqual(shellViewModel.shellSessionHandoffPackageMountDisplayViewModel, {
  phase: "blocked",
  title: "Shell handoff mount",
  statusText: "Blocked",
  detailText: "session-load-state",
  rows: shellViewModel.shellSessionHandoffPackageMountState.checks,
});
assert.deepEqual(shellViewModel.shellSessionHandoffPackageMountRenderState, {
  apiName: "ini-panel-shell-session-handoff-package-mount-render-state",
  renderStateVersion: 1,
  phase: "blocked",
  ready: false,
  title: "Shell handoff mount",
  statusText: "Blocked",
  detailText: "session-load-state",
  statusLine: "Blocked: session-load-state",
  rows: shellViewModel.shellSessionHandoffPackageMountDisplayViewModel.rows,
  dataset: {
    handoffPhase: "blocked",
    handoffReady: "false",
    handoffScope: "mount",
  },
});
assert.deepEqual(shellViewModel.shellSessionHandoffMountDomContract, {
  apiName: "ini-panel-shell-session-handoff-mount-dom-contract",
  contractVersion: 1,
  requiredNodeIds: ["mount", "status", "rows"],
  selectors: {
    mount: "[data-handoff-mount]",
    status: "[data-handoff-mount-status]",
    rows: "[data-handoff-mount-rows]",
  },
  mountDatasetKeys: ["handoffPhase", "handoffReady", "handoffScope"],
  rowDatasetPrefix: "handoffMount",
  rowDatasetKeys: {
    term: ["handoffMountRow", "handoffMountStatus"],
    detail: ["handoffMountValue", "handoffMountStatus"],
  },
  renderResultFields: ["rendered", "statusLine", "rowCount", "rowIds", "dataset"],
});
assert.deepEqual(shellViewModel.shellWorkflowOverviewContract, {
  pageHref: "./workflow-overview.html",
  entryId: "workflow-overview",
  apiName: "linuxCncIniPanelWorkflowOverviewApi",
  methodNames: [
    "getWorkflowOverviewRenderState",
    "getWorkflowOverviewDisplayViewModel",
    "getWorkflowOverviewSummary",
    "getWorkflowOverviewSessionReadinessReport",
    "getWorkflowOverviewDomContract",
    "getWorkflowOverviewDomReadiness",
    "renderWorkflowOverview",
    "mountWorkflowOverview",
    "createWorkflowOverviewRenderState",
  ],
});
assert.equal(
  createIniPanelShellSessionHandoffPackageMountState({
    handoffPackage: shellViewModel.shellSessionHandoffPackage,
    packageRenderState: shellViewModel.shellSessionHandoffPackageRenderState,
    sessionLoadState: createControlPageSessionLoadState({
      phase: "ready",
      panelReady: true,
      apiReady: true,
      controlViewReady: true,
      controlView: { status: { runStatus: "not-run" } },
    }),
  }).ready,
  true,
);
assert.deepEqual(
  createIniPanelShellSessionHandoffPackageMountDisplayViewModel(createIniPanelShellSessionHandoffPackageMountState({
    handoffPackage: shellViewModel.shellSessionHandoffPackage,
    packageRenderState: shellViewModel.shellSessionHandoffPackageRenderState,
    sessionLoadState: createControlPageSessionLoadState({
      phase: "ready",
      panelReady: true,
      apiReady: true,
      controlViewReady: true,
      controlView: { status: { runStatus: "not-run" } },
    }),
  })).detailText,
  "No blocking reasons",
);
assert.equal(
  isSupportedIniPanelShellIntegrationManifest(shellViewModel.shellIntegrationManifest),
  true,
);
assert.equal(
  shellViewModel.shellIntegrationManifest.manifestVersion,
  createIniPanelShellIntegrationSchema().manifestVersion,
);
assert.deepEqual(shellViewModel.shellIntegrationManifest.pages, shellViewModel.pages);
assert.deepEqual(shellViewModel.shellIntegrationManifest.launcherLinks, shellViewModel.launcherLinks);
assert.deepEqual(shellViewModel.shellIntegrationManifest.compatibility, {
  launchApiManifest: true,
  controlPageApiManifest: true,
});
assert.equal(shellViewModel.shellIntegrationReadiness.ready, true);
assert.deepEqual(shellViewModel.shellIntegrationReadiness.missing, []);
assert.deepEqual(shellViewModel.launchApiSchema, createIniPanelLaunchApiSchema());
assert.deepEqual(shellViewModel.launchApiManifest, createIniPanelLaunchApiManifest());
assert.equal(isSupportedIniPanelLaunchApiManifest(shellViewModel.launchApiManifest), true);
assert.equal(shellViewModel.launchApiManifest.manifestVersion, createIniPanelLaunchApiSchema().manifestVersion);
assert.deepEqual(shellViewModel.controlPage.browserApiSchema, createControlPageBrowserApiSchema());
assert.deepEqual(shellViewModel.controlPage.browserApiManifest, createControlPageBrowserApiManifest());
assert.deepEqual(shellViewModel.controlPage.browserApiMethods, createControlPageBrowserApiMethods());
assert.equal(isSupportedIniPanelControlPageApiManifest(shellViewModel.controlPage.browserApiManifest), true);
assert.equal(
  shellViewModel.controlPage.browserApiManifest.manifestVersion,
  createControlPageBrowserApiSchema().manifestVersion,
);
assert.equal(shellViewModel.controlPage.createController, createMachineSessionControlPageController);
assert.equal(shellViewModel.isSupportedShellIntegrationManifest, isSupportedIniPanelShellIntegrationManifest);
assert.equal(shellViewModel.createShellIntegrationReadiness, createIniPanelShellIntegrationReadiness);
assert.equal(shellViewModel.createShellIntegrationWorkflowPlan, createIniPanelShellIntegrationWorkflowPlan);
assert.equal(shellViewModel.isSupportedShellSessionHandoffSummary, isSupportedIniPanelShellSessionHandoffSummary);
assert.equal(shellViewModel.createShellSessionHandoffSummarySchema, createIniPanelShellSessionHandoffSummarySchema);
assert.equal(shellViewModel.createShellSessionHandoffSummary, createIniPanelShellSessionHandoffSummary);
assert.equal(
  shellViewModel.createShellSessionHandoffCompatibilityReport,
  createIniPanelShellSessionHandoffCompatibilityReport,
);
assert.equal(
  shellViewModel.createShellSessionHandoffDisplayViewModel,
  createIniPanelShellSessionHandoffDisplayViewModel,
);
assert.equal(shellViewModel.createShellSessionHandoffSnapshot, createIniPanelShellSessionHandoffSnapshot);
assert.equal(shellViewModel.createShellSessionHandoffRenderState, createIniPanelShellSessionHandoffRenderState);
assert.equal(shellViewModel.createShellSessionHandoffActionPlan, createIniPanelShellSessionHandoffActionPlan);
assert.equal(shellViewModel.createShellSessionHandoffChecklist, createIniPanelShellSessionHandoffChecklist);
assert.equal(shellViewModel.createShellSessionHandoffPackage, createIniPanelShellSessionHandoffPackage);
assert.equal(
  shellViewModel.createShellSessionHandoffPackageDisplayViewModel,
  createIniPanelShellSessionHandoffPackageDisplayViewModel,
);
assert.equal(
  shellViewModel.createShellSessionHandoffPackageRenderState,
  createIniPanelShellSessionHandoffPackageRenderState,
);
assert.equal(
  shellViewModel.createShellSessionHandoffPackageMountState,
  createIniPanelShellSessionHandoffPackageMountState,
);
assert.equal(
  shellViewModel.createShellSessionHandoffPackageMountDisplayViewModel,
  createIniPanelShellSessionHandoffPackageMountDisplayViewModel,
);
assert.equal(
  shellViewModel.createShellSessionHandoffPackageMountRenderState,
  createIniPanelShellSessionHandoffPackageMountRenderState,
);
assert.equal(
  shellViewModel.createShellSessionHandoffMountDomContract,
  createIniPanelShellSessionHandoffMountDomContract,
);
assert.equal(
  shellViewModel.createShellSessionHandoffMountDomReadiness,
  createIniPanelShellSessionHandoffMountDomReadiness,
);
assert.equal(
  shellViewModel.renderShellSessionHandoffMountState,
  renderIniPanelShellSessionHandoffMountState,
);
assert.equal(shellViewModel.mountShellSessionHandoff, mountIniPanelShellSessionHandoff);
assert.equal(
  shellViewModel.mountShellSessionHandoffFromControlPage,
  mountIniPanelShellSessionHandoffFromControlPage,
);
assert.equal(
  shellViewModel.readShellSessionHandoffStatusFromControlPage,
  readIniPanelShellSessionHandoffStatusFromControlPage,
);
assert.equal(
  shellViewModel.createShellSessionHandoffWorkflowSummary,
  createIniPanelShellSessionHandoffWorkflowSummary,
);
assert.equal(
  shellViewModel.createShellSessionReadinessWorkflowReport,
  createIniPanelShellSessionReadinessWorkflowReport,
);
assert.equal(
  shellViewModel.createShellSessionHandoffWorkflowDisplayViewModel,
  createIniPanelShellSessionHandoffWorkflowDisplayViewModel,
);
assert.equal(
  shellViewModel.createShellSessionHandoffWorkflowRenderState,
  createIniPanelShellSessionHandoffWorkflowRenderState,
);
assert.equal(
  shellViewModel.createShellSessionHandoffWorkflowDomContract,
  createIniPanelShellSessionHandoffWorkflowDomContract,
);
assert.equal(
  shellViewModel.createShellSessionHandoffWorkflowDomReadiness,
  createIniPanelShellSessionHandoffWorkflowDomReadiness,
);
assert.equal(
  shellViewModel.renderShellSessionHandoffWorkflowState,
  renderIniPanelShellSessionHandoffWorkflowState,
);
assert.equal(
  shellViewModel.mountShellSessionHandoffWorkflow,
  mountIniPanelShellSessionHandoffWorkflow,
);
assert.equal(shellViewModel.createWorkflowOverviewContract, createIniPanelShellWorkflowOverviewContract);
assert.equal(shellViewModel.createWorkflowOverviewReadiness, createIniPanelShellWorkflowOverviewReadiness);
assert.equal(shellViewModel.mountWorkflowOverviewEmbedding, mountIniPanelShellWorkflowOverviewEmbedding);
assert.equal(shellViewModel.createWorkflowOverviewEmbeddingReport, createIniPanelShellWorkflowOverviewEmbeddingReport);
assert.equal(
  shellViewModel.createWorkflowOverviewEmbeddingDisplayViewModel,
  createIniPanelShellWorkflowOverviewEmbeddingDisplayViewModel,
);
assert.equal(
  shellViewModel.createWorkflowOverviewEmbeddingRenderState,
  createIniPanelShellWorkflowOverviewEmbeddingRenderState,
);
assert.equal(
  shellViewModel.createWorkflowOverviewEmbeddingDomContract,
  createIniPanelShellWorkflowOverviewEmbeddingDomContract,
);
assert.equal(
  shellViewModel.createWorkflowOverviewEmbeddingDomReadiness,
  createIniPanelShellWorkflowOverviewEmbeddingDomReadiness,
);
assert.equal(
  shellViewModel.renderWorkflowOverviewEmbeddingState,
  renderIniPanelShellWorkflowOverviewEmbeddingState,
);
assert.equal(
  shellViewModel.mountWorkflowOverviewEmbeddingState,
  mountIniPanelShellWorkflowOverviewEmbeddingState,
);
assert.equal(
  shellViewModel.createWorkflowOverviewEmbeddingMountDisplayViewModel,
  createIniPanelShellWorkflowOverviewEmbeddingMountDisplayViewModel,
);
assert.equal(
  shellViewModel.createWorkflowOverviewEmbeddingMountRenderState,
  createIniPanelShellWorkflowOverviewEmbeddingMountRenderState,
);
assert.equal(
  shellViewModel.createWorkflowOverviewEmbeddingMountDomContract,
  createIniPanelShellWorkflowOverviewEmbeddingMountDomContract,
);
assert.equal(
  shellViewModel.createWorkflowOverviewEmbeddingMountDomReadiness,
  createIniPanelShellWorkflowOverviewEmbeddingMountDomReadiness,
);
assert.equal(
  shellViewModel.renderWorkflowOverviewEmbeddingMountState,
  renderIniPanelShellWorkflowOverviewEmbeddingMountState,
);
assert.equal(
  shellViewModel.mountWorkflowOverviewEmbeddingMountState,
  mountIniPanelShellWorkflowOverviewEmbeddingMountState,
);
assert.equal(shellViewModel.createShellSessionHandoffPackageReport, createIniPanelShellSessionHandoffPackageReport);
assert.equal(shellViewModel.createShellSessionHandoffPackageSchema, createIniPanelShellSessionHandoffPackageSchema);
assert.equal(shellViewModel.isSupportedShellSessionHandoffPackage, isSupportedIniPanelShellSessionHandoffPackage);
assert.deepEqual(shellViewModel.controlPage.contract, createIniPanelShellControlPageContract());
assert.equal(shellViewModel.controlPage.isSupportedBrowserApiManifest, isSupportedIniPanelControlPageApiManifest);
assert.equal(shellViewModel.controlPage.loadSessionState, loadMachineSessionForControlPageWorkflow);
assert.equal(shellViewModel.controlPage.readonlyStatusApiManifest.apiName, "machine-session-readonly-status");
assert.deepEqual(shellViewModel.controlPage.readonlyStatusApiManifest, createMachineSessionReadonlyStatusApiManifest());
assert.equal(shellViewModel.controlPage.readStatus, readMachineSessionReadonlyStatus);
assert.equal(shellViewModel.controlPage.refresh, refreshMachineSessionControlPage);
assert.equal(shellViewModel.controlPage.renderView, renderMachineSessionControlView);
shellViewModel.pages[0].title = "changed";
shellViewModel.launcherLinks[0].label = "changed";
assert.equal(INI_PANEL_ENTRIES[0].title, "Open edit and run panel");

const panelFrame = {
  contentWindow: {
    linuxCncIniPanelApi: {
      getMachineSessionControlView: () => ({
        status: {
          lastAction: "run-gcode",
          runStatus: "ok",
          error: null,
        },
        sections: [],
      }),
      getMachineSessionStateBundle: () => ({
        overview: {
          phase: "ran",
        },
      }),
      getMachineSessionWorkflowStatus: () => ({
        overview: {
          phase: "ran",
        },
        lastAction: "run-gcode",
        error: null,
      }),
    },
  },
  addEventListener() {},
};
const statusNode = { textContent: "" };
const viewNode = { textContent: "" };
let renderedView = null;
const controller = createMachineSessionControlPageController({
  panelFrame,
  statusNode,
  viewNode,
  renderControlView: (_container, view) => {
    renderedView = view;
    return { rendered: true };
  },
});

const mountRowsNode = {
  children: [],
  replaceChildren() {
    this.children = [];
  },
  append(...nodes) {
    this.children.push(...nodes);
  },
};
const mountNode = { dataset: {} };
const mountStatusNode = { textContent: "" };
const mountDocument = {
  createElement: (tagName) => ({ tagName, dataset: {}, textContent: "" }),
};
assert.deepEqual(
  createIniPanelShellSessionHandoffMountDomReadiness({
    documentRef: mountDocument,
    mountNode,
    statusNode: mountStatusNode,
    rowsNode: mountRowsNode,
  }),
  {
    apiName: "ini-panel-shell-session-handoff-mount-dom-readiness",
    readinessVersion: 1,
    phase: "ready",
    ready: true,
    missing: [],
    checks: {
      document: true,
      mount: true,
      status: true,
      rows: true,
      rowDatasetPrefix: true,
    },
    contract: createIniPanelShellSessionHandoffMountDomContract(),
  },
);
assert.deepEqual(
  createIniPanelShellSessionHandoffMountDomReadiness({ documentRef: mountDocument }).missing,
  ["mount", "status", "rows"],
);
assert.deepEqual(
  renderIniPanelShellSessionHandoffMountState(shellViewModel.shellSessionHandoffPackageMountRenderState, {
    documentRef: mountDocument,
    mountNode,
    statusNode: mountStatusNode,
    rowsNode: mountRowsNode,
  }),
  {
    rendered: true,
    statusLine: "Blocked: session-load-state",
    rowCount: 5,
    rowIds: [
      "package-render-state",
      "target-page",
      "required-methods",
      "session-load-state",
      "blocking-reasons",
    ],
    dataset: {
      handoffPhase: "blocked",
      handoffReady: "false",
      handoffScope: "mount",
    },
  },
);
assert.equal(mountRowsNode.children[7].dataset.handoffMountValue, "session-load-state");
assert.equal(mountRowsNode.children[7].dataset.handoffMountStatus, "blocked");
const mountWorkflowResult = mountIniPanelShellSessionHandoff({
  renderState: shellViewModel.shellSessionHandoffPackageMountRenderState,
  documentRef: mountDocument,
  mountNode,
  statusNode: mountStatusNode,
  rowsNode: mountRowsNode,
});
assert.equal(mountWorkflowResult.apiName, "ini-panel-shell-session-handoff-mount-workflow");
assert.equal(mountWorkflowResult.workflowVersion, 1);
assert.equal(mountWorkflowResult.phase, "blocked");
assert.equal(mountWorkflowResult.ready, false);
assert.equal(mountWorkflowResult.domReadiness.ready, true);
assert.equal(mountWorkflowResult.renderResult.rendered, true);
assert.equal(mountWorkflowResult.renderResult.rowCount, 5);
assert.equal(mountWorkflowResult.error, null);
const controlPageMountWorkflow = mountIniPanelShellSessionHandoffFromControlPage({
  handoffPackage: shellViewModel.shellSessionHandoffPackage,
  packageRenderState: shellViewModel.shellSessionHandoffPackageRenderState,
  sessionLoadState: createControlPageSessionLoadState({
    phase: "ready",
    panelReady: true,
    apiReady: true,
    controlViewReady: true,
    controlView: { status: { runStatus: "not-run" } },
  }),
  documentRef: mountDocument,
  mountNode,
  statusNode: mountStatusNode,
  rowsNode: mountRowsNode,
});
assert.equal(controlPageMountWorkflow.apiName, "ini-panel-shell-session-handoff-control-page-mount-workflow");
assert.equal(controlPageMountWorkflow.workflowVersion, 1);
assert.equal(controlPageMountWorkflow.phase, "ready");
assert.equal(controlPageMountWorkflow.ready, true);
assert.equal(controlPageMountWorkflow.sessionLoadState.phase, "ready");
assert.equal(controlPageMountWorkflow.mountState.ready, true);
assert.equal(controlPageMountWorkflow.mountRenderState.ready, true);
assert.equal(controlPageMountWorkflow.mountWorkflow.renderResult.dataset.handoffReady, "true");
assert.equal(controlPageMountWorkflow.sessionLoadError, null);
const controlPageApiMountWorkflow = mountIniPanelShellSessionHandoffFromControlPage({
  handoffPackage: shellViewModel.shellSessionHandoffPackage,
  packageRenderState: shellViewModel.shellSessionHandoffPackageRenderState,
  controlPageApi: {
    loadControlPageSessionState: () => createControlPageSessionLoadState({ phase: "waiting-session" }),
  },
  documentRef: mountDocument,
  mountNode,
  statusNode: mountStatusNode,
  rowsNode: mountRowsNode,
});
assert.equal(controlPageApiMountWorkflow.phase, "blocked");
assert.equal(controlPageApiMountWorkflow.sessionLoadState.phase, "waiting-session");
const readonlyStatusResult = readIniPanelShellSessionHandoffStatusFromControlPage({
  handoffSummary: shellViewModel.shellSessionHandoffSummary,
  readonlyStatus: createMachineSessionReadonlyStatus({
    stateBundle: { overview: { phase: "loaded" } },
    workflowStatus: {
      lastAction: "load-session",
      run: { status: "not-run" },
      sessionReadiness: { phase: "ready", ready: true, missing: [] },
    },
    controlView: { sections: [] },
  }),
});
assert.equal(readonlyStatusResult.apiName, "ini-panel-shell-session-handoff-readonly-status-result");
assert.equal(readonlyStatusResult.resultVersion, 1);
assert.equal(readonlyStatusResult.phase, "ready");
assert.equal(readonlyStatusResult.ready, true);
assert.equal(readonlyStatusResult.readStatusMethod, "readControlPageStatus");
assert.deepEqual(readonlyStatusResult.expectedStatusFields, shellViewModel.shellSessionHandoffSummary.readonlyStatusFields);
assert.deepEqual(readonlyStatusResult.missingStatusFields, []);
assert.equal(readonlyStatusResult.readonlyStatus.status.lastAction, "load-session");
assert.equal(readonlyStatusResult.readError, null);
const controlPageApiStatusResult = readIniPanelShellSessionHandoffStatusFromControlPage({
  handoffSummary: shellViewModel.shellSessionHandoffSummary,
  controlPageApi: {
    readControlPageStatus: () => createMachineSessionReadonlyStatus({
      stateBundle: { overview: { phase: "api-read" } },
    }),
  },
});
assert.equal(controlPageApiStatusResult.phase, "ready");
assert.equal(controlPageApiStatusResult.readonlyStatus.overview.phase, "api-read");
const missingStatusResult = readIniPanelShellSessionHandoffStatusFromControlPage({
  handoffSummary: shellViewModel.shellSessionHandoffSummary,
  readonlyStatus: { status: {} },
});
assert.equal(missingStatusResult.phase, "blocked");
assert.deepEqual(missingStatusResult.missingStatusFields, [
  "stateBundle",
  "workflowStatus",
  "overview",
  "controlView",
  "report",
  "sessionReadiness",
  "runReadiness",
  "run",
  "session",
]);
assert.equal(
  readIniPanelShellSessionHandoffStatusFromControlPage({
    handoffSummary: shellViewModel.shellSessionHandoffSummary,
  }).readError,
  "Missing readControlPageStatus",
);
const workflowSummaryResult = createIniPanelShellSessionHandoffWorkflowSummary({
  mountWorkflow: mountWorkflowResult,
  controlPageMountWorkflow,
  readonlyStatusResult,
});
assert.equal(workflowSummaryResult.apiName, "ini-panel-shell-session-handoff-workflow-summary");
assert.equal(workflowSummaryResult.summaryVersion, 1);
assert.equal(workflowSummaryResult.phase, "blocked");
assert.equal(workflowSummaryResult.ready, false);
assert.deepEqual(workflowSummaryResult.sessionReadiness, {
  phase: "ready",
  ready: true,
  missing: [],
});
assert.equal(workflowSummaryResult.rows.find(({ id }) => id === "session-readiness")?.value, "ready");
assert.equal(workflowSummaryResult.rows.length, 6);
assert.equal(workflowSummaryResult.blockingReasons[0], "mount:blocked");
const sessionReadinessWorkflowReport = createIniPanelShellSessionReadinessWorkflowReport({
  workflowSummary: workflowSummaryResult,
});
assert.equal(sessionReadinessWorkflowReport.apiName, "ini-panel-shell-session-readiness-workflow-report");
assert.equal(sessionReadinessWorkflowReport.reportVersion, 1);
assert.equal(sessionReadinessWorkflowReport.phase, "ready");
assert.equal(sessionReadinessWorkflowReport.ready, true);
assert.equal(sessionReadinessWorkflowReport.statusLine, "Ready: session readiness available");
assert.deepEqual(sessionReadinessWorkflowReport.missing, []);
assert.equal(sessionReadinessWorkflowReport.rows.length, 3);
assert.equal(sessionReadinessWorkflowReport.rows[0].value, "ready");
assert.equal(shellViewModel.shellSessionReadinessWorkflowReport.ready, false);
assert.equal(shellViewModel.shellSessionReadinessWorkflowReport.rows.length, 3);
const readyWorkflowSummaryResult = createIniPanelShellSessionHandoffWorkflowSummary({
  mountWorkflow: {
    phase: "ready",
    ready: true,
    statusLine: "Ready: mount workflow available",
  },
  controlPageMountWorkflow,
  readonlyStatusResult,
});
assert.equal(readyWorkflowSummaryResult.phase, "ready");
assert.equal(readyWorkflowSummaryResult.ready, true);
assert.equal(readyWorkflowSummaryResult.blockingReasons.length, 0);
const workflowDisplayViewModel = createIniPanelShellSessionHandoffWorkflowDisplayViewModel(
  workflowSummaryResult,
);
assert.equal(workflowDisplayViewModel.phase, "blocked");
assert.equal(workflowDisplayViewModel.title, "Shell handoff workflow");
assert.equal(workflowDisplayViewModel.statusText, "Blocked");
assert.equal(workflowDisplayViewModel.detailText, "mount:blocked");
assert.equal(workflowDisplayViewModel.rows.length, 6);
const readyWorkflowDisplayViewModel = createIniPanelShellSessionHandoffWorkflowDisplayViewModel(
  readyWorkflowSummaryResult,
);
assert.equal(readyWorkflowDisplayViewModel.phase, "ready");
assert.equal(readyWorkflowDisplayViewModel.statusText, "Ready");
assert.equal(readyWorkflowDisplayViewModel.detailText, "No blocking reasons");
const workflowRenderState = createIniPanelShellSessionHandoffWorkflowRenderState(
  workflowDisplayViewModel,
);
assert.equal(workflowRenderState.apiName, "ini-panel-shell-session-handoff-workflow-render-state");
assert.equal(workflowRenderState.renderStateVersion, 1);
assert.equal(workflowRenderState.phase, "blocked");
assert.equal(workflowRenderState.statusLine, "Blocked: mount:blocked");
assert.equal(workflowRenderState.dataset.handoffScope, "workflow");
assert.equal(workflowRenderState.rows.length, 6);
const readyWorkflowRenderState = createIniPanelShellSessionHandoffWorkflowRenderState(
  readyWorkflowDisplayViewModel,
);
assert.equal(readyWorkflowRenderState.phase, "ready");
assert.equal(readyWorkflowRenderState.statusLine, "Ready: No blocking reasons");
assert.deepEqual(
  createIniPanelShellSessionHandoffWorkflowDomReadiness({
    documentRef: mountDocument,
    mountNode,
    statusNode: mountStatusNode,
    rowsNode: mountRowsNode,
  }),
  {
    apiName: "ini-panel-shell-session-handoff-workflow-dom-readiness",
    readinessVersion: 1,
    phase: "ready",
    ready: true,
    missing: [],
    checks: {
      document: true,
      mount: true,
      status: true,
      rows: true,
      rowDatasetPrefix: true,
    },
    contract: createIniPanelShellSessionHandoffWorkflowDomContract(),
  },
);
assert.deepEqual(
  createIniPanelShellSessionHandoffWorkflowDomReadiness({ documentRef: mountDocument }).missing,
  ["mount", "status", "rows"],
);
assert.deepEqual(
  renderIniPanelShellSessionHandoffWorkflowState(workflowRenderState, {
    documentRef: mountDocument,
    mountNode,
    statusNode: mountStatusNode,
    rowsNode: mountRowsNode,
  }),
  {
    rendered: true,
    statusLine: "Blocked: mount:blocked",
    rowCount: 6,
    rowIds: [
      "mount-workflow",
      "control-page-mount-workflow",
      "readonly-status-workflow",
      "session-readiness",
      "readonly-status-missing-fields",
      "blocking-reasons",
    ],
    dataset: {
      handoffPhase: "blocked",
      handoffReady: "false",
      handoffScope: "workflow",
    },
  },
);
const workflowDomMountResult = mountIniPanelShellSessionHandoffWorkflow({
  renderState: workflowRenderState,
  documentRef: mountDocument,
  mountNode,
  statusNode: mountStatusNode,
  rowsNode: mountRowsNode,
});
assert.equal(workflowDomMountResult.apiName, "ini-panel-shell-session-handoff-workflow-dom-mount");
assert.equal(workflowDomMountResult.workflowVersion, 1);
assert.equal(workflowDomMountResult.phase, "blocked");
assert.equal(workflowDomMountResult.ready, false);
assert.equal(workflowDomMountResult.renderResult.rowCount, 6);
assert.equal(workflowDomMountResult.renderResult.dataset.handoffScope, "workflow");
assert.deepEqual(createIniPanelShellWorkflowOverviewContract(), shellViewModel.shellWorkflowOverviewContract);
assert.deepEqual(createIniPanelShellWorkflowOverviewReadiness(), {
  apiName: "ini-panel-shell-workflow-overview-readiness",
  readinessVersion: 1,
  phase: "blocked",
  ready: false,
  missing: shellViewModel.shellWorkflowOverviewContract.methodNames,
  contract: shellViewModel.shellWorkflowOverviewContract,
});
const workflowOverviewApi = {
  getWorkflowOverviewRenderState: () => workflowRenderState,
  getWorkflowOverviewDisplayViewModel: () => workflowDisplayViewModel,
  getWorkflowOverviewSummary: () => workflowSummaryResult,
  getWorkflowOverviewSessionReadinessReport: () => sessionReadinessWorkflowReport,
  getWorkflowOverviewDomContract: createIniPanelShellSessionHandoffWorkflowDomContract,
  getWorkflowOverviewDomReadiness: createIniPanelShellSessionHandoffWorkflowDomReadiness,
  renderWorkflowOverview: renderIniPanelShellSessionHandoffWorkflowState,
  mountWorkflowOverview: (options) => mountIniPanelShellSessionHandoffWorkflow({
    renderState: workflowRenderState,
    ...options,
  }),
  createWorkflowOverviewRenderState: createIniPanelShellSessionHandoffWorkflowRenderState,
};
assert.deepEqual(createIniPanelShellWorkflowOverviewReadiness({
  overviewApi: workflowOverviewApi,
}), {
  apiName: "ini-panel-shell-workflow-overview-readiness",
  readinessVersion: 1,
  phase: "ready",
  ready: true,
  missing: [],
  contract: shellViewModel.shellWorkflowOverviewContract,
});
const workflowOverviewEmbedding = mountIniPanelShellWorkflowOverviewEmbedding({
  overviewApi: workflowOverviewApi,
  mountOptions: {
    documentRef: mountDocument,
    mountNode,
    statusNode: mountStatusNode,
    rowsNode: mountRowsNode,
  },
});
assert.equal(workflowOverviewEmbedding.apiName, "ini-panel-shell-workflow-overview-embedding");
assert.equal(workflowOverviewEmbedding.embeddingVersion, 1);
assert.equal(workflowOverviewEmbedding.ready, false);
assert.equal(workflowOverviewEmbedding.renderState.statusLine, "Blocked: mount:blocked");
assert.equal(workflowOverviewEmbedding.mountResult.renderResult.rowCount, 6);
assert.equal(workflowOverviewEmbedding.error, null);
const workflowOverviewEmbeddingReport = createIniPanelShellWorkflowOverviewEmbeddingReport(workflowOverviewEmbedding);
assert.deepEqual(workflowOverviewEmbeddingReport, {
  apiName: "ini-panel-shell-workflow-overview-embedding-report",
  reportVersion: 1,
  phase: "blocked",
  ready: false,
  overviewReady: true,
  embeddingReady: false,
  mountReady: false,
  statusLine: "Blocked: embedding:blocked, mount:blocked",
  pageHref: "./workflow-overview.html",
  contract: shellViewModel.shellWorkflowOverviewContract,
  missingMethods: [],
  mountPhase: "blocked",
  renderRowCount: 6,
  error: null,
  blockingReasons: ["embedding:blocked", "mount:blocked"],
  rows: [
    {
      id: "overview-api",
      label: "Overview API",
      value: "ready",
    },
    {
      id: "missing-methods",
      label: "Missing methods",
      value: "none",
    },
    {
      id: "embedding-ready",
      label: "Embedding readiness",
      value: "blocked",
    },
    {
      id: "mount-phase",
      label: "Mount phase",
      value: "blocked",
    },
    {
      id: "render-row-count",
      label: "Render row count",
      value: "6",
    },
    {
      id: "error",
      label: "Error",
      value: "none",
    },
  ],
});
assert.deepEqual(
  createIniPanelShellWorkflowOverviewEmbeddingDisplayViewModel(workflowOverviewEmbeddingReport),
  {
    phase: "blocked",
    title: "Workflow overview embedding",
    statusText: "Blocked",
    detailText: "embedding:blocked, mount:blocked",
    rows: workflowOverviewEmbeddingReport.rows,
  },
);
assert.deepEqual(
  createIniPanelShellWorkflowOverviewEmbeddingRenderState(
    createIniPanelShellWorkflowOverviewEmbeddingDisplayViewModel(workflowOverviewEmbeddingReport),
  ),
  {
    apiName: "ini-panel-shell-workflow-overview-embedding-render-state",
    renderStateVersion: 1,
    phase: "blocked",
    ready: false,
    title: "Workflow overview embedding",
    statusText: "Blocked",
    detailText: "embedding:blocked, mount:blocked",
    statusLine: "Blocked: embedding:blocked, mount:blocked",
    rows: workflowOverviewEmbeddingReport.rows,
    dataset: {
      handoffPhase: "blocked",
      handoffReady: "false",
      handoffScope: "workflow-overview-embedding",
    },
  },
);
assert.deepEqual(createIniPanelShellWorkflowOverviewEmbeddingDomContract(), {
  apiName: "ini-panel-shell-workflow-overview-embedding-dom-contract",
  contractVersion: 1,
  requiredNodeIds: ["mount", "status", "rows"],
  selectors: {
    mount: "[data-workflow-overview-embedding]",
    status: "[data-workflow-overview-embedding-status]",
    rows: "[data-workflow-overview-embedding-rows]",
  },
  mountDatasetKeys: ["handoffPhase", "handoffReady", "handoffScope"],
  rowDatasetPrefix: "workflowOverviewEmbedding",
  rowDatasetKeys: {
    term: ["workflowOverviewEmbeddingRow", "workflowOverviewEmbeddingStatus"],
    detail: ["workflowOverviewEmbeddingValue", "workflowOverviewEmbeddingStatus"],
  },
  renderResultFields: ["rendered", "statusLine", "rowCount", "rowIds", "dataset"],
});
assert.deepEqual(
  createIniPanelShellWorkflowOverviewEmbeddingDomContract({
    rowDatasetPrefix: "externalEmbedding",
    selectors: {
      mount: "[data-external-embedding]",
      status: "[data-external-embedding-status]",
      rows: "[data-external-embedding-rows]",
    },
  }).rowDatasetKeys.detail,
  ["externalEmbeddingValue", "externalEmbeddingStatus"],
);
assert.deepEqual(
  createIniPanelShellWorkflowOverviewEmbeddingDomReadiness({ documentRef: null }),
  {
    apiName: "ini-panel-shell-workflow-overview-embedding-dom-readiness",
    readinessVersion: 1,
    phase: "blocked",
    ready: false,
    missing: ["document", "mount", "status", "rows"],
    checks: {
      document: false,
      mount: false,
      status: false,
      rows: false,
      rowDatasetPrefix: true,
    },
    contract: createIniPanelShellWorkflowOverviewEmbeddingDomContract(),
  },
);
assert.deepEqual(
  createIniPanelShellWorkflowOverviewEmbeddingDomReadiness({
    documentRef: mountDocument,
    mountNode,
    statusNode: mountStatusNode,
    rowsNode: mountRowsNode,
  }),
  {
    apiName: "ini-panel-shell-workflow-overview-embedding-dom-readiness",
    readinessVersion: 1,
    phase: "ready",
    ready: true,
    missing: [],
    checks: {
      document: true,
      mount: true,
      status: true,
      rows: true,
      rowDatasetPrefix: true,
    },
    contract: createIniPanelShellWorkflowOverviewEmbeddingDomContract(),
  },
);
assert.deepEqual(
  renderIniPanelShellWorkflowOverviewEmbeddingState(
    createIniPanelShellWorkflowOverviewEmbeddingRenderState(
      createIniPanelShellWorkflowOverviewEmbeddingDisplayViewModel(workflowOverviewEmbeddingReport),
    ),
    {
      documentRef: mountDocument,
      mountNode,
      statusNode: mountStatusNode,
      rowsNode: mountRowsNode,
    },
  ),
  {
    rendered: true,
    statusLine: "Blocked: embedding:blocked, mount:blocked",
    rowCount: 6,
    rowIds: [
      "overview-api",
      "missing-methods",
      "embedding-ready",
      "mount-phase",
      "render-row-count",
      "error",
    ],
    dataset: {
      handoffPhase: "blocked",
      handoffReady: "false",
      handoffScope: "workflow-overview-embedding",
    },
  },
);
assert.equal(mountRowsNode.children[0].dataset.workflowOverviewEmbeddingRow, "overview-api");
assert.equal(mountRowsNode.children[1].dataset.workflowOverviewEmbeddingValue, "overview-api");
assert.equal(mountRowsNode.children[1].dataset.workflowOverviewEmbeddingStatus, "blocked");
const workflowOverviewEmbeddingMountResult = mountIniPanelShellWorkflowOverviewEmbeddingState({
  renderState: createIniPanelShellWorkflowOverviewEmbeddingRenderState(
    createIniPanelShellWorkflowOverviewEmbeddingDisplayViewModel(workflowOverviewEmbeddingReport),
  ),
  documentRef: mountDocument,
  mountNode,
  statusNode: mountStatusNode,
  rowsNode: mountRowsNode,
});
assert.equal(workflowOverviewEmbeddingMountResult.apiName, "ini-panel-shell-workflow-overview-embedding-dom-mount");
assert.equal(workflowOverviewEmbeddingMountResult.workflowVersion, 1);
assert.equal(workflowOverviewEmbeddingMountResult.phase, "blocked");
assert.equal(workflowOverviewEmbeddingMountResult.ready, false);
assert.equal(workflowOverviewEmbeddingMountResult.renderResult.rowCount, 6);
assert.equal(
  workflowOverviewEmbeddingMountResult.renderResult.dataset.handoffScope,
  "workflow-overview-embedding",
);
assert.equal(workflowOverviewEmbeddingMountResult.error, null);
assert.deepEqual(
  mountIniPanelShellWorkflowOverviewEmbeddingState({ documentRef: null }).domReadiness.missing,
  ["document", "mount", "status", "rows"],
);
assert.deepEqual(
  createIniPanelShellWorkflowOverviewEmbeddingMountDisplayViewModel(workflowOverviewEmbeddingMountResult),
  {
    phase: "blocked",
    title: "Workflow overview embedding mount",
    statusText: "Blocked",
    detailText: "mount:blocked",
    rows: [
      {
        id: "mount-ready",
        label: "Mount readiness",
        value: "blocked",
      },
      {
        id: "dom-readiness",
        label: "DOM readiness",
        value: "ready",
      },
      {
        id: "missing-dom",
        label: "Missing DOM",
        value: "none",
      },
      {
        id: "render-state",
        label: "Render state",
        value: "Blocked: embedding:blocked, mount:blocked",
      },
      {
        id: "render-result",
        label: "Render result",
        value: "rendered",
      },
      {
        id: "render-row-count",
        label: "Render row count",
        value: "6",
      },
      {
        id: "error",
        label: "Error",
        value: "none",
      },
    ],
  },
);
assert.deepEqual(
  createIniPanelShellWorkflowOverviewEmbeddingMountDisplayViewModel(
    mountIniPanelShellWorkflowOverviewEmbeddingState({ documentRef: null }),
  ).rows[2],
  {
    id: "missing-dom",
    label: "Missing DOM",
    value: "document, mount, status, rows",
  },
);
assert.deepEqual(
  createIniPanelShellWorkflowOverviewEmbeddingMountRenderState(
    createIniPanelShellWorkflowOverviewEmbeddingMountDisplayViewModel(workflowOverviewEmbeddingMountResult),
  ),
  {
    apiName: "ini-panel-shell-workflow-overview-embedding-mount-render-state",
    renderStateVersion: 1,
    phase: "blocked",
    ready: false,
    title: "Workflow overview embedding mount",
    statusText: "Blocked",
    detailText: "mount:blocked",
    statusLine: "Blocked: mount:blocked",
    rows: [
      {
        id: "mount-ready",
        label: "Mount readiness",
        value: "blocked",
      },
      {
        id: "dom-readiness",
        label: "DOM readiness",
        value: "ready",
      },
      {
        id: "missing-dom",
        label: "Missing DOM",
        value: "none",
      },
      {
        id: "render-state",
        label: "Render state",
        value: "Blocked: embedding:blocked, mount:blocked",
      },
      {
        id: "render-result",
        label: "Render result",
        value: "rendered",
      },
      {
        id: "render-row-count",
        label: "Render row count",
        value: "6",
      },
      {
        id: "error",
        label: "Error",
        value: "none",
      },
    ],
    dataset: {
      handoffPhase: "blocked",
      handoffReady: "false",
      handoffScope: "workflow-overview-embedding-mount",
    },
  },
);
assert.deepEqual(createIniPanelShellWorkflowOverviewEmbeddingMountDomContract(), {
  apiName: "ini-panel-shell-workflow-overview-embedding-mount-dom-contract",
  contractVersion: 1,
  requiredNodeIds: ["mount", "status", "rows"],
  selectors: {
    mount: "[data-workflow-overview-embedding-mount]",
    status: "[data-workflow-overview-embedding-mount-status]",
    rows: "[data-workflow-overview-embedding-mount-rows]",
  },
  mountDatasetKeys: ["handoffPhase", "handoffReady", "handoffScope"],
  rowDatasetPrefix: "workflowOverviewEmbeddingMount",
  rowDatasetKeys: {
    term: ["workflowOverviewEmbeddingMountRow", "workflowOverviewEmbeddingMountStatus"],
    detail: ["workflowOverviewEmbeddingMountValue", "workflowOverviewEmbeddingMountStatus"],
  },
  renderResultFields: ["rendered", "statusLine", "rowCount", "rowIds", "dataset"],
});
assert.deepEqual(
  createIniPanelShellWorkflowOverviewEmbeddingMountDomContract({
    rowDatasetPrefix: "externalEmbeddingMount",
    selectors: {
      mount: "[data-external-embedding-mount]",
      status: "[data-external-embedding-mount-status]",
      rows: "[data-external-embedding-mount-rows]",
    },
  }).rowDatasetKeys.detail,
  ["externalEmbeddingMountValue", "externalEmbeddingMountStatus"],
);
assert.deepEqual(
  createIniPanelShellWorkflowOverviewEmbeddingMountDomReadiness({ documentRef: null }),
  {
    apiName: "ini-panel-shell-workflow-overview-embedding-mount-dom-readiness",
    readinessVersion: 1,
    phase: "blocked",
    ready: false,
    missing: ["document", "mount", "status", "rows"],
    checks: {
      document: false,
      mount: false,
      status: false,
      rows: false,
      rowDatasetPrefix: true,
    },
    contract: createIniPanelShellWorkflowOverviewEmbeddingMountDomContract(),
  },
);
assert.deepEqual(
  createIniPanelShellWorkflowOverviewEmbeddingMountDomReadiness({
    documentRef: mountDocument,
    mountNode,
    statusNode: mountStatusNode,
    rowsNode: mountRowsNode,
  }),
  {
    apiName: "ini-panel-shell-workflow-overview-embedding-mount-dom-readiness",
    readinessVersion: 1,
    phase: "ready",
    ready: true,
    missing: [],
    checks: {
      document: true,
      mount: true,
      status: true,
      rows: true,
      rowDatasetPrefix: true,
    },
    contract: createIniPanelShellWorkflowOverviewEmbeddingMountDomContract(),
  },
);
assert.deepEqual(
  renderIniPanelShellWorkflowOverviewEmbeddingMountState(
    createIniPanelShellWorkflowOverviewEmbeddingMountRenderState(
      createIniPanelShellWorkflowOverviewEmbeddingMountDisplayViewModel(workflowOverviewEmbeddingMountResult),
    ),
    {
      documentRef: mountDocument,
      mountNode,
      statusNode: mountStatusNode,
      rowsNode: mountRowsNode,
    },
  ),
  {
    rendered: true,
    statusLine: "Blocked: mount:blocked",
    rowCount: 7,
    rowIds: [
      "mount-ready",
      "dom-readiness",
      "missing-dom",
      "render-state",
      "render-result",
      "render-row-count",
      "error",
    ],
    dataset: {
      handoffPhase: "blocked",
      handoffReady: "false",
      handoffScope: "workflow-overview-embedding-mount",
    },
  },
);
assert.equal(mountRowsNode.children[0].dataset.workflowOverviewEmbeddingMountRow, "mount-ready");
assert.equal(mountRowsNode.children[1].dataset.workflowOverviewEmbeddingMountValue, "mount-ready");
assert.equal(mountRowsNode.children[1].dataset.workflowOverviewEmbeddingMountStatus, "blocked");
const workflowOverviewEmbeddingMountDomMount = mountIniPanelShellWorkflowOverviewEmbeddingMountState({
  renderState: createIniPanelShellWorkflowOverviewEmbeddingMountRenderState(
    createIniPanelShellWorkflowOverviewEmbeddingMountDisplayViewModel(workflowOverviewEmbeddingMountResult),
  ),
  documentRef: mountDocument,
  mountNode,
  statusNode: mountStatusNode,
  rowsNode: mountRowsNode,
});
assert.equal(
  workflowOverviewEmbeddingMountDomMount.apiName,
  "ini-panel-shell-workflow-overview-embedding-mount-dom-mount",
);
assert.equal(workflowOverviewEmbeddingMountDomMount.workflowVersion, 1);
assert.equal(workflowOverviewEmbeddingMountDomMount.phase, "blocked");
assert.equal(workflowOverviewEmbeddingMountDomMount.ready, false);
assert.equal(workflowOverviewEmbeddingMountDomMount.statusLine, "Blocked: mount:blocked");
assert.equal(workflowOverviewEmbeddingMountDomMount.renderResult.rowCount, 7);
assert.equal(
  workflowOverviewEmbeddingMountDomMount.renderResult.dataset.handoffScope,
  "workflow-overview-embedding-mount",
);
assert.equal(workflowOverviewEmbeddingMountDomMount.error, null);
assert.deepEqual(
  mountIniPanelShellWorkflowOverviewEmbeddingMountState({ documentRef: null }),
  {
    apiName: "ini-panel-shell-workflow-overview-embedding-mount-dom-mount",
    workflowVersion: 1,
    phase: "blocked",
    ready: false,
    statusLine: "Blocked: document, mount, status, rows",
    contract: createIniPanelShellWorkflowOverviewEmbeddingMountDomContract(),
    domReadiness: createIniPanelShellWorkflowOverviewEmbeddingMountDomReadiness({ documentRef: null }),
    renderState: createIniPanelShellWorkflowOverviewEmbeddingMountRenderState(),
    renderResult: null,
    error: null,
  },
);
assert.deepEqual(
  mountIniPanelShellWorkflowOverviewEmbedding({ overviewApi: null }).readiness.missing,
  shellViewModel.shellWorkflowOverviewContract.methodNames,
);
assert.deepEqual(
  createIniPanelShellWorkflowOverviewEmbeddingReport(
    mountIniPanelShellWorkflowOverviewEmbedding({ overviewApi: null }),
  ).missingMethods,
  shellViewModel.shellWorkflowOverviewContract.methodNames,
);
assert.equal(
  createIniPanelShellWorkflowOverviewEmbeddingReport(mountIniPanelShellWorkflowOverviewEmbedding({
    overviewApi: {
      ...workflowOverviewApi,
      mountWorkflowOverview: () => {
        throw new Error("mount failed");
      },
    },
  })).error,
  "mount failed",
);
assert.equal(
  mountIniPanelShellSessionHandoffWorkflow({ documentRef: mountDocument }).renderResult,
  null,
);
assert.deepEqual(
  mountIniPanelShellSessionHandoff({ documentRef: mountDocument }).renderResult,
  null,
);
assert.deepEqual(
  mountIniPanelShellSessionHandoff({ documentRef: mountDocument }).domReadiness.missing,
  ["mount", "status", "rows"],
);
const externalContract = createIniPanelShellSessionHandoffMountDomContract({
  rowDatasetPrefix: "externalMount",
  selectors: {
    mount: "[data-external-shell-mount]",
    status: "[data-external-shell-mount-status]",
    rows: "[data-external-shell-mount-rows]",
  },
});
assert.equal(externalContract.rowDatasetKeys.detail[0], "externalMountValue");

assert.deepEqual(controller.render(), { rendered: true });
assert.equal(statusNode.textContent, "run-gcode | ok | -");
assert.equal(renderedView.status.runStatus, "ok");
assert.equal(controller.readStatus().overview.phase, "ran");
assert.equal(controller.loadSessionState().phase, "ready");
assert.equal(controller.refresh().phase, "rendered");

console.log("ini_panel_ui_shell_node_smoke=ok");
