Skip to content

Validation Scripts

Doug Fennell edited this page Sep 29, 2025 · 1 revision

Validation Scripts

This page provides scripts and one-liners that validate the RDCP data layer end-to-end without relying on the Admin UI. Use these to prove the client SDK ↔ RDCP server ↔ headless builder pipeline.

Links: Quick Start Guide β€’ Architecture Overview β€’ Troubleshooting β€’ Demo Scenarios

1) Headless data validator (client + admin-ui)

Script path:

  • scripts/validate-admin-data.mjs

Run:

RDCP_API_KEY='dev-key-change-in-production-min-32-chars' \
node --enable-source-maps scripts/validate-admin-data.mjs

What it does:

  • Imports @rdcp.dev/client, @rdcp.dev/core, and @rdcp.dev/admin-ui
  • Calls discovery and status on the RDCP server (default http://localhost:3000)
  • Generates AdminUISpec from discovery
  • Prints both JSON blobs

Expected output (abridged):

--- AdminUISpec ---
{
  "groups": [
    { "id": "default", "label": "Controls", "widgets": [
      { "type": "ToggleGroup", "categories": ["DATABASE","API_ROUTES", ...] },
      { "type": "StatusPanel" },
      { "type": "SubmitBar" }
    ]}
  ]
}
--- Discovery+Status ---
{
  "discovery": { "protocol": "rdcp/1.0", ... },
  "status":    { "protocol": "rdcp/1.0", ... }
}

Interpretation:

  • AdminUISpec present with at least one group β†’ headless builder OK
  • discovery.protocol and status.protocol == "rdcp/1.0" β†’ RDCP server OK
  • categories listed under discovery and status.categories show feature toggles

2) Package import verification

Verifies that ES module imports resolve properly at runtime.

node --input-type=module -e "import('@rdcp.dev/client').then(m=>console.log('client ok', Object.keys(m))).catch(console.error)"
node --input-type=module -e "import('@rdcp.dev/core').then(m=>console.log('core ok', Object.keys(m))).catch(console.error)"
node --input-type=module -e "import('@rdcp.dev/admin-ui').then(m=>console.log('admin-ui ok', Object.keys(m))).catch(console.error)"

Expected output (abridged):

client ok [ 'RDCPClientError', 'createRDCPClient' ]
core ok   [ 'PROTOCOL_VERSION', 'RDCP_HEADERS', 'RDCP_PATHS', ... ]
admin-ui ok [ 'createAdminUISpec' ]

3) JSON endpoints (via Admin App)

After starting the Admin App (port 3100):

curl -s http://localhost:3100/admin/spec | jq 'keys'
# β†’ ["groups"]

curl -s http://localhost:3100/admin/json | jq '{
  hasDiscovery: has("discovery"), hasStatus: has("status"),
  discoveryProtocol: .discovery.protocol, statusProtocol: .status.protocol
}'
# β†’ { hasDiscovery: true, hasStatus: true, discoveryProtocol: "rdcp/1.0", statusProtocol: "rdcp/1.0" }

What this validates:

  • /admin/spec β†’ headless builder pipeline exposed over HTTP
  • /admin/json β†’ client SDK aggregation of discovery + status

4) Interpreting JSON responses

  • discovery
    • protocol must be rdcp/1.0
    • categories[] enumerate controllable debug areas and metadata
  • status
    • protocol must be rdcp/1.0
    • categories{} shows current on/off for each debug category
  • AdminUISpec
    • groups[].widgets[] drive UI composition; ToggleGroup + StatusPanel + SubmitBar indicate basic control workflow is enabled
Clone this wiki locally