the access round: spectator mode removed and reads made story-only -- the table, raw session, carryover, files, status, and the notepad are owner-only; the story is the one public read (any signed-in user, fork button on it that copies the run that made the story, never the view); #28's human-side open read overturned with the ruling, gm.md stays never model-facing; non-owners land in the story view (play/setup redirect on the 403, home cards link there directly), the story view names its owner and stands alone on the story response, which now carries display/owner/ownerName; the table gains a raw tab -- the whole log as it rode the wire (thinking, every variant block, every reminder copy, full tool results, rides inline) next to the curated projection, live sessions only, sticky across turn re-renders; --debug mode for easy testing: every request is a fixed superuser that bypasses the users db entirely, no invite dance, loopback-bound regardless of config (found live: the SPA boot only asked the server who it was when a token existed, so tokenless browsers never learned they were the debug user -- boot now always asks); lint rule 10: no laptop-visible facts anywhere and all commits always from Mute -- the username and home paths are derived at runtime so the checker never contains them, scanned over the tracked tree, every historical blob, and commit messages, identity enforced on author and committer on every ref plus git config; the queue split: resolved questions relocated to DECISIONS.md verbatim by number (day's words kept, reversals annotate never rewrite, the agenda/reminder trio gets its own section), QUESTIONS is open items only (stale OPENs resolved on the way: #10 by the 2026-11-13 pairing default, #11 by the raw tab); smoke reworked to the story-only battery -- ash 403s on every run surface, 200 on the story alone, the ownerless-run check rides the runs list; all twelve QUESTIONS-number citations re-pointed at DECISIONS; smoke ALL PASS in a worktree (111 checks), two-user browser pass (the non-owner's whole run surface is a 403 detail and a 200 story, back-to-table hidden, owner views intact), raw-tab browser pass (curated table leak-free, raw shows the whole variants block, tabs vanish on dormancy), typecheck green on both programs, check-repo clean

This commit is contained in:
2026-11-15 22:37:06 +00:00
parent 8d4a6b91df
commit e763d6c146
20 changed files with 881 additions and 575 deletions
+73
View File
@@ -37,9 +37,16 @@
// prompts never enter the bundle).
// 9. Seeds carry no date keys (GM, 2026-11-14): no model-facing
// surface renders a date; story time lives in prose.
// 10. No laptop-visible facts (GM, 2026-11-15): this machine's
// username and home paths appear nowhere -- tracked tree,
// historical blobs, commit messages -- and every commit is
// always from Mute (author and committer, name and email, every
// ref, git config included). The facts are derived at runtime;
// writing them into the checker would leak them itself.
import { execFileSync } from 'node:child_process';
import { readFileSync } from 'node:fs';
import { homedir, userInfo } from 'node:os';
let failures = 0;
const fail = (msg) => { console.log(`FAIL ${msg}`); failures++; };
@@ -53,6 +60,20 @@ const livingProse = (f) =>
// their comments); it is exempt from the rules it defines
const isSelf = (f) => f === 'test/check-repo.mjs';
// rule 10's patterns, derived at runtime so this file never contains
// the facts it bans (a literal here would be the leak itself). The
// username is matched as a plain substring -- recall over precision;
// the home path rides along in both separator spellings.
const esc = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
const piiSrc = [
esc(userInfo().username),
homedir().split(/[\\/]+/).map(esc).join('[\\\\/]+'),
].join('|');
const piiRe = new RegExp(piiSrc, 'i');
// the pseudonymous identity every commit carries, no exceptions
const ID_NAME = 'Mute';
const ID_EMAIL = 'codename.mute@proton.me';
for (const f of files) {
const buf = readFileSync(f);
if (buf.includes(0)) continue; // binary -- no text rules to enforce
@@ -157,6 +178,58 @@ for (const f of files) {
}
});
}
// rule 10a: laptop-visible facts never enter the tracked tree
text.split('\n').forEach((line, i) => {
if (piiRe.test(line)) {
fail(`${f}:${i + 1} laptop-visible fact (this machine's username or home path)`);
}
});
}
// rule 10b: the same facts never entered history -- every blob on
// every ref; one report per path+content, not one per commit
{
const revs = execFileSync('git', ['rev-list', '--all'], { encoding: 'utf8' }).split('\n').filter(Boolean);
let out = '';
try {
out = execFileSync('git', ['grep', '-I', '-i', '-E', piiSrc, ...revs], { encoding: 'utf8' });
} catch (e) {
out = `${e.stdout || ''}`; // grep exits 1 on zero matches
}
const seen = new Set();
for (const line of out.split('\n').filter(Boolean)) {
const rest = line.slice(line.indexOf(':') + 1); // "rev:path:content" -> "path:content"
if (!seen.has(rest)) {
seen.add(rest);
fail(`history ${rest.slice(0, 80)}: laptop-visible fact in a historical blob`);
}
}
}
// rule 10c: commit messages stay clean too
execFileSync('git', ['log', '--all', '--format=%s %b'], { encoding: 'utf8' })
.split('\n')
.forEach((line) => {
if (piiRe.test(line)) fail(`commit message: laptop-visible fact (${line.trim().slice(0, 60)})`);
});
// rule 10d: every commit is from Mute -- author and committer, name
// and email, on every ref
for (const row of execFileSync('git', ['log', '--all', '--format=%h%x00%an%x00%ae%x00%cn%x00%ce'], { encoding: 'utf8' }).split('\n').filter(Boolean)) {
const [h, an, ae, cn, ce] = row.split('\x00');
if (an !== ID_NAME || ae !== ID_EMAIL || cn !== ID_NAME || ce !== ID_EMAIL) {
fail(`commit ${h}: identity is "${an} <${ae}>" -- all commits are always from ${ID_NAME}`);
}
}
// rule 10e: and the configured identity keeps it that way
for (const [key, want] of [['user.name', ID_NAME], ['user.email', ID_EMAIL]]) {
let val = '(unset)';
try {
val = execFileSync('git', ['config', key], { encoding: 'utf8' }).trim();
} catch { /* unset -- the fail below reports it */ }
if (val !== want) fail(`git config ${key} is "${val}" -- all commits are always from ${ID_NAME}`);
}
console.log(failures ? `\n${failures} VIOLATIONS` : 'ALL CLEAN');
+26 -8
View File
@@ -2,7 +2,7 @@
// server. Covers: bootstrap, claim, spent-invite rejection, second
// user, the session lifecycle (create dormant -> start -> live ->
// stop -> dormant -> re-run -> start -> the auto-send rule -> the
// start lint), spectator 403s, fork, save-package, create-from-user-
// start lint), non-owner 403s, fork, save-package, create-from-user-
// package, revocation, ownerless state, the agenda deltas + self-
// heal, the reminder ride, per-run models, variant literature (the
// random pick, the /table projection, the variance metric), the
@@ -165,15 +165,32 @@ ok('agenda override owner-only', r.status === 403);
r = await call(`/runs/${runId}/status`, { token: op });
ok('status endpoint carries both', Array.isArray(r.data.status) && Array.isArray(r.data.agenda), JSON.stringify(r.data).slice(0, 120));
// 11. ash spectates: reads ok, mutates 403
// 11. ash in another's run: the story is the reading surface, all
// else is the owner's
r = await call(`/runs/${runId}`, { token: ash });
ok('ash reads run', r.status === 200 && r.data.run.ownerName === 'Op', r.data.error ?? '');
ok('ash detail 403', r.status === 403);
r = await call(`/runs/${runId}/table`, { token: ash });
ok('ash table 403', r.status === 403);
r = await call(`/runs/${runId}/session`, { token: ash });
ok('ash raw session 403', r.status === 403);
r = await call(`/runs/${runId}/carryover`, { token: ash });
ok('ash carryover 403', r.status === 403);
r = await call(`/runs/${runId}/files`, { token: ash });
ok('ash files 403', r.status === 403);
r = await call(`/runs/${runId}/status`, { token: ash });
ok('ash status 403', r.status === 403);
r = await call(`/runs/${runId}/notes`, { token: ash });
ok('ash notes 403 (#28 overturned)', r.status === 403);
r = await call(`/runs/${runId}/housekeeping`, { token: ash });
ok('ash housekeeping state 403', r.status === 403);
r = await call(`/runs/${runId}/housekeeping/log`, { token: ash });
ok('ash housekeeping log 403', r.status === 403);
r = await call(`/runs/${runId}/turn`, { method: 'POST', token: ash, body: { line: 'hi' } });
ok('ash turn 403', r.status === 403);
r = await call(`/runs/${runId}/notes`, { method: 'PUT', token: ash, body: { content: 'mine' } });
ok('ash notes write 403', r.status === 403);
r = await call(`/runs/${runId}/notes`, { token: ash });
ok('ash reads notes', r.status === 200); // spectators read the pad
r = await call(`/runs/${runId}/story`, { token: ash });
ok('ash reads the story', r.status === 200 && !!r.data.display && Array.isArray(r.data.sessions), r.data.error ?? '');
r = await call(`/runs/${runId}/housekeeping/replay`, { method: 'POST', token: ash, body: {} });
ok('ash replay 403 (spends a call)', r.status === 403);
@@ -228,9 +245,10 @@ r = await call(`/users/${ashId}/revoke`, { method: 'POST', token: op, body: {} }
ok('revoke ash', r.status === 200, r.data.error ?? '');
r = await call('/runs', { token: ash });
ok('ash token dead', r.status === 401);
r = await call(`/runs/${forkId}`, { token: op });
ok('fork now ownerless, session closed', r.status === 200 && r.data.run.owner === null && r.data.run.ownerName === null && r.data.open === false,
JSON.stringify(r.data.run));
r = await call('/runs', { token: op });
const goneFork = Array.isArray(r.data) ? r.data.find((x) => x.id === forkId) : null;
ok('fork now ownerless, session closed', !!goneFork && goneFork.owner === null && goneFork.ownerName === null && goneFork.open === false,
JSON.stringify(goneFork)); // the detail it used to ride is owner-only now -- the list carries the facts
r = await call(`/runs/${forkId}/turn`, { method: 'POST', token: op, body: { line: 'x' } });
ok('ownerless turn 403 even for op', r.status === 403 && /ownerless/.test(r.data.error));
r = await call('/packages', { token: op });