@davidbalzan/groundwork 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/commands/doctor.mjs +41 -0
package/package.json
CHANGED
package/src/commands/doctor.mjs
CHANGED
|
@@ -910,6 +910,47 @@ guard("sweep-census", () => {
|
|
|
910
910
|
]);
|
|
911
911
|
});
|
|
912
912
|
|
|
913
|
+
// A pin that states a count and cannot reproduce it.
|
|
914
|
+
//
|
|
915
|
+
// A STATED METHOD THAT CONTRADICTS ITS OWN PUBLISHED RESULT IS WORSE THAN NO
|
|
916
|
+
// METHOD: it looks auditable, so it invites exactly the trust it cannot bear. The
|
|
917
|
+
// board's `[SWEEP:canon.2]` pin says "13 members" and carries a predicate that
|
|
918
|
+
// returns 9 — the four delivered members were closed and the prose count was not.
|
|
919
|
+
// A reader who runs the predicate finds the discrepancy; a reader who trusts the
|
|
920
|
+
// number does not, and the number is the part that looks like a fact.
|
|
921
|
+
//
|
|
922
|
+
// So a pin asserting a subset must be RE-DERIVABLE, and this re-derives it. The
|
|
923
|
+
// predicate is the pin's own: position-matched sweep tags over parsed queue items,
|
|
924
|
+
// which is the only method of the three that was ever right.
|
|
925
|
+
guard("pin-reproducibility", () => {
|
|
926
|
+
const board = path.join(docs, "WORKSTREAMS.md");
|
|
927
|
+
if (!exists(board) || !queueDocs.length) return;
|
|
928
|
+
const text = readText(board);
|
|
929
|
+
// `### \`[SWEEP:<tag>]\` — pinned at <sha>, <n> members`
|
|
930
|
+
const pins = [...text.matchAll(/^###\s+`\[SWEEP:([a-z0-9._-]+)\]`[^\n]*?(\d+)\s+members/gim)];
|
|
931
|
+
if (!pins.length) {
|
|
932
|
+
push("pin-reproducibility", "info", ["no pinned sweeps on the board — nothing to re-derive"]);
|
|
933
|
+
return;
|
|
934
|
+
}
|
|
935
|
+
const items = queueDocs.flatMap((rel) => queueItemsOf(parseWorkDoc(readText(path.join(docs, rel)))));
|
|
936
|
+
const problems = [];
|
|
937
|
+
const okLines = [];
|
|
938
|
+
for (const [, tag, claimed] of pins) {
|
|
939
|
+
const actual = items.filter((i) => sweepTagOf(i) === tag.toLowerCase()).length;
|
|
940
|
+
if (Number(claimed) !== actual) {
|
|
941
|
+
problems.push(
|
|
942
|
+
`[SWEEP:${tag}] pin claims ${claimed} members; its own predicate returns ${actual}. ` +
|
|
943
|
+
`A stated count that the stated method contradicts is worse than no count — it looks auditable. ` +
|
|
944
|
+
`Re-derive the pin, or record why the difference is expected.`,
|
|
945
|
+
);
|
|
946
|
+
} else {
|
|
947
|
+
okLines.push(`[SWEEP:${tag}]: ${actual} members, predicate reproduces the count`);
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
if (problems.length) push("pin-reproducibility", "warn", [...problems, ...okLines]);
|
|
951
|
+
else push("pin-reproducibility", "ok", okLines);
|
|
952
|
+
});
|
|
953
|
+
|
|
913
954
|
const factsFile = path.join(docs, "FACTS.md");
|
|
914
955
|
guard("facts-freshness", () => {
|
|
915
956
|
if (exists(factsFile)) {
|