speckit update

This commit is contained in:
2026-03-16 23:55:42 +03:00
parent c957207bce
commit e916cb1f17
2 changed files with 59 additions and 11 deletions

View File

@@ -60,11 +60,18 @@ Create coverage matrix:
Before writing tests, the Tester MUST:
1. **Run `axiom-core.audit_contracts_tool`**: Identify semantic violations.
2. **Emulate Algorithm**: Step through the code implementation in mind.
2. **Run a protocol-shape review on touched files**:
- Reject non-canonical semantic markup, including docstring-only annotations such as `@PURPOSE`, `@PRE`, or `@INVARIANT` written inside class/function docstrings without canonical `[DEF]...[/DEF]` anchors and header metadata.
- Reject files whose effective complexity contract is under-specified relative to [`.ai/standards/semantics.md`](.ai/standards/semantics.md).
- Reject Python Complexity 4+ modules that omit meaningful `logger.reason()` / `logger.reflect()` checkpoints.
- Reject Python Complexity 5 modules that omit `belief_scope(...)`, `@DATA_CONTRACT`, or `@INVARIANT`.
- Treat broken or missing closing anchors as blocking violations.
3. **Emulate Algorithm**: Step through the code implementation in mind.
- Verify it adheres to the `@PURPOSE` and `@INVARIANT`.
- Verify `@PRE` and `@POST` conditions are correctly handled.
3. **Validation Verdict**:
- If audit fails: Emit `[AUDIT_FAIL: reason]` and notify Orchestrator.
4. **Validation Verdict**:
- If audit fails: Emit `[AUDIT_FAIL: semantic_noncompliance]` with concrete file-path reasons and notify Orchestrator.
- Example blocking case: [`backend/src/services/dataset_review/repositories/session_repository.py`](backend/src/services/dataset_review/repositories/session_repository.py) contains a module anchor, but its nested repository class/method semantics are expressed as loose docstrings instead of canonical anchored contracts; this MUST be rejected until remediated or explicitly waived.
- If audit passes: Proceed to writing/verifying tests.
### 5. Write Tests (TDD Approach)
@@ -73,10 +80,13 @@ For each module requiring tests:
1. **Check existing tests**: Scan `__tests__/` for duplicates.
2. **Read TEST_FIXTURE**: If CRITICAL tier, read @TEST_FIXTURE from semantics header.
3. **Write test**: Follow co-location strategy.
3. **Do not normalize broken semantics through tests**:
- The Tester must not write tests that silently accept malformed semantic protocol usage.
- If implementation is semantically invalid, stop and reject instead of adapting tests around the invalid structure.
4. **Write test**: Follow co-location strategy.
- Python: `src/module/__tests__/test_module.py`
- Svelte: `src/lib/components/__tests__/test_component.test.js`
4. **Use mocks**: Use `unittest.mock.MagicMock` for external dependencies
5. **Use mocks**: Use `unittest.mock.MagicMock` for external dependencies
### 4a. UX Contract Testing (Frontend Components)
@@ -173,6 +183,16 @@ Generate test execution report:
- Failed: [X]
- Skipped: [X]
## Semantic Audit Verdict
- Verdict: PASS | FAIL
- Blocking Violations:
- [file path] -> [reason]
- Notes:
- Reject docstring-only semantic pseudo-markup
- Reject complexity/contract mismatches
- Reject missing belief-state instrumentation for Python Complexity 4/5
## Issues Found
| Test | Error | Resolution |
@@ -182,6 +202,7 @@ Generate test execution report:
## Next Steps
- [ ] Fix failed tests
- [ ] Fix blocking semantic violations before acceptance
- [ ] Add more coverage for [module]
- [ ] Review TEST_FIXTURE fixtures
```