commit 1407d4d2e5f948c723aad9f0fad7c2d64a393237
parent e1ce4c91f7e4444cf8d301fc7268ceefbb56fd4e
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Fri, 16 Oct 2026 13:40:36 -0400
Merge r31/respell: the project's report copy is respelled too
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
3 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/common/bin/reports-respell.test.ts b/common/bin/reports-respell.test.ts
@@ -50,6 +50,8 @@ test("dry by default: every change listed, nothing written; --apply writes the i
mkdirSync(project, { recursive: true });
const manifestFile = path.join(project, "video.manifest.json");
writeFileSync(manifestFile, JSON.stringify({ slug: "cb", timeline: [{ id: "c", quote: "my own cakeup machine" }] }));
+ const projectReport = path.join(project, "report.json");
+ writeFileSync(projectReport, JSON.stringify(doc("cb")));
const articleFile = path.join(s.paths.articlesDir, "cb", "report.json");
const iterFile = path.join(s.paths.articlesDir, "cb", "iterations", "1", "report.json");
const before = readFileSync(articleFile, "utf8");
@@ -62,6 +64,7 @@ test("dry by default: every change listed, nothing written; --apply writes the i
assert.match(text, /iteration-report .*: 2 change\(s\)/);
assert.match(text, /article-report .*: 2 change\(s\)/);
assert.match(text, /video-manifest .*: 1 change\(s\)/);
+ assert.match(text, /project-report .*: 2 change\(s\)/);
assert.match(text, /dry run: nothing written/);
const run = capture();
@@ -73,8 +76,9 @@ test("dry by default: every change listed, nothing written; --apply writes the i
assert.deepEqual(r.respellings, [{ heard: ["cake cup", "cakeup"], reads: "K-Cup" }]);
}
assert.equal(JSON.parse(readFileSync(manifestFile, "utf8")).timeline[0].quote, "my own K-Cup machine");
+ assert.equal(JSON.parse(readFileSync(projectReport, "utf8")).citations.a.quote, "my own K-Cup machine");
const backups = readdirSync(path.join(project, "revisions"));
- assert.equal(backups.length, 3);
+ assert.equal(backups.length, 4);
assert.ok(backups.some((b) => b.endsWith("-before-respell.article-report.json")));
// The backup is the file as it was.
const ab = backups.find((b) => b.endsWith("article-report.json"))!;
@@ -83,7 +87,7 @@ test("dry by default: every change listed, nothing written; --apply writes the i
// Again: nothing left to change.
const again = capture();
assert.equal(await respellMain("cb", { ...FLAGS, apply: true }, s, again.out), 1);
- assert.equal(readdirSync(path.join(project, "revisions")).length, 3);
+ assert.equal(readdirSync(path.join(project, "revisions")).length, 4);
});
test("an article with no iterations: its report only, backed up outside the store", async () => {
diff --git a/common/lib/report/respellArticle.ts b/common/lib/report/respellArticle.ts
@@ -8,7 +8,7 @@
// - reports/<id>/report.json — when it is n's report (the article is current on n,
// or has no iterations), through writeArticle (audience and video kept);
// - <projectsRoot>/<id>/i<n>/video.manifest.json — the iteration's video project,
-// when it has one.
+// when it has one, and the report.json the chain copied beside it.
// Each report gains `respellings`, the manifest too (every quote check, and the
// video's cut-to-quote, apply them from then on). Before a write, the file as it was
// is copied to the project's `revisions/<stamp>-before-respell.<name>` (beside the
@@ -31,7 +31,7 @@ import { parseReport } from "./validate";
type StorePaths = Pick<Paths, "articlesDir" | "exportIndexDir">;
export type RespellTarget = {
- kind: "iteration-report" | "article-report" | "video-manifest";
+ kind: "iteration-report" | "article-report" | "project-report" | "video-manifest";
file: string;
changes: RespellChange[];
};
@@ -107,6 +107,14 @@ async function compute(id: string, input: readonly Respelling[], o: RespellOptio
throw new ArticleRegistryError(`"${id}" has no report.json and no iterations`);
}
if (projectDir) {
+ // The copy of the report the chain put beside the manifest ("what the cut reads
+ // beside its manifest", umtool chain-run's manifest step).
+ const pFile = path.join(projectDir, "report.json");
+ const pRaw = await readJson(pFile);
+ if (pRaw && typeof pRaw === "object" && !Array.isArray(pRaw)) {
+ const r = respellReport(pRaw as Report, respellings);
+ writes.push({ target: { kind: "project-report", file: pFile, changes: r.changes }, data: r.report, projectDir });
+ }
const file = path.join(projectDir, "video.manifest.json");
const raw = await readJson(file);
if (raw && typeof raw === "object" && !Array.isArray(raw)) {
@@ -159,6 +167,7 @@ export async function applyRespell(
} else if (w.target.kind === "article-report") {
await writeArticle(w.data, { paths: o.paths, keepAudience: true, keepVideo: true });
} else {
+ // The project's own files (the manifest, the report copy): not the store's.
await writeFile(w.target.file, after, "utf8");
}
}
diff --git a/plans/FACTS.md b/plans/FACTS.md
@@ -9893,9 +9893,9 @@ parsed to 0 cues, indexing the video textless) is CLOSED by `200a3105` (transcri
and `/api/report/cut`) passes the manifest's. Undeclared, a corrected quote is `inexact` (strict) and may drift.
- **The writer** `lib/report/respellArticle.ts` (`archilyzer reports respell`): iteration n's report.json via
`writeIterationFile`, the article's report.json via `writeArticle` (keepAudience, keepVideo) when it is n's, and
- `<projectsRoot>/<id>/i<n>/video.manifest.json`; the raw JSON is respelled (key order kept). What is respelled:
+ `<projectsRoot>/<id>/i<n>/video.manifest.json` and the `report.json` the chain copied beside it; the raw JSON is respelled (key order kept). What is respelled:
`respellReport` — cite-link labels and `citations.*.quote` "display"; the report's own words plain; sources, a claim's
`sourceQuote`, ids and links never. `respellManifest` — `quote`/`words` "display", other prose plain, SKIP_KEYS (ids,
paths, urls, provenance, drafted) and path/url-looking values never. Backups: `<project>/revisions/<stamp>-before-
- respell.{iteration-report,article-report,manifest}.json` (no iterations: `<projectsRoot>/<id>/revisions/`).
+ respell.{iteration-report,article-report,project-report,manifest}.json` (no iterations: `<projectsRoot>/<id>/revisions/`).