@serene-pub/conformance 0.6.0-pr-6 → 0.6.0-pr-8

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.
Files changed (2) hide show
  1. package/dist/index.js +54 -17
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -34,6 +34,7 @@ import { hookCtxGrants, hookCtxKeysFor, HOOK_CTX_KINDS } from '@serene-pub/sdk/t
34
34
  import { COMPONENT_PROTOCOL_FIXTURE, componentMountCase, componentParityCase, componentParitySections, componentProtocolCase, judgeComponentModule, } from './components.js';
35
35
  import { probeSampleFor } from './packages.js';
36
36
  import { swapFitFinding } from '@serene-pub/sdk';
37
+ import { declaredNodeParams } from '@serene-pub/sdk';
37
38
  import { rulesetCatalogueFindings } from '@serene-pub/sdk';
38
39
  import { probeBinding, probeCtxFor } from '@serene-pub/sdk/testing';
39
40
  export * from './components.js';
@@ -962,8 +963,9 @@ export const REQUIREMENTS = [
962
963
  `grant nobody decided`);
963
964
  for (const [kind, storage, fetch] of table) {
964
965
  const g = hookCtxGrants(kind);
965
- must(g.storage === storage && g.fetch === fetch, `the grant table hands a '${kind}' hook ${JSON.stringify(g)}; the law is ` +
966
- `{ storage: ${storage}, fetch: ${fetch} }`);
966
+ // `package` (M2a) is granted exactly where `storage` is.
967
+ must(g.storage === storage && g.package === storage && g.fetch === fetch, `the grant table hands a '${kind}' hook ${JSON.stringify(g)}; the law is ` +
968
+ `{ storage: ${storage}, package: ${storage}, fetch: ${fetch} }`);
967
969
  }
968
970
  must(hookCtxKeysFor('task').join(' ') === 'random now log signal', `a plugin task's context is random, now, log and signal — this build hands it ` +
969
971
  `[${hookCtxKeysFor('task').join(', ')}]`);
@@ -1049,7 +1051,21 @@ export const REQUIREMENTS = [
1049
1051
  // and only the hosts the package declared and an administrator
1050
1052
  // left granted — the same grant `ctx.fetch` is metered by. The
1051
1053
  // reporting directives take a URL by definition.
1052
- if (name === 'connect-src' || name === 'report-uri' || name === 'report-to')
1054
+ if (name === 'connect-src') {
1055
+ // 🚧 (M2a) Judged, not skipped: the frame's own GET doors
1056
+ // (`<host>/plugin-assets/<id>/`, `<host>/plugin-data/<id>/`, a
1057
+ // path under the document's own host) and granted network hosts
1058
+ // (`https://h`, `ws://h`, …, with no path) are the only sources.
1059
+ // `'self'`, `*`, a bare scheme and any other path are the app.
1060
+ const door = /^[A-Za-z0-9.\-:[\]]+\/plugin-(assets|data)\/[a-z0-9][a-z0-9._-]*\/$/;
1061
+ const granted = /^(https?|wss?):\/\/[^/*\s]+$/;
1062
+ const bad = sources.filter((src) => src !== "'none'" && !door.test(src) && !granted.test(src));
1063
+ must(bad.length === 0, `\`${shown('connect-src')}\` — ${bad.join(', ')} opens more than the frame's own ` +
1064
+ `/plugin-assets/<id>/ and /plugin-data/<id>/ (GET) and its granted network hosts: ` +
1065
+ `'self', a wildcard, a bare scheme or another path lets a frame call the app's API`);
1066
+ continue;
1067
+ }
1068
+ if (name === 'report-uri' || name === 'report-to')
1053
1069
  continue;
1054
1070
  const off = sources.filter((src) => !local(src));
1055
1071
  must(off.length === 0, `\`${name}\` names ${off.join(', ')} — a frame's resources come from the package's own files, ` +
@@ -1411,6 +1427,21 @@ export const REQUIREMENTS = [
1411
1427
  must(!failures.length, failures.join('\n'));
1412
1428
  },
1413
1429
  },
1430
+ {
1431
+ id: 'C40',
1432
+ law: 'scenes first (owner ruling 2026-11-10)',
1433
+ title: 'no pipeline a catalogue ships writes a history entry directly — history is compiled from scenes',
1434
+ consequence: 'A pipeline that files history itself goes around scenes and Compile: its entries land beside the day’s one entry, and a person never reviews them as a scene.',
1435
+ async check(host, fx, report) {
1436
+ const shipped = await host.shipped?.();
1437
+ if (!shipped)
1438
+ return report.skip('the host declares no catalogue — supply `shipped()` for its history writes to be judged');
1439
+ if (!shipped.pipelines?.length)
1440
+ return report.skip('the catalogue ships no pipelines — supply `shipped().pipelines` for its history writes to be judged');
1441
+ const failures = shipped.pipelines.flatMap((d) => historyWriteFindings(d));
1442
+ must(!failures.length, failures.join('\n'));
1443
+ },
1444
+ },
1414
1445
  ];
1415
1446
  // ── C39: lore writes ────────────────────────────────────────────────────────
1416
1447
  const LORE_CREATE = 'core:outlet/create-lore-entry';
@@ -1421,26 +1452,13 @@ const LORE_WRITES = [
1421
1452
  'core:outlet/graph-proposal',
1422
1453
  ];
1423
1454
  const SPAN_READS = ['core:query/summarize-source', 'core:query/graph-scenes'];
1424
- /** The param values a document declares for `nodeKey` — its default presets' `params` rows, over the node's own. */
1425
- function declaredParams(d, nodeKey) {
1426
- const out = {};
1427
- const own = d.nodes.find((n) => n.key === nodeKey)?.config?.params;
1428
- if (own && typeof own === 'object')
1429
- Object.assign(out, own);
1430
- for (const p of d.presets ?? [])
1431
- if (p.default)
1432
- for (const v of p.values)
1433
- if (v.nodeKey === nodeKey && v.slot === 'params' && v.value && typeof v.value === 'object')
1434
- Object.assign(out, v.value);
1435
- return out;
1436
- }
1437
1455
  /** C39's judgement of one shipped document. */
1438
1456
  function loreWriteFindings(d) {
1439
1457
  const out = [];
1440
1458
  const reads = d.nodes.some((n) => SPAN_READS.includes(n.definitionId));
1441
1459
  for (const n of d.nodes) {
1442
1460
  if (n.definitionId === LORE_CREATE) {
1443
- const t = declaredParams(d, n.key).entryType;
1461
+ const t = declaredNodeParams(d, n.key).entryType;
1444
1462
  if (t === undefined || t === null || t === '')
1445
1463
  out.push(`${d.id} ${n.key}: files lore without naming its entry type.`);
1446
1464
  }
@@ -1453,6 +1471,25 @@ function loreWriteFindings(d) {
1453
1471
  }
1454
1472
  return out;
1455
1473
  }
1474
+ // ── C40: history writes ─────────────────────────────────────────────────────
1475
+ /**
1476
+ * C40's judgement of one shipped document: a `create-lore-entry` whose entry type is
1477
+ * `core:entry/history` (the packager's `W_WRITES_HISTORY` predicate). A pipeline with a
1478
+ * `summarize-request` inlet is exempt: its save is previewed.
1479
+ */
1480
+ function historyWriteFindings(d) {
1481
+ if (d.nodes.some((n) => n.definitionId === 'core:inlet/summarize-request'))
1482
+ return [];
1483
+ const out = [];
1484
+ for (const n of d.nodes) {
1485
+ if (n.definitionId !== 'core:outlet/create-lore-entry')
1486
+ continue;
1487
+ const t = declaredNodeParams(d, n.key).entryType;
1488
+ if (typeof t === 'string' && t.replace(/@\d+$/, '') === 'core:entry/history')
1489
+ out.push(`${d.id} ${n.key}: writes a history entry directly — put the event in a scene (note-scene@1 or a story line); Compile files it under the day's entry.`);
1490
+ }
1491
+ return out;
1492
+ }
1456
1493
  // ── C35 · C36: the registrations a catalogue ships, at the one door ─────────
1457
1494
  /** The genres' defaults and each preset's own registrations, with the layer each was declared in. */
1458
1495
  function shippedRegistrations(shipped) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serene-pub/conformance",
3
- "version": "0.6.0-pr-6",
3
+ "version": "0.6.0-pr-8",
4
4
  "description": "The host conformance kit: thirty-three executable requirements a Serene Pub executor must satisfy. Run by Serene Pub and by any alternate host; its package cases (C28–C33) by plugin authors over a built package.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://github.com/SerenePub/serene-pub-sdk/tree/main/conformance#readme",
@@ -33,13 +33,13 @@
33
33
  "./package.json": "./package.json"
34
34
  },
35
35
  "peerDependencies": {
36
- "@serene-pub/sdk": "^0.6.0-pr-6"
36
+ "@serene-pub/sdk": "^0.6.0-pr-8"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "tsc -p tsconfig.build.json"
40
40
  },
41
41
  "devDependencies": {
42
- "@serene-pub/sdk": "0.6.0-pr-6"
42
+ "@serene-pub/sdk": "0.6.0-pr-8"
43
43
  },
44
44
  "publishConfig": {
45
45
  "access": "public",