@volter/twin-standard 1.0.60 → 1.0.61
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/clients/run.js +3 -1
- package/dist/src/conformance.js +6 -6
- package/package.json +2 -2
- package/src/clients/run.ts +3 -1
- package/src/conformance.ts +6 -6
package/dist/src/clients/run.js
CHANGED
|
@@ -11,9 +11,11 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
|
|
|
11
11
|
// one JSON line, `{ id, asks, failures }`.
|
|
12
12
|
import { readFileSync } from 'node:fs';
|
|
13
13
|
import { createRequire } from 'node:module';
|
|
14
|
+
import { extname } from 'node:path';
|
|
15
|
+
import { fileURLToPath } from 'node:url';
|
|
14
16
|
import { clientContext, worldProxy } from "./harness.js";
|
|
15
17
|
const job = JSON.parse(readFileSync(process.argv[2], 'utf8'));
|
|
16
|
-
const { cases } = (await import(__rewriteRelativeImportExtension(`./${job.vendor}.
|
|
18
|
+
const { cases } = (await import(__rewriteRelativeImportExtension(`./${job.vendor}${extname(fileURLToPath(import.meta.url))}`)));
|
|
17
19
|
// every connection a case makes goes through the World's proxy, as an application's does in a World
|
|
18
20
|
const proxy = await worldProxy(job.port);
|
|
19
21
|
// Bind only this artifact's declared vendor hosts to the assessed server. The enclosing World's
|
package/dist/src/conformance.js
CHANGED
|
@@ -23,9 +23,8 @@ import { existsSync, mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSy
|
|
|
23
23
|
import { createRequire } from 'node:module';
|
|
24
24
|
import { connect } from 'node:net';
|
|
25
25
|
import { tmpdir } from 'node:os';
|
|
26
|
-
import { basename, dirname, join, matchesGlob, relative, resolve } from 'node:path';
|
|
26
|
+
import { basename, dirname, extname, join, matchesGlob, relative, resolve } from 'node:path';
|
|
27
27
|
import { citations, sourceHeld } from "./check-sources.js";
|
|
28
|
-
import { standardPackageFile } from "./package-file.js";
|
|
29
28
|
import { fileURLToPath } from 'node:url';
|
|
30
29
|
const pascal = (s) => s.split(/[^a-zA-Z0-9]+/).filter(Boolean).map((w) => w[0].toUpperCase() + w.slice(1)).join('');
|
|
31
30
|
const readJson = (p) => (existsSync(p) ? JSON.parse(readFileSync(p, 'utf8')) : undefined);
|
|
@@ -413,8 +412,9 @@ async function lifeServed(pack) {
|
|
|
413
412
|
* descriptor's clientCasesNone says why none is owed. */
|
|
414
413
|
async function clientCases(pack, scratch) {
|
|
415
414
|
const vendor = (await manifestOf(pack)).vendor ?? basename(pack);
|
|
416
|
-
const clients = join(dirname(fileURLToPath(
|
|
417
|
-
|
|
415
|
+
const clients = join(dirname(fileURLToPath(import.meta.url)), 'clients');
|
|
416
|
+
const extension = extname(fileURLToPath(import.meta.url));
|
|
417
|
+
if (!existsSync(join(clients, `${vendor}${extension}`))) {
|
|
418
418
|
// a vendor whose descriptor names npm clients (adoption.sdks) is held to them: no case is no proof the SDK works,
|
|
419
419
|
// unless the descriptor says why none is owed (clientCasesNone: no official SDK, or none the demand's applications
|
|
420
420
|
// use); one an application calls with no SDK of the vendor's (a raw HTTP catalog) has no client to drive
|
|
@@ -461,13 +461,13 @@ async function clientCases(pack, scratch) {
|
|
|
461
461
|
writeFileSync(job, JSON.stringify({ vendor, port: server.port, host, env: issued, scenarioPath, packFacts: join(pack, 'generated', 'pack-facts.json') }));
|
|
462
462
|
// Node, as an application runs its SDK (asynchronous: this process serves the pack meanwhile)
|
|
463
463
|
const out = await new Promise((resolve) => {
|
|
464
|
-
const child = spawn('node', ['--experimental-strip-types', '--no-warnings', join(clients,
|
|
464
|
+
const child = spawn('node', ['--experimental-strip-types', '--no-warnings', join(clients, `run${extension}`), job], { stdio: ['ignore', 'pipe', 'pipe'] });
|
|
465
465
|
let text = '';
|
|
466
466
|
let errors = '';
|
|
467
467
|
child.stdout.on('data', (d) => { text += d; });
|
|
468
468
|
child.stderr.on('data', (d) => { errors += d; });
|
|
469
469
|
const timer = setTimeout(() => child.kill(), 300_000);
|
|
470
|
-
child.on('close', (code) => { clearTimeout(timer); resolve(code === 0 ? text : `${text}\n${JSON.stringify({ id: 'runner', asks: 'the cases run', failures: [`node exited ${code}: ${errors.trim().split('\n').slice(
|
|
470
|
+
child.on('close', (code) => { clearTimeout(timer); resolve(code === 0 ? text : `${text}\n${JSON.stringify({ id: 'runner', asks: 'the cases run', failures: [`node exited ${code}: ${errors.trim().split('\n').slice(0, 12).join(' ')}`] })}`); });
|
|
471
471
|
});
|
|
472
472
|
const results = out.split('\n').filter((l) => l.startsWith('{')).map((l) => JSON.parse(l));
|
|
473
473
|
return { failures: results.flatMap((r) => r.failures.map((f) => `${r.id} (${r.asks}): ${f}`)), note: `${results.length} case(s) through the vendor's client` };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/twin-standard",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.61",
|
|
4
4
|
"description": "The Protocol 3 standard for Volter twin packs: the criteria a pack is graded by, the grader, the gate a pack repository and the twin catalog run on every change and submission, and the spec derivation the grade checks against. Pin a version: every place a pack is judged judges by that standard.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"twin",
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
"yaml": "2.9.0"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
|
-
"@volter/world-core": "3.0.
|
|
78
|
+
"@volter/world-core": "3.0.69",
|
|
79
79
|
"@volter/world-runtime": "*",
|
|
80
80
|
"playwright": "^1.63.0"
|
|
81
81
|
},
|
package/src/clients/run.ts
CHANGED
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
// one JSON line, `{ id, asks, failures }`.
|
|
4
4
|
import { readFileSync } from 'node:fs';
|
|
5
5
|
import { createRequire } from 'node:module';
|
|
6
|
+
import { extname } from 'node:path';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
6
8
|
import { clientContext, worldProxy, type ClientCase } from './harness.ts';
|
|
7
9
|
|
|
8
10
|
const job = JSON.parse(readFileSync(process.argv[2]!, 'utf8')) as { vendor: string; port: number; host: string; env: Record<string, string>; scenarioPath: string; packFacts: string };
|
|
9
|
-
const { cases } = (await import(`./${job.vendor}.
|
|
11
|
+
const { cases } = (await import(`./${job.vendor}${extname(fileURLToPath(import.meta.url))}`)) as { cases: ClientCase[] };
|
|
10
12
|
// every connection a case makes goes through the World's proxy, as an application's does in a World
|
|
11
13
|
const proxy = await worldProxy(job.port);
|
|
12
14
|
// Bind only this artifact's declared vendor hosts to the assessed server. The enclosing World's
|
package/src/conformance.ts
CHANGED
|
@@ -15,10 +15,9 @@ import { existsSync, mkdtempSync, readdirSync, readFileSync, rmSync, writeFileSy
|
|
|
15
15
|
import { createRequire } from 'node:module';
|
|
16
16
|
import { connect } from 'node:net';
|
|
17
17
|
import { tmpdir } from 'node:os';
|
|
18
|
-
import { basename, dirname, join, matchesGlob, relative, resolve } from 'node:path';
|
|
18
|
+
import { basename, dirname, extname, join, matchesGlob, relative, resolve } from 'node:path';
|
|
19
19
|
import type { TwinStream } from '@volter/world-core';
|
|
20
20
|
import { citations, sourceHeld, type SourceRecord } from './check-sources.ts';
|
|
21
|
-
import { standardPackageFile } from './package-file.ts';
|
|
22
21
|
import { fileURLToPath } from 'node:url';
|
|
23
22
|
|
|
24
23
|
export type ConformanceResult = { id: string; asks: string; failures: string[]; note?: string };
|
|
@@ -366,8 +365,9 @@ async function lifeServed(pack: string): Promise<string[]> {
|
|
|
366
365
|
* descriptor's clientCasesNone says why none is owed. */
|
|
367
366
|
async function clientCases(pack: string, scratch: string): Promise<{ failures: string[]; note?: string }> {
|
|
368
367
|
const vendor = (await manifestOf(pack)).vendor ?? basename(pack);
|
|
369
|
-
const clients = join(dirname(fileURLToPath(
|
|
370
|
-
|
|
368
|
+
const clients = join(dirname(fileURLToPath(import.meta.url)), 'clients');
|
|
369
|
+
const extension = extname(fileURLToPath(import.meta.url));
|
|
370
|
+
if (!existsSync(join(clients, `${vendor}${extension}`))) {
|
|
371
371
|
// a vendor whose descriptor names npm clients (adoption.sdks) is held to them: no case is no proof the SDK works,
|
|
372
372
|
// unless the descriptor says why none is owed (clientCasesNone: no official SDK, or none the demand's applications
|
|
373
373
|
// use); one an application calls with no SDK of the vendor's (a raw HTTP catalog) has no client to drive
|
|
@@ -402,13 +402,13 @@ async function clientCases(pack: string, scratch: string): Promise<{ failures: s
|
|
|
402
402
|
writeFileSync(job, JSON.stringify({ vendor, port: server.port, host, env: issued, scenarioPath, packFacts: join(pack, 'generated', 'pack-facts.json') }));
|
|
403
403
|
// Node, as an application runs its SDK (asynchronous: this process serves the pack meanwhile)
|
|
404
404
|
const out = await new Promise<string>((resolve) => {
|
|
405
|
-
const child = spawn('node', ['--experimental-strip-types', '--no-warnings', join(clients,
|
|
405
|
+
const child = spawn('node', ['--experimental-strip-types', '--no-warnings', join(clients, `run${extension}`), job], { stdio: ['ignore', 'pipe', 'pipe'] });
|
|
406
406
|
let text = '';
|
|
407
407
|
let errors = '';
|
|
408
408
|
child.stdout.on('data', (d: Buffer) => { text += d; });
|
|
409
409
|
child.stderr.on('data', (d: Buffer) => { errors += d; });
|
|
410
410
|
const timer = setTimeout(() => child.kill(), 300_000);
|
|
411
|
-
child.on('close', (code) => { clearTimeout(timer); resolve(code === 0 ? text : `${text}\n${JSON.stringify({ id: 'runner', asks: 'the cases run', failures: [`node exited ${code}: ${errors.trim().split('\n').slice(
|
|
411
|
+
child.on('close', (code) => { clearTimeout(timer); resolve(code === 0 ? text : `${text}\n${JSON.stringify({ id: 'runner', asks: 'the cases run', failures: [`node exited ${code}: ${errors.trim().split('\n').slice(0, 12).join(' ')}`] })}`); });
|
|
412
412
|
});
|
|
413
413
|
const results = out.split('\n').filter((l) => l.startsWith('{')).map((l) => JSON.parse(l) as { id: string; asks: string; failures: string[] });
|
|
414
414
|
return { failures: results.flatMap((r) => r.failures.map((f) => `${r.id} (${r.asks}): ${f}`)), note: `${results.length} case(s) through the vendor's client` };
|