v0.7.1 Surface Runner Framework
All checks were successful
CI/CD / detect-changes (pull_request) Successful in 23s
CI/CD / test-frontend (pull_request) Successful in 26s
CI/CD / test-go-pg (pull_request) Successful in 2m35s
CI/CD / test-sqlite (pull_request) Successful in 3m19s
CI/CD / build-and-deploy (pull_request) Successful in 1m46s
All checks were successful
CI/CD / detect-changes (pull_request) Successful in 23s
CI/CD / test-frontend (pull_request) Successful in 26s
CI/CD / test-go-pg (pull_request) Successful in 2m35s
CI/CD / test-sqlite (pull_request) Successful in 3m19s
CI/CD / build-and-deploy (pull_request) Successful in 1m46s
sw.testing SDK module — structured test framework for surface runners: - suite/test registration, lifecycle hooks (beforeAll/afterAll/beforeEach/afterEach) - Assertion library (ok/eq/neq/gt/match/throws/status/shape/arrayOf) - Auto-cleanup via track(type, id) with LIFO deletion - Three result statuses: passed/failed/warned - Structured JSON results with timing, warnings, cleanup stats test-runner manifest type: - ValidateManifest accepts "test-runner" packages - Excluded from sidebar nav (extensionNavItems filters surface/full only) - DB migrations: SQLite 013, Postgres 014 (CHECK constraint) ICD runner migration (kernel-only): - Migrated from T.test()/T.assert() to sw.testing.suite() - Stripped extension-dependent tests (channels, notes, personas, etc.) - Kernel suites: smoke, crud, authz, security, providers, packaging, sdk - Deleted ui.js + css (rendering delegated to registry surface) SDK runner migration (kernel-only): - Migrated from T.dualTest()/T.domains to sw.testing.suite() - Stripped extension domains (belong in v0.7.2 package runners) - Kernel suites: misc, workflows, admin, packages, connections, deps, composition Runner registry surface (/s/test-runners): - Admin-only dashboard discovering test-runner packages - Run All / per-runner Run buttons, real-time results - Export Failures / Export Full Results (JSON download) - Dark mode styling using kernel CSS variables - Suite count polling for async runner script loading 141 passed, 0 failed on fresh minimal install. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -8,86 +8,120 @@
|
||||
var T = window.SDKR;
|
||||
if (!T) return;
|
||||
|
||||
T.registerDomain('workflows', async function () {
|
||||
sw.testing.suite('sdk/workflows', async function (s) {
|
||||
var tag = 'sdkr-' + Date.now();
|
||||
var wfId = null;
|
||||
|
||||
// ── List ──
|
||||
|
||||
await T.test('workflows', 'list', 'sw.api.workflows.list() returns array', {
|
||||
sdk: function () { return sw.api.workflows.list(); },
|
||||
raw: { method: 'GET', path: '/workflows' },
|
||||
validate: function (r) { var arr = T.unwrapList(r); T.assert(arr.length >= 0, 'expected list'); }
|
||||
s.test('list: sw.api.workflows.list() returns array', async function (t) {
|
||||
var result = await T.dualTest(
|
||||
function () { return sw.api.workflows.list(); },
|
||||
{ method: 'GET', path: '/workflows' },
|
||||
function (r) { var arr = T.unwrapList(r); T.assert(arr.length >= 0, 'expected list'); }
|
||||
);
|
||||
if (result.verdict === 'PASS') return;
|
||||
if (result.verdict === 'SDK_BUG') t.assert.ok(false, 'SDK_BUG: ' + result.sdkErr);
|
||||
if (result.verdict === 'ICD_BUG') t.assert.ok(false, 'ICD_BUG: ' + result.rawErr);
|
||||
if (result.verdict === 'SHAPE_BUG') t.warn('SHAPE_BUG: ' + result.sdkErr);
|
||||
});
|
||||
|
||||
// ── Create ──
|
||||
|
||||
await T.test('workflows', 'crud', 'sw.api.workflows.create()', {
|
||||
sdk: function () {
|
||||
return sw.api.workflows.create({
|
||||
s.test('crud: sw.api.workflows.create()', async function (t) {
|
||||
var result = await T.dualTest(
|
||||
function () {
|
||||
return sw.api.workflows.create({
|
||||
name: tag + '-wf', slug: tag + '-wf',
|
||||
entry_mode: 'team_only', scope: 'personal'
|
||||
});
|
||||
},
|
||||
{ method: 'POST', path: '/workflows', body: {
|
||||
name: tag + '-wf', slug: tag + '-wf',
|
||||
entry_mode: 'team_only', scope: 'personal'
|
||||
});
|
||||
},
|
||||
raw: { method: 'POST', path: '/workflows', body: {
|
||||
name: tag + '-wf', slug: tag + '-wf',
|
||||
entry_mode: 'team_only', scope: 'personal'
|
||||
}},
|
||||
validate: function (r) {
|
||||
T.assertShape(r, T.S.workflow, 'workflow');
|
||||
wfId = r.id;
|
||||
T.registerCleanup(function () { if (wfId) return T.safeDelete('/workflows/' + wfId); });
|
||||
}
|
||||
}},
|
||||
function (r) {
|
||||
T.assertShape(r, T.S.workflow, 'workflow');
|
||||
wfId = r.id;
|
||||
T.registerCleanup(function () { if (wfId) return T.safeDelete('/workflows/' + wfId); });
|
||||
}
|
||||
);
|
||||
if (result.verdict === 'PASS') return;
|
||||
if (result.verdict === 'SDK_BUG') t.assert.ok(false, 'SDK_BUG: ' + result.sdkErr);
|
||||
if (result.verdict === 'ICD_BUG') t.assert.ok(false, 'ICD_BUG: ' + result.rawErr);
|
||||
if (result.verdict === 'SHAPE_BUG') t.warn('SHAPE_BUG: ' + result.sdkErr);
|
||||
});
|
||||
|
||||
if (!wfId) return;
|
||||
|
||||
// ── Get ──
|
||||
|
||||
await T.test('workflows', 'crud', 'sw.api.workflows.get(id)', {
|
||||
sdk: function () { return sw.api.workflows.get(wfId); },
|
||||
raw: { method: 'GET', path: '/workflows/' + wfId },
|
||||
validate: function (r) {
|
||||
T.assertShape(r, T.S.workflow, 'workflow');
|
||||
T.assert(r.id === wfId, 'id mismatch');
|
||||
}
|
||||
s.test('crud: sw.api.workflows.get(id)', async function (t) {
|
||||
var result = await T.dualTest(
|
||||
function () { return sw.api.workflows.get(wfId); },
|
||||
{ method: 'GET', path: '/workflows/' + wfId },
|
||||
function (r) {
|
||||
T.assertShape(r, T.S.workflow, 'workflow');
|
||||
T.assert(r.id === wfId, 'id mismatch');
|
||||
}
|
||||
);
|
||||
if (result.verdict === 'PASS') return;
|
||||
if (result.verdict === 'SDK_BUG') t.assert.ok(false, 'SDK_BUG: ' + result.sdkErr);
|
||||
if (result.verdict === 'ICD_BUG') t.assert.ok(false, 'ICD_BUG: ' + result.rawErr);
|
||||
if (result.verdict === 'SHAPE_BUG') t.warn('SHAPE_BUG: ' + result.sdkErr);
|
||||
});
|
||||
|
||||
// ── Update (KNOWN BUG: SDK uses PUT, backend expects PATCH) ──
|
||||
|
||||
await T.test('workflows', 'crud', 'sw.api.workflows.update(id, data)', {
|
||||
sdk: function () {
|
||||
return sw.api.workflows.update(wfId, { name: tag + '-wf-updated' });
|
||||
},
|
||||
raw: { method: 'PATCH', path: '/workflows/' + wfId,
|
||||
body: { name: tag + '-wf-updated' } },
|
||||
validate: function (r) {
|
||||
T.assertShape(r, T.S.workflow, 'workflow');
|
||||
T.assert(r.name === tag + '-wf-updated', 'name not updated');
|
||||
}
|
||||
s.test('crud: sw.api.workflows.update(id, data)', async function (t) {
|
||||
var result = await T.dualTest(
|
||||
function () {
|
||||
return sw.api.workflows.update(wfId, { name: tag + '-wf-updated' });
|
||||
},
|
||||
{ method: 'PATCH', path: '/workflows/' + wfId,
|
||||
body: { name: tag + '-wf-updated' } },
|
||||
function (r) {
|
||||
T.assertShape(r, T.S.workflow, 'workflow');
|
||||
T.assert(r.name === tag + '-wf-updated', 'name not updated');
|
||||
}
|
||||
);
|
||||
if (result.verdict === 'PASS') return;
|
||||
if (result.verdict === 'SDK_BUG') t.assert.ok(false, 'SDK_BUG: ' + result.sdkErr);
|
||||
if (result.verdict === 'ICD_BUG') t.assert.ok(false, 'ICD_BUG: ' + result.rawErr);
|
||||
if (result.verdict === 'SHAPE_BUG') t.warn('SHAPE_BUG: ' + result.sdkErr);
|
||||
});
|
||||
|
||||
// ── Stages ──
|
||||
|
||||
var stageId = null;
|
||||
|
||||
// stages.list via SDK (if wired) vs raw
|
||||
await T.test('workflows', 'stages', 'GET /workflows/:id/stages (raw — SDK may not have this)', {
|
||||
sdk: function () {
|
||||
// SDK may or may not expose stages — test raw path
|
||||
if (sw.api.workflows.stages) return sw.api.workflows.stages(wfId);
|
||||
throw new Error('sw.api.workflows.stages not defined');
|
||||
},
|
||||
raw: { method: 'GET', path: '/workflows/' + wfId + '/stages' },
|
||||
validate: function (r) { var arr = T.unwrapList(r); T.assert(arr.length >= 0, 'expected list'); }
|
||||
s.test('stages: GET /workflows/:id/stages (raw — SDK may not have this)', async function (t) {
|
||||
var result = await T.dualTest(
|
||||
function () {
|
||||
// SDK may or may not expose stages — test raw path
|
||||
if (sw.api.workflows.stages) return sw.api.workflows.stages(wfId);
|
||||
throw new Error('sw.api.workflows.stages not defined');
|
||||
},
|
||||
{ method: 'GET', path: '/workflows/' + wfId + '/stages' },
|
||||
function (r) { var arr = T.unwrapList(r); T.assert(arr.length >= 0, 'expected list'); }
|
||||
);
|
||||
if (result.verdict === 'PASS') return;
|
||||
if (result.verdict === 'SDK_BUG') t.assert.ok(false, 'SDK_BUG: ' + result.sdkErr);
|
||||
if (result.verdict === 'ICD_BUG') t.assert.ok(false, 'ICD_BUG: ' + result.rawErr);
|
||||
if (result.verdict === 'SHAPE_BUG') t.warn('SHAPE_BUG: ' + result.sdkErr);
|
||||
});
|
||||
|
||||
// ── Delete ──
|
||||
|
||||
await T.test('workflows', 'crud', 'sw.api.workflows.del(id)', {
|
||||
sdk: function () { return sw.api.workflows.del(wfId); },
|
||||
raw: { method: 'DELETE', path: '/workflows/' + wfId },
|
||||
validate: function () { wfId = null; }
|
||||
s.test('crud: sw.api.workflows.del(id)', async function (t) {
|
||||
var result = await T.dualTest(
|
||||
function () { return sw.api.workflows.del(wfId); },
|
||||
{ method: 'DELETE', path: '/workflows/' + wfId },
|
||||
function () { wfId = null; }
|
||||
);
|
||||
if (result.verdict === 'PASS') return;
|
||||
if (result.verdict === 'SDK_BUG') t.assert.ok(false, 'SDK_BUG: ' + result.sdkErr);
|
||||
if (result.verdict === 'ICD_BUG') t.assert.ok(false, 'ICD_BUG: ' + result.rawErr);
|
||||
if (result.verdict === 'SHAPE_BUG') t.warn('SHAPE_BUG: ' + result.sdkErr);
|
||||
});
|
||||
});
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user