Skip to content

CRISPI spec-definition enforcement (trk-13e39042)#86

Merged
shakestzd merged 9 commits intomainfrom
trk-13e39042
May 4, 2026
Merged

CRISPI spec-definition enforcement (trk-13e39042)#86
shakestzd merged 9 commits intomainfrom
trk-13e39042

Conversation

@shakestzd
Copy link
Copy Markdown
Owner

Summary

  • Slice 1 (feat-79f41c6d) — Adopt OpenSpec's MIT-licensed Requirement/Scenario template; add htmlgraph spec generate --insert (non-destructive, refuse-with-diff by default; --force to overwrite); extract workitem.LockFeatureForWrite shared by compliance auto and the new spec writer.
  • Slice 2 (feat-1f0f27de, already on main as 8e90c55d) — Extend parseCriteria to recognise both legacy [ ]/[x] and OpenSpec ### Requirement: formats with first-heading-match scoping; revive the dead [F]/[f] failed status path.
  • Slice 3 (feat-0fd7c8bc) — Add DecisionsNotes slice field; cross-harness htmlgraph plan elicit-decisions CLI; Claude convenience skill htmlgraph:spec-from-slice; opt-in spec_enforcement.{promote_slice,feature_complete} gates with --allow-spec-skip audited override.
  • Roborev job 236 fixes — Preserve <section class="spec"> and <section class="compliance-findings"> across status writes (HIGH); add cross-process flock to LockFeatureForWrite (MED); make planyaml.Save atomic + per-plan mutex (MED); route htmlgraph tdd through parseCriteria so it recognises OpenSpec specs (MED).

Closes the spec-definition gap in CRISPI: 0 of 117 done features previously had a <section class="spec"> block. New plan slices now arrive with structured Requirement/Scenario specs that htmlgraph compliance can parse and compliance auto (OODA track) can grade. Backfill of the existing 117 spec-less features is explicitly out of scope per the plan's non-goals.

Test plan

  • htmlgraph build && go vet ./... && go test ./... — all green
  • New unit tests pass:
    • Slice 1: TestSpecGenerate_OpenSpecFormat, TestSpecGenerate_Insert_NewSection/_NonClobber/_Force/_AtomicAndLocked, TestSpecGenerate_DecisionsRendered/_DecisionsAbsent, TestSpecGenerate_FlagsMutex, TestThirdPartyNotices_HasOpenSpec, TestSpecInsertAndComplianceAutoConcurrent
    • Slice 2: TestParseCriteria_OpenSpecFormat/_LegacyChecks/_FailedStatus/_NoFalsePollution/_StatusFromScenario_*/_HybridDocument, TestComplianceCommand_OpenSpecSpec
    • Slice 3: TestSliceSchema_DecisionsNotesField/_NoDecisionsNotes, TestElicitDecisions_FlagsForm/_StdinForm/_AllEmpty/_AtomicWrite, TestPromoteSliceGate_Disabled/_EnabledNoNotes/_EnabledWithNotes/_AllowSkip, TestFeatureCompleteGate_Disabled/_EnabledNoSpec/_EnabledEmptySpec/_EnabledWithRequirement/_EnabledWithLegacyCriterion
    • Roborev fixes: TestSpecSectionSurvivesStatusWrite (HIGH regression guard), TestTDDExtract_OpenSpecRequirements/_LegacyCheckboxes/_HybridSpec/_EmptySpec/_NoSpecSection
  • Plugin trees regenerated for codex + gemini via htmlgraph plugin build-ports
  • Code review: roborev job 236 (codex) — 4 findings (1 HIGH, 3 MED), all addressed in commit 6cf934dd and review closed
  • Manual: run htmlgraph plan elicit-decisions <plan-id> <slice-num> --scope X --decisions Y --context Z and verify decisions_notes round-trips through plan YAML
  • Manual: run htmlgraph spec generate <feature-id> --insert against an existing feature; verify section appears and --insert without --force refuses on re-run
  • Manual: enable spec_enforcement.feature_complete=true in a project's config.json and confirm htmlgraph feature complete <id> refuses on a feature with no spec section

Notes

  • Default config preserves existing behavior — both gates default to false.
  • DecisionsNotes is free text; the original typed Decisions []SliceDecision was dropped per sonnet HIGH critique (YAGNI).
  • THIRD-PARTY-NOTICES.md added at repo root for the OpenSpec MIT template.
  • The track branch is 2 commits behind main (b39e2945, c05835bc — chore commits in .htmlgraph/); these will merge cleanly.

🤖 Generated with Claude Code

shakestzd added 9 commits May 4, 2026 14:47
- HIGH: WriteNodeHTML now preserves <section class="spec"> and
  <section class="compliance-findings"> across status transitions, so
  marking a feature done no longer deletes its spec or compliance findings.
- MED: LockFeatureForWrite acquires both an in-process mutex and a
  cross-process advisory file lock (syscall.Flock on a sidecar .lock file)
  so concurrent htmlgraph CLI processes can't lose feature HTML updates.
- MED: planyaml.Save is now atomic (temp file + rename) and serialised by
  a per-plan in-process mutex; elicitDecisionsForSlice holds the lock
  across its load → modify → save window via planyaml.SaveLocked.
- MED: htmlgraph tdd extractFromSpecSection routes through parseCriteria,
  unwrapping the <pre> wrapper, so OpenSpec-formatted specs (Requirement /
  Scenario) are recognised in addition to legacy numbered checkboxes.

Adds regression tests:
- TestSpecSectionSurvivesStatusWrite — guards the HIGH fix.
- TestTDDExtract_OpenSpecRequirements / _LegacyCheckboxes / _HybridSpec /
  _EmptySpec / _NoSpecSection — guard the tdd parser switchover.
@shakestzd shakestzd merged commit a38619f into main May 4, 2026
2 checks passed
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.

1 participant