Files
substrata/test/programmes.test.ts
CatoandClaude Opus 5 6e25553f6d feat(portal): sections for policy, markets and science; plain language; and a test that fails the build on untrue copy (#37)
An audit found the site claiming a firm that does not exist: declining
business every week, notes on a schedule, analysts, a desk, a compliance
function, two phases running at once. All of it is gone, and
test/truth.test.ts now walks every renderable string and fails the build
if any of those phrases return. The mandate, acting and disclosure pages
described that same firm; they are replaced by one About page that says
plainly who makes this (one person and AI agents, since 2026-08-26), what
exists, and what does not.

Three new sections. Policy carries twelve rules fetched and read today from
government sources, each with a verbatim sentence, a status that admits when
something is adopted but not yet in force, and a named backer only where an
organisation asked in its own document. Markets joins the directory to the
verified producer rows and gives every organisation a page, while saying
plainly that the directory's grades are unsourced. Science lists twelve
candidate reliefs with a readiness judgement and says on every row that the
judgement is not yet cited.

Navigation becomes seven sections. Every bottleneck gains a plain-English
line, technology and industry tags, and filters by both. Binding becomes
Severity, horizon becomes When it bites, and sourced/candidate/unverified
become Verified/Source found/Unverified, all defined in a fold-out legend.


Claude-Session: https://claude.ai/code/session_01Y6ecRd91ZsPPcjuNkKTFV2

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-15 01:19:10 -07:00

94 lines
2.9 KiB
TypeScript

/**
* A programme may only cite rows the mandate has admitted. This is what stops
* a research question from quietly widening the universe: if the answer needs
* a node, the node enters coverage through the two tests first.
*/
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { MATERIALS } from '../config/substrata';
import { CHOKEPOINTS } from '../config/substrata-coverage';
import {
RESEARCH_PROGRAMMES,
programmeProgress,
rowsCitedBy,
} from '../config/substrata-programmes';
const UNIVERSE = new Set<string>([
...MATERIALS.map((m) => m.title),
...CHOKEPOINTS.map((c) => c.name),
]);
test('every row a programme cites exists in the coverage universe', () => {
for (const programme of RESEARCH_PROGRAMMES) {
for (const layer of programme.layers) {
for (const row of layer.gatedBy) {
assert.ok(
UNIVERSE.has(row),
`${programme.id} / ${layer.id} cites "${row}", which is not a material or chokepoint under coverage`,
);
}
}
}
});
test('every layer is gated by at least one row, and cites nothing twice', () => {
for (const programme of RESEARCH_PROGRAMMES) {
for (const layer of programme.layers) {
assert.ok(
layer.gatedBy.length > 0,
`${programme.id} / ${layer.id} names nothing that gates it`,
);
assert.equal(
new Set(layer.gatedBy).size,
layer.gatedBy.length,
`${programme.id} / ${layer.id} cites a row twice`,
);
}
}
});
test('every open question names what would settle it', () => {
for (const programme of RESEARCH_PROGRAMMES) {
for (const question of programme.questions) {
assert.ok(
question.settledBy.trim().length > 20,
`${programme.id} / ${question.id} has no settler`,
);
assert.ok(
question.question.trim().endsWith('?'),
`${programme.id} / ${question.id} is not a question`,
);
}
}
});
test('ids are unique within a programme and programmes carry a real date', () => {
for (const programme of RESEARCH_PROGRAMMES) {
assert.match(programme.opened, /^\d{4}-\d{2}-\d{2}$/);
for (const list of [programme.layers, programme.questions, programme.deliverables]) {
const ids = list.map((item) => item.id);
assert.equal(
new Set(ids).size,
ids.length,
`${programme.id} repeats an id in ${ids.join(',')}`,
);
}
}
});
test('progress counts deliverables honestly', () => {
const programme = RESEARCH_PROGRAMMES[0];
const progress = programmeProgress(programme);
assert.equal(progress.total, programme.deliverables.length);
assert.equal(
progress.done + progress.inProgress,
programme.deliverables.filter((d) => d.status !== 'not-started').length,
);
assert.ok(
rowsCitedBy(programme).length >= MATERIALS.length,
'the materials layer cites the whole universe',
);
});