Files
timmy-talking-turd/tests/product-decisions.test.js
T
timmy ef22ea8970
Quality gates / quality (pull_request) Successful in 3m44s
feat(training): separate opt-in contribution receipts with withdrawable tombstones
A journal save now records no training contribution. A contribution is a second
consent: the privacy page states consent version training-consent-v1 and the
receipt (contribution id, included fields, never-included fields) before the
confirm control is enabled, the receipt is queued on this device only and copies
no photo bytes, note text, or symptom answers, and withdrawal keeps a tombstone
naming every derived artifact by contribution id. Delete-all clears the receipts
with the ledger.

Closes #24
2026-10-21 10:58:50 +00:00

40 lines
2.2 KiB
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import { readFile } from 'node:fs/promises';
const decisionPath = new URL('../docs/PRODUCT-DECISIONS.md', import.meta.url);
const policyPath = new URL('../docs/TIMMY-AGENT-POLICY.md', import.meta.url);
const readmePath = new URL('../README.md', import.meta.url);
test('product decision record fixes the AI boundary and release authority', async () => {
const decision = await readFile(decisionPath, 'utf8');
assert.match(decision, /Observable AI fields[\s\S]*Bristol form[\s\S]*broad color[\s\S]*image quality/i);
assert.match(decision, /Prohibited inferences[\s\S]*disease[\s\S]*bleeding[\s\S]*pain[\s\S]*urgency[\s\S]*fever[\s\S]*vomiting[\s\S]*food/i);
assert.match(decision, /release authority/i);
assert.match(decision, /tool-capable Hermes Agent/i);
assert.match(decision, /browser never receives provider credentials or Hermes session IDs/i);
assert.match(decision, /deterministic urgent-symptom guidance runs before chat/i);
assert.match(decision, /Human gates[\s\S]*clinical and privacy review[\s\S]*beta consent[\s\S]*RC approval/i);
assert.match(decision, /\.\.\/PRODUCT\.md/);
assert.match(decision, /\.\.\/AI-EVIDENCE\.md/);
assert.match(decision, /\.\.\/research\/SELF-HOSTED-STOOL-VISION\.md/);
});
test('the decision record keeps training contribution as its own versioned, withdrawable consent', async () => {
const decision = await readFile(decisionPath, 'utf8');
assert.match(decision, /### Training contribution consent/);
assert.match(decision, /never a training contribution/i);
assert.match(decision, /withdrawal keeps a tombstone naming every derived artifact by contribution id/i);
assert.match(decision, /does not transmit a contribution until the corpus pipeline and privacy copy are reviewed/i);
});
test('Hermes deployment installs a checked-in non-diagnostic workspace policy', async () => {
const [policy, readme] = await Promise.all([readFile(policyPath, 'utf8'), readFile(readmePath, 'utf8')]);
assert.match(policy, /never diagnose/i);
assert.match(policy, /urgent symptoms/i);
assert.match(policy, /explicit user intent and confirmation/i);
assert.match(readme, /install -m 600 docs\/TIMMY-AGENT-POLICY\.md/);
});