Feat v0.7.1 surface runner framework (#55)
All checks were successful
CI/CD / detect-changes (push) Successful in 3s
CI/CD / test-frontend (push) Successful in 6s
CI/CD / test-go-pg (push) Successful in 2m51s
CI/CD / test-sqlite (push) Successful in 3m2s
CI/CD / build-and-deploy (push) Successful in 1m26s

Co-authored-by: Jeffrey Smith <jasafpro@gmail.com>
Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #55.
This commit is contained in:
2026-04-01 23:01:38 +00:00
committed by xcaliber
parent e916ed41ea
commit 829caa3b20
59 changed files with 2509 additions and 6525 deletions

View File

@@ -1,40 +1,13 @@
/**
* ICD Test Runner — Framework
* DOM helpers, assertion library, ICD shapes, API wrappers, test harness.
* Assertion library, ICD shapes, API wrappers, token capture.
* (DOM helpers and test harness removed — runner now uses sw.testing)
*/
(function () {
'use strict';
var T = window.ICD;
if (!T) return;
// ─── DOM Helpers ────────────────────────────────────────────
T.esc = function (s) {
var el = document.createElement('span');
el.textContent = String(s);
return el.innerHTML;
};
T.$ = function (tag, attrs, children) {
var el = document.createElement(tag);
if (attrs) Object.keys(attrs).forEach(function (k) {
if (k === 'className') el.className = attrs[k];
else if (k === 'style' && typeof attrs[k] === 'object')
Object.assign(el.style, attrs[k]);
else if (k.indexOf('on') === 0)
el.addEventListener(k.slice(2).toLowerCase(), attrs[k]);
else el.setAttribute(k, attrs[k]);
});
if (children) {
if (!Array.isArray(children)) children = [children];
children.forEach(function (c) {
if (typeof c === 'string') el.appendChild(document.createTextNode(c));
else if (c) el.appendChild(c);
});
}
return el;
};
// ─── Assertion Library ──────────────────────────────────────
function assertType(val, type, path) {
@@ -126,49 +99,11 @@
var S = T.S;
S.channel = { id: 'string', title: 'string', type: 'string', created_at: 'string', updated_at: 'string' };
S.channelFull = {
id: 'string', user_id: 'string', title: 'string', type: 'string',
ai_mode: 'string?', topic: 'string?',
description: 'string?', model: 'string?', provider_config_id: 'string?',
system_prompt: 'string?', is_archived: 'bool', is_pinned: 'bool',
folder: 'string?', folder_id: 'string?', project_id: 'string?', workspace_id: 'string?',
tags: 'array', created_at: 'string', updated_at: 'string'
};
S.channelModel = { id: 'string', channel_id: 'string', model_id: 'string', is_default: 'bool', created_at: 'string' };
S.message = { id: 'string', channel_id: 'string', role: 'string', content: 'string', created_at: 'string' };
S.persona = { id: 'string', name: 'string', scope: 'string', created_at: 'string', updated_at: 'string' };
S.note = { id: 'string', title: 'string', created_at: 'string', updated_at: 'string' };
S.project = {
id: 'string', name: 'string', scope: 'string', owner_id: 'string',
is_archived: 'bool', created_at: 'string', updated_at: 'string',
description: 'string?', color: 'string?', icon: 'string?',
team_id: 'string?', workspace_id: 'string?', settings: 'object?',
channel_count: 'number?', kb_count: 'number?', note_count: 'number?'
};
S.kb = {
id: 'string', name: 'string', scope: 'string',
embedding_config: 'object', document_count: 'number',
chunk_count: 'number', total_bytes: 'number', status: 'string',
created_at: 'string', updated_at: 'string'
};
S.folder = { id: 'string', name: 'string', created_at: 'string' };
S.workspace = { id: 'string', name: 'string', owner_type: 'string', owner_id: 'string', status: 'string', created_at: 'string', updated_at: 'string' };
S.gitCredSummary = { id: 'string', name: 'string', auth_type: 'string', created_at: 'string' };
S.notification = { id: 'string', type: 'string', title: 'string', read: 'bool', created_at: 'string' };
S.memory = { id: 'string', scope: 'string', owner_id: 'string', key: 'string', value: 'string', confidence: 'number', status: 'string', created_at: 'string', updated_at: 'string' };
S.profile = { id: 'string', username: 'string', email: 'string', role: 'string', settings: 'object', created_at: 'string' };
S.profile = { id: 'string', username: 'string', email: 'string', role: 'string?', settings: 'object', created_at: 'string' };
S.surface = { id: 'string', title: 'string', source: 'string', enabled: 'bool' };
S.surfaceNav = { id: 'string', title: 'string', route: 'string' };
S.surfaceAdmin = { id: 'string', title: 'string', manifest: 'object', enabled: 'bool', source: 'string', installed_at: 'string', updated_at: 'string' };
S.providerConfig = { id: 'string', name: 'string', provider: 'string', scope: 'string' };
S.safeConfig = { id: 'string', name: 'string', provider: 'string', is_active: 'bool', has_key: 'bool' };
S.catalogModel = { model_id: 'string', provider: 'string' };
S.modelEnabled = { id: 'string', model_id: 'string', display_name: 'string', model_type: 'string', source: 'string', provider_config_id: 'string', provider_name: 'string', provider_type: 'string', capabilities: 'object', scope: 'string', is_persona: 'bool', hidden: 'bool' };
S.modelPreference = { id: 'string', user_id: 'string', model_id: 'string', provider_config_id: 'string', hidden: 'bool', sort_order: 'number', created_at: 'string', updated_at: 'string' };
S.task = { id: 'string', name: 'string', task_type: 'string', schedule: 'string', is_active: 'bool', created_at: 'string' };
S.taskFull = { id: 'string', owner_id: 'string', name: 'string', task_type: 'string', scope: 'string', schedule: 'string', timezone: 'string', is_active: 'bool', max_tokens: 'number', max_tool_calls: 'number', max_wall_clock: 'number', output_mode: 'string', run_count: 'number', created_at: 'string', updated_at: 'string' };
S.taskRun = { id: 'string', task_id: 'string', status: 'string', started_at: 'string' };
S.workflow = { id: 'string', name: 'string', slug: 'string', entry_mode: 'string', is_active: 'bool', created_at: 'string', updated_at: 'string' };
S.workflowStage = { id: 'string', workflow_id: 'string', ordinal: 'number', name: 'string', history_mode: 'string', created_at: 'string', surface_pkg_id: 'string?' };
S.workflowVersion = { id: 'string', workflow_id: 'string', version_number: 'number', created_at: 'string' };
@@ -179,53 +114,9 @@
S.group = { id: 'string', name: 'string' };
S.extension = { id: 'string', title: 'string', type: 'string', version: 'string', tier: 'string', enabled: 'bool', is_system: 'bool', scope: 'string', source: 'string', installed_at: 'string', updated_at: 'string' };
S.auditEntry = { id: 'string', action: 'string', created_at: 'string' };
S.file = { id: 'string', filename: 'string', content_type: 'string', origin: 'string', created_at: 'string' };
S.participant = { id: 'string', channel_id: 'string', participant_type: 'string', role: 'string', joined_at: 'string' };
S.adminUser = { id: 'string', username: 'string', role: 'string', created_at: 'string' };
S.loginResponse = { access_token: 'string', refresh_token: 'string' };
// ─── Test Harness ───────────────────────────────────────────
T.registerCleanup = function (fn) { T.cleanup.push(fn); };
T.runCleanup = async function () {
for (var i = T.cleanup.length - 1; i >= 0; i--) {
try { await T.cleanup[i](); } catch (e) { /* best effort */ }
}
T.cleanup = [];
};
T.test = async function (tier, domain, name, fn) {
var t0 = performance.now();
var entry = { tier: tier, domain: domain, name: name, status: 'pass', duration: 0, detail: '' };
try {
await fn();
} catch (e) {
if (e && e._skip) {
entry.status = 'skip';
entry.detail = String(e.message || 'skipped');
} else {
entry.status = 'fail';
entry.detail = String(e && e.message ? e.message : e);
}
}
entry.duration = Math.round(performance.now() - t0);
T.results.push(entry);
if (typeof T.renderProgress === 'function') T.renderProgress();
return entry;
};
/**
* Skip a test with a reason. Call inside a T.test() fn body.
* Skipped tests appear in results as status='skip' — not pass, not fail.
* @param {string} reason — why this test was skipped
*/
T.skip = function (reason) {
var e = new Error(reason || 'skipped');
e._skip = true;
throw e;
};
// ─── API Wrappers ───────────────────────────────────────────
// Raw fetch — kernel provides no global API wrappers; extensions use fetch directly.
@@ -263,7 +154,6 @@
T.captureAuthToken = async function () {
if (_capturedToken) return _capturedToken;
// v0.37.14: read directly from localStorage (old API._get interceptor removed)
_capturedToken = getAuthTokenFromStorage();
return _capturedToken;
};
@@ -403,4 +293,5 @@
return data;
};
})();