@sdd-method/verify-cli 5.5.0 → 5.5.1

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.
@@ -273,6 +273,25 @@ async function gitShow(repo, commit, path) {
273
273
  return null;
274
274
  }
275
275
  }
276
+ /** Files under a directory on disk, relative to it, sorted. */
277
+ async function filesUnder(root, rel = "") {
278
+ const out = [];
279
+ let entries;
280
+ try {
281
+ entries = await readdir(join(root, rel), { withFileTypes: true });
282
+ }
283
+ catch {
284
+ return out;
285
+ }
286
+ for (const e of entries) {
287
+ const p = rel ? `${rel}/${e.name}` : e.name;
288
+ if (e.isDirectory())
289
+ out.push(...(await filesUnder(root, p)));
290
+ else
291
+ out.push(p);
292
+ }
293
+ return out.sort();
294
+ }
276
295
  /** Paths under a directory at a commit, relative to that directory. */
277
296
  async function gitFiles(repo, commit, dir) {
278
297
  try {
@@ -1133,6 +1152,46 @@ export async function checkBehaviourStore(repo, options = {}) {
1133
1152
  lines.push(`open baselines: ${openBaselines.length}, asked the archive's questions as warnings`);
1134
1153
  const unseen = servedBy === null ? "" : `; repositories with no catalogue contracts: ${[...new Set(await observedInAll(repo, archiveRel, order))].filter((r) => (servedBy.get(r)?.served ?? []).length === 0).join(", ") || "none"}`;
1135
1154
  lines.push(baselines === 0 ? "surfaces: vacuous (no baseline)" : `surfaces: ${baselines} baseline(s), ${surfacesChecked} served contract(s) checked against catalogues/repo_contract.csv less what service_contract records only consumed${unseen}${structureOnly ? `; ${structureOnly} structure-only baseline(s) admitting no behaviour, Surfaces: none` : ""}${generatedBaselines ? `; ${generatedBaselines} generator baseline(s) serving no contract, Surfaces: generated` : ""}${noneServedBaselines ? `; ${noneServedBaselines} baseline(s) of services serving no contract, Surfaces: none served` : ""}${historical.size ? `; ${historical.size} historical baseline(s) not checked (every requirement they baselined has left the living specs)` : ""}`);
1155
+ // Archive integrity (sdm-9sk1): what MERGED is not edited. An archived change's spec deltas and structural deltas
1156
+ // (specs/**, structure/** with applied.yaml) are what entered the living model and what the history catalogues are
1157
+ // derived from (requirement_lineage, revisions, change_effects); editing one after it archived makes the history
1158
+ // claim something entered that never did. A mistake there is fixed by a new change (a corrective baseline, for a
1159
+ // baseline). Every other file of an archived change is bookkeeping (evidence notes, errata, tasks, a deferral) and may
1160
+ // be corrected; git is the record of who changed what. Each archived change is compared with its tree at the commit
1161
+ // that added it; without git history the check is unresolved, never a pass.
1162
+ if (history) {
1163
+ let checkedArchives = 0;
1164
+ let payloadFiles = 0;
1165
+ let bookkeepingEdits = 0;
1166
+ const payload = (f) => f.startsWith("specs/") || f.startsWith("structure/");
1167
+ for (const name of order) {
1168
+ const dir = `${archiveRel}/${name}`;
1169
+ const at = await integratedAt(repo, dir);
1170
+ if (at === null)
1171
+ continue; // not yet committed: nothing archived to compare with
1172
+ checkedArchives++;
1173
+ const then = new Set(await gitFiles(repo, at, dir));
1174
+ const now = new Set(await filesUnder(join(repo, dir)));
1175
+ for (const f of [...new Set([...then, ...now])].sort()) {
1176
+ const before = then.has(f) ? await gitShow(repo, at, `${dir}/${f}`) : null;
1177
+ const after = now.has(f) ? await readText(join(repo, dir, f)) : null;
1178
+ if (payload(f))
1179
+ payloadFiles++;
1180
+ if (before === after)
1181
+ continue;
1182
+ if (!payload(f)) {
1183
+ bookkeepingEdits++;
1184
+ continue;
1185
+ }
1186
+ const what = before === null ? "added to" : after === null ? "removed from" : "edited in";
1187
+ failures.push(`${dir}/${f}: ${what} an archived change after it archived (at ${at.slice(0, 12)}); its spec and structural deltas are what merged into the living model, so a mistake there is fixed by a new change (a corrective baseline, for a baseline), not by editing the archive`);
1188
+ }
1189
+ }
1190
+ lines.push(`archive integrity: ${checkedArchives} archived change(s), ${payloadFiles} merged delta file(s) compared with the commit that archived them${bookkeepingEdits ? `; ${bookkeepingEdits} later correction(s) to bookkeeping files (evidence, tasks, notes), which may be corrected` : ""}`);
1191
+ }
1192
+ else if (archived.length > 0) {
1193
+ lines.push("archive integrity: not checked (no git history: run from a clone)");
1194
+ }
1136
1195
  lines.push(scopeChecked === 0 ? "scope: vacuous (no baseline removes, modifies or renames a requirement)" : `scope: ${scopeChecked} requirement(s) a baseline removes, modifies or renames, checked against their lineage`);
1137
1196
  if (!history && archived.length > 0)
1138
1197
  lines.push("order: no git history (not a git work tree, or git log failed), so same-day archives cannot be ordered");
@@ -1,4 +1,4 @@
1
1
  {
2
- "version": "0.19.0",
3
- "built_against_sdd_cli": "5.5.0"
2
+ "version": "0.19.1",
3
+ "built_against_sdd_cli": "5.5.1"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
- "version": "5.5.0",
3
- "built_against_sdd_cli": "5.5.0"
2
+ "version": "5.5.1",
3
+ "built_against_sdd_cli": "5.5.1"
4
4
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sdd-method/verify-cli",
3
- "version": "5.5.0",
4
- "sddCliVersion": "5.5.0",
3
+ "version": "5.5.1",
4
+ "sddCliVersion": "5.5.1",
5
5
  "description": "Verify an SDD repository without changing it — validate, list, and read-only catalogue and pack checks. Ships only the code those verbs reach; it cannot write to the repository it is pointed at. Authoring and maintenance are in @sdd-method/sdd-cli.",
6
6
  "license": "UNLICENSED",
7
7
  "type": "module",