mirror of
https://github.com/bitbaum/substrata.git
synced 2026-12-04 04:47:30 +01:00
* refactor(research): one queue per engine — the database, not committed worklists The event sweep and producer sourcing each had two queues: a committed file from the old hand-run CLI (research/events.json, research/evidence.json) and the database queue the box timers fill. /api/events read the file and reported a sweep from 2026-09-15 while the real one runs hourly, and the freshness gate would have failed the build around 2026-10-16. - /api/events reads freshness() from research_sweep_candidates (force-dynamic), with sweep.readable=false instead of a fake answer when the DB is down. - Bottleneck pages read open research_source_candidates live (ProducersTable + openCandidatesFor); null -> "could not be read", never "nothing found". The corpus now says sourced/unverified only; found pages never change a row's state, the export or the search index. - Removed EVENT_WORKLIST/candidatesAwaiting, EVIDENCE/evidenceFor, both JSON files, both CLIs, the weekly research-sweep workflow and their npm scripts. Unreviewed rows were copied into the DB first (25 sweep leads, 2 source pages; the rest were present or belonged to rows since sourced). - Freshness: dropped the two file datasets; new test fails when a committed research/*.json has no DATASETS row or a declared file is gone; a test fails if either worklist file comes back. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix(ask): model picker gets a labelled button on narrow composers At 390px the free-model select was squeezed to "A…", at 320px to a bare chevron. Below a 28rem composer width (a container query, so the dock counts too) the bar shows Dictate, Attach, "Model <name> ▾", Ask; the button opens the picker full width underneath together with "Use your own AI key instead". Wide composers are unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
50 lines
2.0 KiB
TypeScript
50 lines
2.0 KiB
TypeScript
/**
|
|
* The JSON map is the site for machines. It must agree with the site, and it
|
|
* must not be able to say "sourced" about a row the coverage file does not.
|
|
*/
|
|
|
|
import { test } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
|
|
import { buildMap } from '../lib/map';
|
|
import { COVERAGE } from '../config/substrata-coverage';
|
|
import { coverageProgress } from '../lib/coverage-progress';
|
|
import { RESEARCH_PROGRAMMES } from '../config/substrata-programmes';
|
|
import { correctionUrl } from '../lib/site';
|
|
|
|
test('the map carries every producer row with a three-valued verification', () => {
|
|
const map = buildMap();
|
|
const rows = map.materials.flatMap((m) => m.producers);
|
|
assert.equal(rows.length, coverageProgress().total);
|
|
for (const row of rows) {
|
|
assert.ok(['sourced', 'candidate', 'unverified'].includes(row.verification));
|
|
if (row.verification === 'sourced')
|
|
assert.ok(row.source, `${row.name} is sourced without a source`);
|
|
if (row.source === null) assert.notEqual(row.verification, 'sourced');
|
|
}
|
|
assert.equal(
|
|
map.progress.producers.sourced,
|
|
rows.filter((r) => r.verification === 'sourced').length,
|
|
);
|
|
// Found-but-unchecked pages are a database queue, never corpus or export.
|
|
assert.equal(rows.filter((r) => r.verification === 'candidate').length, 0);
|
|
});
|
|
|
|
test('the map and the site are drawn from the same objects', () => {
|
|
const map = buildMap();
|
|
assert.deepEqual(
|
|
map.materials.map((m) => m.material),
|
|
COVERAGE.map((entry) => entry.material),
|
|
);
|
|
assert.equal(map.programmes.length, RESEARCH_PROGRAMMES.length);
|
|
assert.equal(map.programmes[0].layers.length, RESEARCH_PROGRAMMES[0].layers.length);
|
|
assert.ok(map.notice.includes('Only "sourced" is a finding'));
|
|
});
|
|
|
|
test('the correction link is a prefilled public issue', () => {
|
|
const url = new URL(correctionUrl('The map'));
|
|
assert.equal(url.origin + url.pathname, 'https://github.com/bitbaum/substrata/issues/new');
|
|
assert.equal(url.searchParams.get('title'), 'Correction: The map');
|
|
assert.ok(url.searchParams.get('body')?.includes('Source'));
|
|
});
|