Skip to content

Commit 2fb42c3

Browse files
committed
Introduce criticality levels for specs
1 parent 8ffa2a2 commit 2fb42c3

File tree

5 files changed

+200
-2
lines changed

5 files changed

+200
-2
lines changed

AGENTS.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,45 @@ class DescriptiveTest extends TestCase
176176
specs/[group]/[component].yaml → tests/PHPUnit/Unit/[Group]/[Component]/[SpecificBehavior]Test.php
177177
```
178178

179+
### Spec Criticality Levels
180+
181+
Every spec includes a `criticality` field classifying its importance:
182+
183+
| Level | Breaking Impact | Use For | Examples |
184+
|-------|----------------|---------|----------|
185+
| **contract** | HIGH - Major version | Public API, behavioral guarantees users depend on | `Region.trigger()`, `Guard signature`, `ChainMail.get()` |
186+
| **constraint** | MEDIUM - May cause bugs | Critical internal behavior, safety mechanisms | Execution order, validation, immutability |
187+
| **detail** | LOW - Can change freely | Implementation choices, optimizations | Lazy loading, default conventions, strict equality |
188+
189+
**Criticality in YAML:**
190+
```yaml
191+
specs:
192+
- acceptanceCriteria: A region tracks its current state
193+
criticality: contract # Public API - users depend on this
194+
intent: Provides runtime visibility into state
195+
test: vendor/bin/phpunit tests/.../CurrentStateTrackingTest.php
196+
197+
- acceptanceCriteria: Transition chain is not invoked when state unchanged
198+
criticality: constraint # Internal correctness requirement
199+
intent: Optimizes performance and prevents unnecessary processing
200+
test: vendor/bin/phpunit tests/.../NoTransitionOnSameStateTest.php
201+
202+
- acceptanceCriteria: Built region uses first state as initial when none marked
203+
criticality: detail # Default convention - could change
204+
intent: Provides sensible default behavior
205+
test: vendor/bin/phpunit tests/.../DefaultInitialStateTest.php
206+
```
207+
208+
**Usage Guidelines:**
209+
- **contract**: Changes require user approval + major version bump. Maximize test coverage.
210+
- **constraint**: Changes need careful review. Breaking = subtle bugs or security issues.
211+
- **detail**: Can evolve freely as long as contract holds. Focus on implementation quality.
212+
213+
**Current Distribution** (97 total specs):
214+
- contract: 60 (62%) - Most specs define public API
215+
- constraint: 25 (26%) - Internal correctness & safety
216+
- detail: 12 (12%) - Performance & defaults
217+
179218
---
180219
181220
[comment]:# (Project Architecture: High-level overview with inline patterns. Not exhaustive - just enough to navigate.)
@@ -371,6 +410,7 @@ The TransitionsFeature spec (`specs/features/transitions.yaml`) is organized int
371410
372411
Before closing any task:
373412
- [ ] All acceptance criteria current and accurate
413+
- [ ] Every spec has a `criticality` field (contract/constraint/detail)
374414
- [ ] No duplicate or overlapping specs
375415
- [ ] Every spec has corresponding test class
376416
- [ ] Every test class has corresponding spec

0 commit comments

Comments
 (0)