fix: close what an independent review found in the trial 2 fixes

- The pre-compact hook read only a checkpoint that started with `git commit`,
  so every plan in the new `git add … && git commit` form rebuilt nothing, and
  an empty match also skipped the session-state refresh. It now finds the
  commit anywhere in the span and always refreshes; first test for the hook.
- A sub-bullet that carries its own command stays a criterion (folding it
  left the command unrun); the shallowest bullet sets the base indent.
- Only a MINOR/SUGGESTION /code-review finding outside the range is released
  from forbidding ALLOW: a MAJOR one may be a break cited at an unchanged
  caller.
- `reuse` is an improvement category; the session-spec template stages too;
  a negated bash 3.2 constraint, an env prefix and `bash -c` are handled.
- Stale comment, Declined-to-Judge wording and rule-key counts brought in line.

Tests fail on 7c11c2a first (9 of 24).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-10-08 15:21:56 +02:00
commit b0d96a2d53
Signed by: ktg
SSH key fingerprint: SHA256:JakMjO6FTBBzN0Bhfj9saOoEjaFxlSdYuZQQpM/lF9Q
13 changed files with 194 additions and 54 deletions

View file

@ -164,11 +164,15 @@ function parseSection(markdown, heading, prefix) {
const criteria = [];
const push = (text, command, reason) =>
criteria.push({ label: `${prefix}${criteria.length + 1}`, text, command, reason });
// A bullet indented deeper than the section's first bullet is a sub-point of
// the criterion above it, never a criterion of its own: one criterion with
// ten sub-points became SC4..SC13, each `not-a-command` (voyage-lekerepo
// trial 2, 2026-10-08). The parent counts them in `subpoints`.
let baseIndent = null;
// A bullet indented deeper than the section's shallowest bullet, carrying no
// command of its own, is a sub-point of the criterion above it, never a
// criterion of its own: one criterion with ten sub-points became SC4..SC13,
// each `not-a-command` (voyage-lekerepo trial 2, 2026-10-08). The parent
// counts them in `subpoints`. A sub-bullet that DOES carry a command stays a
// criterion: folding it would leave its command unrun (independent review).
const indentOf = (text) => text.match(/^\s*/)[0].replace(/\t/g, ' ').length;
const bulletIndents = lines.filter((l) => !l.fenced && !l.marker && BULLET.test(l.text)).map((l) => indentOf(l.text));
const baseIndent = bulletIndents.length ? Math.min(...bulletIndents) : 0;
let lastBullet = null;
for (const line of lines) {
if (line.marker) continue;
@ -181,17 +185,16 @@ function parseSection(markdown, heading, prefix) {
}
const bullet = line.text.match(BULLET);
if (!bullet) continue;
const indent = line.text.match(/^\s*/)[0].replace(/\t/g, ' ').length;
if (baseIndent === null) baseIndent = indent;
if (indent > baseIndent && lastBullet) {
lastBullet.subpoints = (lastBullet.subpoints ?? 0) + 1;
continue;
}
const nested = indentOf(line.text) > baseIndent;
const text = bullet[1].trim();
if (text === '') continue;
const { command, reason } = firstCommand(text);
if (nested && lastBullet && !command) {
lastBullet.subpoints = (lastBullet.subpoints ?? 0) + 1;
continue;
}
push(text, command, reason);
lastBullet = criteria[criteria.length - 1];
if (!nested) lastBullet = criteria[criteria.length - 1];
}
return criteria;
}