fix
This commit is contained in:
@@ -6,9 +6,10 @@ description: Core protocol for Test Constraints, External Ontology, Graph Noise
|
||||
#region Std.Semantics.Testing [C:5] [TYPE Skill] [SEMANTICS testing,qa,verification,pytest,vitest]
|
||||
@BRIEF HOW to write tests: constraints, external ontology, graph noise reduction, and invariant traceability for pytest and vitest.
|
||||
@RELATION DEPENDS_ON -> [Std.Semantics.Core]
|
||||
@RELATION DEPENDS_ON -> [Std.Semantics.Svelte]
|
||||
@INVARIANT Test modules must trace back to production @INVARIANT tags without flooding the Semantic Graph with orphan nodes.
|
||||
@RATIONALE Test contracts trace to production @INVARIANT/@POST tags via @TEST_INVARIANT, preventing orphan nodes. pytest+vitest dual stack eliminates cross-language tooling overhead. 3-edge-case floor balances coverage sufficiency against graph noise. Hardcoded fixtures block logic-mirror tautology (dominant LLM test-generation failure mode).
|
||||
@REJECTED Property-based testing — non-deterministic input space creates unbounded graph edges, irreducible to fixed-scenario tracing. Snapshot testing — brittle to CSS/UI changes without invariant signal. Integration-only (no unit tests) — coarse graph edges miss localized @INVARIANT violations. Cucumber/Gherkin BDD — DSL layer breaks direct traceability to Python/Svelte @POST anchors.
|
||||
@RATIONALE Test contracts trace to production @INVARIANT/@POST tags via @TEST_INVARIANT, preventing orphan nodes. pytest+vitest dual stack eliminates cross-language tooling overhead. 3-edge-case floor balances coverage sufficiency against graph noise. Hardcoded fixtures block logic-mirror tautology — the dominant LLM test-generation failure mode where the agent re-implements the production algorithm inside the test as `expected = compute(x)`. The test always passes but proves nothing because it's a copy of what it's testing.
|
||||
@REJECTED Property-based testing — non-deterministic input space creates unbounded graph edges, irreducible to fixed-scenario tracing. Snapshot testing — brittle to CSS/UI changes without invariant signal. Integration-only (no unit tests) — coarse graph edges miss localized @INVARIANT violations. Cucumber/Gherkin BDD — DSL layer breaks direct traceability to Python/Svelte @POST anchors. Dynamic expected-value computation — `expected = production_fn(x)` is a tautology, not a test; hardcoded fixtures are the only valid approach.
|
||||
|
||||
## 0. QA RATIONALE (LLM PHYSICS IN TESTING)
|
||||
|
||||
@@ -33,7 +34,7 @@ When writing code or tests that depend on 3rd-party libraries or shared schemas
|
||||
## II. TEST MARKUP ECONOMY (NOISE REDUCTION)
|
||||
|
||||
To prevent overwhelming Semantic Graph, test files operate under relaxed complexity rules:
|
||||
1. **Short IDs:** Test modules MUST use concise IDs (e.g., `TestDashboardMigration`), not full file paths.
|
||||
1. **Short hierarchical IDs:** Test modules use `Test.Domain.Name` format (e.g., `Test.Migration.RunTask`), not full file paths or flat names. This satisfies ATTN_2: the `Test.` prefix groups all tests under HCA 128× while the domain name provides DSA Indexer grouping.
|
||||
2. **Root Binding (`BINDS_TO`):** Do NOT map the internal call graph of a test file. Instead, anchor the entire test suite to the production module using: `@RELATION BINDS_TO -> [TargetModule]`.
|
||||
3. **Complexity 1 for Helpers:** Small test utilities (e.g., `_setup_mock`, `_build_payload`) are **C1**. They require ONLY the anchor pair. No `@BRIEF` or `@RELATION` allowed.
|
||||
4. **Complexity 2 for Tests:** Actual test functions (e.g., `test_unauthorized_access`) are **C2**. They require anchor + `@BRIEF`. Do not add `@PRE`/`@POST` to individual test functions.
|
||||
@@ -71,9 +72,9 @@ backend/tests/
|
||||
|
||||
### Test module template
|
||||
```python
|
||||
# #region TestDashboardMigration [C:3] [TYPE Module] [SEMANTICS test,migration]
|
||||
# #region Test.Migration.RunTask [C:3] [TYPE Module] [SEMANTICS test,migration]
|
||||
# @BRIEF Verify dashboard migration contracts — @POST guarantees and rejected paths.
|
||||
# @RELATION BINDS_TO -> [dashboard_migration]
|
||||
# @RELATION BINDS_TO -> [Migration.RunTask]
|
||||
# @TEST_EDGE: missing_db_mapping -> Migration fails with MappingError
|
||||
# @TEST_EDGE: invalid_dashboard_id -> Migration fails with NotFoundError
|
||||
# @TEST_EDGE: external_api_timeout -> Migration fails with TimeoutError, rolls back
|
||||
|
||||
Reference in New Issue
Block a user