Skip to content

fix(spec): stop the review page dropping spec text and colliding anchors - #254

Open
atkachenko wants to merge 2 commits into
provectus:mainfrom
atkachenko:claude/great-villani-cbcb87
Open

atkachenko wants to merge 2 commits into
provectus:mainfrom
atkachenko:claude/great-villani-cbcb87

Conversation

@atkachenko

Copy link
Copy Markdown

What

The review page that /awos:spec Step 10 renders (scripts/render-spec.mjs → functional-spec.html) lost content the markdown spec carries. A review of a downstream project that vendors AWOS 1.7.0 found six renderer defects; all six reproduced on main before this change.

Defect Fix
An indented bullet that is not a checkbox was dropped It renders as requirement prose; only the **Acceptance Criteria:** label is skipped
A flat requirement bullet without acceptance criteria disappeared It renders as a card, as a criteria-less ### N.M subsection already did; positional numbering is unchanged
Text before the first requirement was never rendered (flat shape and ### N.M shape) It renders above the first requirement card, including a checkbox written there, which the status bar already counted
Text under the Scope heading, before its subsections, was dropped It renders between the heading and the in/out columns
1.12 and 11.2 both got the card id r112 A two-digit item keeps a dash: 1.12 → r1-12. One-digit items keep rNM
.tabbar button { font: 600 14px/1.4 inherit } is an invalid shorthand, so browsers ignored it font: inherit plus separate weight, size and line-height

commands/spec.md Step 10:

  • The view-model and the artifact fragment now live in one mktemp -d directory per run, and cleanup removes that directory. The old names (${TMPDIR:-/tmp}/spec-view-[index].json) were predictable in shared temp storage, and two runs on the same spec index overwrote and deleted each other's file.
  • The #r21 anchor example now names the #rN-M form for two-digit items.

Reviewer notes

  • Two-digit card ids change: requirement 2.10 was r210 and is now r2-10. Only pages rendered from now on are affected; an existing test that pinned r210 is updated.
  • All added text goes through the script's existing inline() escaping; there is no new output path.
  • The publish offer in Step 10.3 is unchanged. A project-level switch to turn it off is a separate design question.
  • Release label: this is a patch.

Tests

  • tests/render-spec.test.js: seven new tests, one per contract above (plus the lead-in checkbox), on a flat-shaped and a ### N.M-shaped fixture.
  • tests/lint-prompts.test.js: the pin on the old temp path is replaced by pins on the mktemp -d line, the directory cleanup, and the #rN-M wording.
  • npm test and npx prettier . --check pass locally.
  • Not verified: the new Step 10 temp-directory wording was not exercised by a manual /awos:spec run in a scratch project.

🤖 Generated with Claude Code

The review-page renderer (scripts/render-spec.mjs) lost content that the
markdown spec carries, and /awos:spec Step 10 kept its temp files at a
predictable path.

Renderer:
- keep indented non-checkbox bullets as requirement prose (only the
  "Acceptance Criteria:" label is skipped)
- keep a flat requirement bullet that has no acceptance criteria
- keep text written before the first requirement, in the flat shape and
  in the "### N.M" shape, including a checkbox the status bar counts
- keep text under the Scope heading before its subsections
- give two-digit items a dash in the card id (1.12 -> r1-12) so 1.12 and
  11.2 no longer share r112; one-digit items keep the rNM form
- replace the invalid `.tabbar button` font shorthand with valid
  declarations

commands/spec.md Step 10:
- create one `mktemp -d` directory per run for the view-model and the
  artifact fragment, and remove that directory on cleanup
- name the `#rN-M` anchor form next to the `#r21` example

Two-digit card ids change (2.10 was r210, is now r2-10) on pages rendered
from now on.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@barley-github

barley-github Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Barley review of 24746e3 — 🟡 comment · 1 point

Reviewed 4 of 4 changed files.

The change updates the spec renderer and the /awos:spec command's temp-file handling. I kept one low-impact issue in the renderer: checkboxes written directly under the Scope heading are counted in the status bar but never shown. I dropped the mktemp concern as speculative.

Context conflicts

Other findings

  • #1 MINOR scripts/render-spec.mjs:460 — Scope lead-in drops checkboxes that the status bar still counts: render() counts every criteria checkbox in section.body for the status bar (scripts/render-spec.mjs:800-806), including a section with Scope subsections. renderScope renders only the blocks of that body, so a - [ ] written under the Scope heading is counted in "N of M criteria verified" but never shown. The PR's own test on the requirement lead (tests/render-spec.test.js, 'a counted criterion must also be shown') states this must not happen.

Posted by Barley for scenario "AWOS review draft scenario", set up by Maksym Miroshnichenko (MaksymMiroshnichenko)

@barley-github

barley-github Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

Barley re-review of 9fe3dc2 — 🟡 comment · 1 point

Since the last review (24746e3)

0 fixed · 0 discussed · 1 still open · 0 new

Still open

  • #1 scripts/render-spec.mjs:460 Scope lead-in drops checkboxes that the status bar still counts

Full review (the base branch was merged in since the last review). Reviewed 4 of 4 changed files.

The change renders the lead-in text under the Scope heading and adds tests. One low-impact problem is still open. renderScope draws only the blocks of the Scope body, so a checkbox written directly under Scope is counted in the "N of M criteria verified" bar but never shown. The new requirements test already says a counted criterion must also be shown, and Scope has no matching handling. The file has not changed since the last review.

Other findings

  • #1 MINOR scripts/render-spec.mjs:460 — Scope lead-in drops checkboxes that the status bar still counts: renderScope now renders the text before the Scope subsections, but it renders only parseBody(...).blocks, and parseBody puts checkboxes into criteria, not blocks. render() still counts every checkbox in section.body (scripts/render-spec.mjs:801-803), so a - [ ] written under the Scope heading is counted in the 'N of M criteria verified' bar and never shown. The renderLead comment (lines 393-395) says a counted checkbox must be shown, and the new test asserts that for requirements only. The Scope path has no equivalent.

Posted by Barley for scenario "AWOS review draft scenario", set up by Maksym Miroshnichenko (MaksymMiroshnichenko)

@ogalenia

ogalenia commented Dec 2, 2026

Copy link
Copy Markdown

One more defect in scripts/render-spec.mjs that this PR does not cover. A review of a downstream project that vendors AWOS 1.7.0 found it. It is small, so it may fit here; if it is out of scope, say so and I will open a separate issue.

badge() finds the label with SOURCE_LABELS[key] on a plain object. A source named constructor or __proto__ finds an inherited property, so the page shows that value instead of the escaped source name.

scripts/render-spec.mjs:79-84 on main (db031fe), unchanged by this PR:

function badge(src) {
  const key = String(src).toLowerCase();
  const label = SOURCE_LABELS[key] || esc(src);
  const cls = SOURCE_LABELS[key] ? key : 'kb';
  return `<span class="src ${cls}">${label}</span>`;
}

Output of the function from the 1.7.0 file:

src Output
constructor <span class="src constructor">function Object() { [native code] }</span>
__proto__ <span class="src __proto__">[object Object]</span>
toString <span class="src kb">toString</span> (correct, because the key is lowercased first)

The name comes from a sources entry of a decision or a requirement in the view-model, which the model writes. The inserted text has no HTML-special characters, so this is a wrong label and not an injection.

Suggested fix: use Object.hasOwn(SOURCE_LABELS, key) for both lookups, or keep the labels in a Map.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants