atdd 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (183) hide show
  1. atdd/__init__.py +0 -0
  2. atdd/cli.py +404 -0
  3. atdd/coach/__init__.py +0 -0
  4. atdd/coach/commands/__init__.py +0 -0
  5. atdd/coach/commands/add_persistence_metadata.py +215 -0
  6. atdd/coach/commands/analyze_migrations.py +188 -0
  7. atdd/coach/commands/consumers.py +720 -0
  8. atdd/coach/commands/infer_governance_status.py +149 -0
  9. atdd/coach/commands/initializer.py +177 -0
  10. atdd/coach/commands/interface.py +1078 -0
  11. atdd/coach/commands/inventory.py +565 -0
  12. atdd/coach/commands/migration.py +240 -0
  13. atdd/coach/commands/registry.py +1560 -0
  14. atdd/coach/commands/session.py +430 -0
  15. atdd/coach/commands/sync.py +405 -0
  16. atdd/coach/commands/test_interface.py +399 -0
  17. atdd/coach/commands/test_runner.py +141 -0
  18. atdd/coach/commands/tests/__init__.py +1 -0
  19. atdd/coach/commands/tests/test_telemetry_array_validation.py +235 -0
  20. atdd/coach/commands/traceability.py +4264 -0
  21. atdd/coach/conventions/session.convention.yaml +754 -0
  22. atdd/coach/overlays/__init__.py +2 -0
  23. atdd/coach/overlays/claude.md +2 -0
  24. atdd/coach/schemas/config.schema.json +34 -0
  25. atdd/coach/schemas/manifest.schema.json +101 -0
  26. atdd/coach/templates/ATDD.md +282 -0
  27. atdd/coach/templates/SESSION-TEMPLATE.md +327 -0
  28. atdd/coach/utils/__init__.py +0 -0
  29. atdd/coach/utils/graph/__init__.py +0 -0
  30. atdd/coach/utils/graph/urn.py +875 -0
  31. atdd/coach/validators/__init__.py +0 -0
  32. atdd/coach/validators/shared_fixtures.py +365 -0
  33. atdd/coach/validators/test_enrich_wagon_registry.py +167 -0
  34. atdd/coach/validators/test_registry.py +575 -0
  35. atdd/coach/validators/test_session_validation.py +1183 -0
  36. atdd/coach/validators/test_traceability.py +448 -0
  37. atdd/coach/validators/test_update_feature_paths.py +108 -0
  38. atdd/coach/validators/test_validate_contract_consumers.py +297 -0
  39. atdd/coder/__init__.py +1 -0
  40. atdd/coder/conventions/adapter.recipe.yaml +88 -0
  41. atdd/coder/conventions/backend.convention.yaml +460 -0
  42. atdd/coder/conventions/boundaries.convention.yaml +666 -0
  43. atdd/coder/conventions/commons.convention.yaml +460 -0
  44. atdd/coder/conventions/complexity.recipe.yaml +109 -0
  45. atdd/coder/conventions/component-naming.convention.yaml +178 -0
  46. atdd/coder/conventions/design.convention.yaml +327 -0
  47. atdd/coder/conventions/design.recipe.yaml +273 -0
  48. atdd/coder/conventions/dto.convention.yaml +660 -0
  49. atdd/coder/conventions/frontend.convention.yaml +542 -0
  50. atdd/coder/conventions/green.convention.yaml +1012 -0
  51. atdd/coder/conventions/presentation.convention.yaml +587 -0
  52. atdd/coder/conventions/refactor.convention.yaml +535 -0
  53. atdd/coder/conventions/technology.convention.yaml +206 -0
  54. atdd/coder/conventions/tests/__init__.py +0 -0
  55. atdd/coder/conventions/tests/test_adapter_recipe.py +302 -0
  56. atdd/coder/conventions/tests/test_complexity_recipe.py +289 -0
  57. atdd/coder/conventions/tests/test_component_taxonomy.py +278 -0
  58. atdd/coder/conventions/tests/test_component_urn_naming.py +165 -0
  59. atdd/coder/conventions/tests/test_thinness_recipe.py +286 -0
  60. atdd/coder/conventions/thinness.recipe.yaml +82 -0
  61. atdd/coder/conventions/train.convention.yaml +325 -0
  62. atdd/coder/conventions/verification.protocol.yaml +53 -0
  63. atdd/coder/schemas/design_system.schema.json +361 -0
  64. atdd/coder/validators/__init__.py +0 -0
  65. atdd/coder/validators/test_commons_structure.py +485 -0
  66. atdd/coder/validators/test_complexity.py +416 -0
  67. atdd/coder/validators/test_cross_language_consistency.py +431 -0
  68. atdd/coder/validators/test_design_system_compliance.py +413 -0
  69. atdd/coder/validators/test_dto_testing_patterns.py +268 -0
  70. atdd/coder/validators/test_green_cross_stack_layers.py +168 -0
  71. atdd/coder/validators/test_green_layer_dependencies.py +148 -0
  72. atdd/coder/validators/test_green_python_layer_structure.py +103 -0
  73. atdd/coder/validators/test_green_supabase_layer_structure.py +103 -0
  74. atdd/coder/validators/test_import_boundaries.py +396 -0
  75. atdd/coder/validators/test_init_file_urns.py +593 -0
  76. atdd/coder/validators/test_preact_layer_boundaries.py +221 -0
  77. atdd/coder/validators/test_presentation_convention.py +260 -0
  78. atdd/coder/validators/test_python_architecture.py +674 -0
  79. atdd/coder/validators/test_quality_metrics.py +420 -0
  80. atdd/coder/validators/test_station_master_pattern.py +244 -0
  81. atdd/coder/validators/test_train_infrastructure.py +454 -0
  82. atdd/coder/validators/test_train_urns.py +293 -0
  83. atdd/coder/validators/test_typescript_architecture.py +616 -0
  84. atdd/coder/validators/test_usecase_structure.py +421 -0
  85. atdd/coder/validators/test_wagon_boundaries.py +586 -0
  86. atdd/conftest.py +126 -0
  87. atdd/planner/__init__.py +1 -0
  88. atdd/planner/conventions/acceptance.convention.yaml +538 -0
  89. atdd/planner/conventions/appendix.convention.yaml +187 -0
  90. atdd/planner/conventions/artifact-naming.convention.yaml +852 -0
  91. atdd/planner/conventions/component.convention.yaml +670 -0
  92. atdd/planner/conventions/criteria.convention.yaml +141 -0
  93. atdd/planner/conventions/feature.convention.yaml +371 -0
  94. atdd/planner/conventions/interface.convention.yaml +382 -0
  95. atdd/planner/conventions/steps.convention.yaml +141 -0
  96. atdd/planner/conventions/train.convention.yaml +552 -0
  97. atdd/planner/conventions/wagon.convention.yaml +275 -0
  98. atdd/planner/conventions/wmbt.convention.yaml +258 -0
  99. atdd/planner/schemas/acceptance.schema.json +336 -0
  100. atdd/planner/schemas/appendix.schema.json +78 -0
  101. atdd/planner/schemas/component.schema.json +114 -0
  102. atdd/planner/schemas/feature.schema.json +197 -0
  103. atdd/planner/schemas/train.schema.json +192 -0
  104. atdd/planner/schemas/wagon.schema.json +281 -0
  105. atdd/planner/schemas/wmbt.schema.json +59 -0
  106. atdd/planner/validators/__init__.py +0 -0
  107. atdd/planner/validators/conftest.py +5 -0
  108. atdd/planner/validators/test_draft_wagon_registry.py +374 -0
  109. atdd/planner/validators/test_plan_cross_refs.py +240 -0
  110. atdd/planner/validators/test_plan_uniqueness.py +224 -0
  111. atdd/planner/validators/test_plan_urn_resolution.py +268 -0
  112. atdd/planner/validators/test_plan_wagons.py +174 -0
  113. atdd/planner/validators/test_train_validation.py +514 -0
  114. atdd/planner/validators/test_wagon_urn_chain.py +648 -0
  115. atdd/planner/validators/test_wmbt_consistency.py +327 -0
  116. atdd/planner/validators/test_wmbt_vocabulary.py +632 -0
  117. atdd/tester/__init__.py +1 -0
  118. atdd/tester/conventions/artifact.convention.yaml +257 -0
  119. atdd/tester/conventions/contract.convention.yaml +1009 -0
  120. atdd/tester/conventions/filename.convention.yaml +555 -0
  121. atdd/tester/conventions/migration.convention.yaml +509 -0
  122. atdd/tester/conventions/red.convention.yaml +797 -0
  123. atdd/tester/conventions/routing.convention.yaml +51 -0
  124. atdd/tester/conventions/telemetry.convention.yaml +458 -0
  125. atdd/tester/schemas/a11y.tmpl.json +17 -0
  126. atdd/tester/schemas/artifact.schema.json +189 -0
  127. atdd/tester/schemas/contract.schema.json +591 -0
  128. atdd/tester/schemas/contract.tmpl.json +95 -0
  129. atdd/tester/schemas/db.tmpl.json +20 -0
  130. atdd/tester/schemas/e2e.tmpl.json +17 -0
  131. atdd/tester/schemas/edge_function.tmpl.json +17 -0
  132. atdd/tester/schemas/event.tmpl.json +17 -0
  133. atdd/tester/schemas/http.tmpl.json +19 -0
  134. atdd/tester/schemas/job.tmpl.json +18 -0
  135. atdd/tester/schemas/load.tmpl.json +21 -0
  136. atdd/tester/schemas/metric.tmpl.json +19 -0
  137. atdd/tester/schemas/pack.schema.json +139 -0
  138. atdd/tester/schemas/realtime.tmpl.json +20 -0
  139. atdd/tester/schemas/rls.tmpl.json +18 -0
  140. atdd/tester/schemas/script.tmpl.json +16 -0
  141. atdd/tester/schemas/sec.tmpl.json +18 -0
  142. atdd/tester/schemas/storage.tmpl.json +18 -0
  143. atdd/tester/schemas/telemetry.schema.json +128 -0
  144. atdd/tester/schemas/telemetry_tracking_manifest.schema.json +143 -0
  145. atdd/tester/schemas/test_filename.schema.json +194 -0
  146. atdd/tester/schemas/test_intent.schema.json +179 -0
  147. atdd/tester/schemas/unit.tmpl.json +18 -0
  148. atdd/tester/schemas/visual.tmpl.json +18 -0
  149. atdd/tester/schemas/ws.tmpl.json +17 -0
  150. atdd/tester/utils/__init__.py +0 -0
  151. atdd/tester/utils/filename.py +300 -0
  152. atdd/tester/validators/__init__.py +0 -0
  153. atdd/tester/validators/cleanup_duplicate_headers.py +116 -0
  154. atdd/tester/validators/cleanup_duplicate_headers_v2.py +135 -0
  155. atdd/tester/validators/conftest.py +5 -0
  156. atdd/tester/validators/coverage_gap_report.py +321 -0
  157. atdd/tester/validators/fix_dual_ac_references.py +179 -0
  158. atdd/tester/validators/remove_duplicate_lines.py +93 -0
  159. atdd/tester/validators/test_acceptance_urn_filename_mapping.py +359 -0
  160. atdd/tester/validators/test_acceptance_urn_separator.py +166 -0
  161. atdd/tester/validators/test_artifact_naming_category.py +307 -0
  162. atdd/tester/validators/test_contract_schema_compliance.py +706 -0
  163. atdd/tester/validators/test_contracts_structure.py +200 -0
  164. atdd/tester/validators/test_coverage_adequacy.py +797 -0
  165. atdd/tester/validators/test_dual_ac_reference.py +225 -0
  166. atdd/tester/validators/test_fixture_validity.py +372 -0
  167. atdd/tester/validators/test_isolation.py +487 -0
  168. atdd/tester/validators/test_migration_coverage.py +204 -0
  169. atdd/tester/validators/test_migration_criteria.py +276 -0
  170. atdd/tester/validators/test_migration_generation.py +116 -0
  171. atdd/tester/validators/test_python_test_naming.py +410 -0
  172. atdd/tester/validators/test_red_layer_validation.py +95 -0
  173. atdd/tester/validators/test_red_python_layer_structure.py +87 -0
  174. atdd/tester/validators/test_red_supabase_layer_structure.py +90 -0
  175. atdd/tester/validators/test_telemetry_structure.py +634 -0
  176. atdd/tester/validators/test_typescript_test_naming.py +301 -0
  177. atdd/tester/validators/test_typescript_test_structure.py +84 -0
  178. atdd-0.1.0.dist-info/METADATA +191 -0
  179. atdd-0.1.0.dist-info/RECORD +183 -0
  180. atdd-0.1.0.dist-info/WHEEL +5 -0
  181. atdd-0.1.0.dist-info/entry_points.txt +2 -0
  182. atdd-0.1.0.dist-info/licenses/LICENSE +674 -0
  183. atdd-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,797 @@
1
+ version: "1.0"
2
+ name: "Neurosymbolic RED Test Generation Convention"
3
+ description: "Deterministic intent extraction + bounded agent rendering + multi-level validation"
4
+
5
+ # Core Architecture
6
+ architecture:
7
+ phases:
8
+ symbolic:
9
+ description: "Deterministic extraction and classification"
10
+ utils: ["harness", "detect", "intent"]
11
+ deterministic: true
12
+
13
+ neural:
14
+ description: "Agent-based code rendering"
15
+ utils: ["render"]
16
+ deterministic: false
17
+ bounded: true
18
+
19
+ validation:
20
+ description: "Multi-level correctness verification"
21
+ utils: ["valid", "red"]
22
+ deterministic: true
23
+
24
+ # Harness Classification (Deterministic)
25
+ harness_classification:
26
+ frontend:
27
+ harnesses: ["unit", "widget", "e2e", "a11y", "visual", "golden", "bloc", "integration"]
28
+ default_language: "dart"
29
+ framework: "flutter_test"
30
+
31
+ backend:
32
+ harnesses: ["http", "db", "rls", "event", "ws", "edge_function", "realtime", "storage"]
33
+ default_language: "typescript"
34
+ framework: "vitest"
35
+
36
+ integration:
37
+ harnesses: ["metric", "job", "load", "sec", "script"]
38
+ language: "context_dependent"
39
+
40
+ # Language Detection Rules (Deterministic)
41
+ language_detection:
42
+ priority_order:
43
+ 1_explicit: "wagon.yaml runtime field"
44
+ 2_structure: "directory patterns"
45
+ 3_route: "layer hints"
46
+ 4_harness: "category defaults"
47
+
48
+ directory_patterns:
49
+ dart: ["lib/${wagon}/", "test/${wagon}/"]
50
+ typescript: ["supabase/functions/${wagon}/", "web/src/${wagon}/", "web/tests/${wagon}/", "src/${wagon}/"]
51
+ python: ["${wagon}/__init__.py", "tests/${wagon}/"]
52
+ go: ["cmd/${wagon}/", "pkg/${wagon}/"]
53
+
54
+ # Runtime Placement Decision (Deterministic)
55
+ runtime_placement:
56
+ principle: "Test path determines implementation runtime"
57
+ rationale: "Tester creates RED test first → path signals Python or Supabase → Coder follows"
58
+
59
+ decision_criteria:
60
+ supabase:
61
+ indicators:
62
+ - "Auth & identity verification"
63
+ - "Session lifecycle management"
64
+ - "Database CRUD operations"
65
+ - "Real-time subscriptions"
66
+ - "Row-level security enforcement"
67
+ - "API gateway/routing"
68
+ - "Client-proximity real-time logic"
69
+ runtime: "typescript"
70
+ test_path_pattern: "supabase/functions/{wagon}/{feature}/tests/{layer}/"
71
+ src_path_pattern: "supabase/functions/{wagon}/{feature}/{layer}/"
72
+ note: "Supabase functions have no 'src' directory - layers are direct children"
73
+
74
+ python:
75
+ indicators:
76
+ - "Game mechanics computation"
77
+ - "AI/ML processing"
78
+ - "Graph algorithms"
79
+ - "Domain impact calculations"
80
+ - "Analytics aggregation"
81
+ - "Scenario processing"
82
+ - "Business rule evaluation"
83
+ - "Stateful algorithms"
84
+ runtime: "python"
85
+ test_path_pattern: "python/{wagon}/{feature}/tests/{layer}/"
86
+ src_path_pattern: "python/{wagon}/{feature}/src/{layer}/"
87
+ note: "Python uses explicit 'src' directory for implementation"
88
+
89
+ workflow:
90
+ 1_analyze: "Read feature URN + acceptance criteria"
91
+ 2_classify: "Apply decision_criteria indicators"
92
+ 3_select_runtime: "Choose python or supabase based on indicators"
93
+ 4_select_path: "Use corresponding test_path_pattern"
94
+ 5_create_test: "Generate RED test at selected path with layer directory"
95
+ 6_document: "Add placement rationale in test header comment"
96
+
97
+ header_documentation:
98
+ required: true
99
+ format: |
100
+ # Runtime: {python|supabase|dart}
101
+ # Rationale: {brief explanation based on decision_criteria}
102
+ # URN: {full acceptance criteria URN}
103
+ # Phase: {RED|GREEN|REFACTOR}
104
+ # Purpose: {acceptance criteria purpose}
105
+ """
106
+ RED Test for {full acceptance criteria URN}
107
+ wagon: {wagon-slug} | feature: {feature-slug} | phase: {RED|GREEN|REFACTOR}
108
+ WMBT: {wmbt URN}
109
+ Purpose: {acceptance criteria purpose}
110
+ """
111
+ validation:
112
+ dual_reference_required: true
113
+ rationale: "Header comment for machine parsing, docstring for human readability"
114
+ enforcement: "Both MUST contain identical AC URN for redundancy and validation"
115
+ examples:
116
+ python: |
117
+ # Runtime: python
118
+ # Rationale: Game mechanics - stateful timebank depletion algorithm
119
+ # URN: acc:burn-timebank:E001-UNIT-001
120
+ # Phase: GREEN
121
+ # Purpose: Verify timebank decrements during active decision
122
+ """
123
+ RED Test for acc:burn-timebank:E001-UNIT-001
124
+ wagon: burn-timebank | feature: burn-time | phase: GREEN
125
+ WMBT: wmbt:burn-timebank:E001
126
+ Purpose: Verify timebank decrements during active decision
127
+ """
128
+ supabase: |
129
+ # Runtime: supabase
130
+ # Rationale: Auth verification - database-centric
131
+ # URN: acc:authenticate-identity:C001-UNIT-001
132
+ # Phase: RED
133
+ # Purpose: Verify valid credentials are accepted
134
+ """
135
+ RED Test for acc:authenticate-identity:C001-UNIT-001
136
+ wagon: authenticate-identity | feature: sign-in | phase: RED
137
+ WMBT: wmbt:authenticate-identity:C001
138
+ Purpose: Verify valid credentials are accepted
139
+ """
140
+
141
+ additional_runtimes:
142
+ dart:
143
+ indicators:
144
+ - "Flutter widgets and UI components"
145
+ - "Mobile application logic"
146
+ - "Client-side state management"
147
+ - "BLoC/Cubit patterns"
148
+ runtime: "dart"
149
+ test_path_pattern: "test/{wagon}/{feature}/{layer}/"
150
+ src_path_pattern: "lib/{wagon}/{feature}/{layer}/"
151
+ note: "Dart uses lib/ for implementation (no src/ subdirectory)"
152
+
153
+ preact:
154
+ indicators:
155
+ - "Web UI components and pages"
156
+ - "Browser-based frontend logic"
157
+ - "Preact/React patterns"
158
+ - "Client-side web application"
159
+ runtime: "typescript"
160
+ test_path_pattern: "web/tests/{wagon}/{feature}/{layer}/"
161
+ src_path_pattern: "web/src/{wagon}/{feature}/{layer}/"
162
+ framework: "vitest + @testing-library/preact"
163
+ file_extensions: [".test.ts", ".test.tsx"]
164
+ note: "Preact uses web/ directory; .tsx for component tests, .ts for logic tests"
165
+
166
+ declaration_artifacts:
167
+ description: "Artifacts that ARE the deliverable (not executable code)"
168
+
169
+ contract:
170
+ description: "Schema definitions for data contracts"
171
+ artifact_pattern: "contracts/{theme}/{domain}/{aspect}/*.schema.json"
172
+ validation: "Centralized in atdd/tester/validators/test_contract_schema_compliance.py"
173
+ validation_type: "Platform meta-validation (infrastructure)"
174
+ no_colocated_tests: "Validators are centralized, not co-located"
175
+ validation_focus: "Schema correctness, naming conventions, required fields"
176
+ note: "1 artifact = 1 producer; theme/domain/aspect mirrors exactly"
177
+ examples:
178
+ - artifact: "contracts/match/dilemma/current.schema.json"
179
+ test: "atdd/tester/validators/test_contract_schema_compliance.py"
180
+ - artifact: "contracts/commons/ux/foundations.schema.json"
181
+ test: "atdd/tester/validators/test_contract_schema_compliance.py"
182
+
183
+ telemetry:
184
+ description: "Observability signal definitions (metrics, events, traces)"
185
+ artifact_pattern: "telemetry/{theme}/{domain}/{aspect}.{type}.{plane}[.{measure}].json"
186
+ validation: "Centralized in atdd/tester/validators/test_telemetry_structure.py"
187
+ validation_type: "Platform meta-validation (infrastructure)"
188
+ no_colocated_tests: "Validators are centralized, not co-located"
189
+ validation_focus: "Signal validity, contract references, naming conventions"
190
+ note: "Mirrors contracts/ exactly - aspect is filename prefix, not folder"
191
+ structure_comparison:
192
+ contracts: "contracts/{theme}/{domain}/{aspect}.schema.json"
193
+ telemetry: "telemetry/{theme}/{domain}/{aspect}.{type}.{plane}[.{measure}].json"
194
+ signal_naming:
195
+ metric: "{aspect}.metric.{plane}.{measure}.json"
196
+ event: "{aspect}.event.{plane}.json"
197
+ examples:
198
+ - artifact: "telemetry/match/dilemma/current.metric.be.selection-duration.json"
199
+ test: "atdd/tester/validators/test_telemetry_structure.py"
200
+ - artifact: "telemetry/commons/ux/foundations.metric.nw.latency.json"
201
+ test: "atdd/tester/validators/test_telemetry_structure.py"
202
+ - artifact: "telemetry/match/dilemma/paired.metric.be.pairing-duration.json"
203
+ test: "atdd/tester/validators/test_telemetry_structure.py"
204
+
205
+ enforcement:
206
+ tester:
207
+ - "MUST classify artifact type: implementation OR declaration"
208
+ - "For implementations: classify runtime (python/supabase/dart)"
209
+ - "For declarations: identify artifact type (contract/telemetry)"
210
+ - "MUST document rationale in test header"
211
+ - "For declarations: validation is centralized in atdd/tester/audits"
212
+ - "Do NOT create co-located tests directories for contracts/telemetry"
213
+
214
+ coder:
215
+ - "MUST read test location to infer runtime/artifact type"
216
+ - "For implementations: implement at corresponding src_path_pattern"
217
+ - "For declarations: create artifact at corresponding artifact_pattern"
218
+ - "NEVER create implementation without existing test"
219
+ - "MUST validate test path matches runtime convention"
220
+ - "For declarations: rely on platform audits (no co-located tests)"
221
+
222
+ # Test Intent Schema (Deterministic)
223
+ intent_structure:
224
+ required_fields:
225
+ - identity: {urn, id, phase}
226
+ - harness: {type, category}
227
+ - given: {auth, data, environment}
228
+ - when: {action, target, parameters}
229
+ - then: {assertions, red_strategy}
230
+ - metadata: {wagon, feature, route}
231
+ - contract_schema: {schema_ref, version}
232
+
233
+ action_mapping:
234
+ http: "request"
235
+ unit: "invoke"
236
+ event: "emit"
237
+ ws: "connect"
238
+ e2e: "navigate"
239
+ db: "query"
240
+ metric: "measure"
241
+
242
+ # Agent Rendering Constraints (Bounded)
243
+ agent_constraints:
244
+ prompt_structure:
245
+ required_elements:
246
+ - "Use ${language} with ${framework}"
247
+ - "Test MUST fail (RED state)"
248
+ - "Include URN comment"
249
+ - "Structure as Given/When/Then"
250
+ - "Validate I/O against contract schema"
251
+ - "Assert schema compliance as primary assertion"
252
+
253
+ forbidden_patterns:
254
+ - "Console.log (except structured output)"
255
+ - "Commented code blocks"
256
+ - "TODO markers (except RED)"
257
+
258
+ timeout: 5000
259
+ temperature: 0.1
260
+ max_retries: 2
261
+
262
+ # Validation Pipeline (Deterministic)
263
+ validation_levels:
264
+ 1_syntax:
265
+ description: "Code can be parsed"
266
+ tools:
267
+ dart: "dart analyze"
268
+ typescript: "tsc --noEmit"
269
+ python: "python -m py_compile"
270
+ go: "go fmt"
271
+
272
+ 2_structure:
273
+ description: "Has required elements"
274
+ checks:
275
+ - "Test declaration present"
276
+ - "URN referenced"
277
+ - "Assertions exist"
278
+ - "RED marker present"
279
+
280
+ 3_semantic:
281
+ description: "Maps to intent"
282
+ checks:
283
+ - "Assertion count matches"
284
+ - "Action type correct"
285
+ - "Given setup present"
286
+
287
+ 4_behavioral:
288
+ description: "Actually fails"
289
+ verification: "Execute test, expect non-zero exit"
290
+
291
+ 5_contract_schema:
292
+ description: "Contract schema validation present"
293
+ checks:
294
+ - "Schema file exists at path"
295
+ - "Schema is JSON Schema Draft-07"
296
+ - "Test includes schema validation assertion"
297
+
298
+ # RED State Enforcement (Deterministic)
299
+ red_patterns:
300
+ dart:
301
+ fail: "fail('Not implemented: ${URN}');"
302
+ expect_false: "expect(false, isTrue);"
303
+ throw: "throw UnimplementedError('${URN}');"
304
+
305
+ typescript:
306
+ fail: "throw new Error('Not implemented: ${URN}');"
307
+ expect_false: "expect(false).toBe(true);"
308
+ reject: "return Promise.reject(new Error('${URN}'));"
309
+
310
+ python:
311
+ fail: "assert False, 'Not implemented: ${URN}'"
312
+ pytest_fail: "pytest.fail('${URN}')"
313
+ raise: "raise NotImplementedError('${URN}')"
314
+
315
+ go:
316
+ fail: "t.Fatal('Not implemented: ${URN}')"
317
+ error: "t.Errorf('${URN}')"
318
+ panic: "panic('${URN}')"
319
+
320
+ # Contract Schema Validation
321
+ contract_schema_validation:
322
+ principle: "Schemas are single source of truth for data contracts"
323
+ rationale: |
324
+ ATDD flow: Planner → Tester (schemas + RED tests) → Coder (comply to GREEN)
325
+ Tests enforce contract compliance at architecture boundaries
326
+
327
+ architecture_scope:
328
+ - backend: "API responses, DB artifacts, event payloads"
329
+ - frontend: "Widget inputs/outputs, state management"
330
+ - integration: "External API contracts, message formats"
331
+
332
+ schema_sources:
333
+ priority_1: "acceptance.contract field (explicit reference)"
334
+ priority_2: "wagon I/O pack manifest lookup"
335
+ priority_3: "contract pack schemas"
336
+
337
+ test_requirements:
338
+ schema_loading:
339
+ dart: "final schema = await rootBundle.loadString('contracts/domain/resource.json');"
340
+ typescript: "import schema from '../../contracts/domain/resource.json' assert { type: 'json' };"
341
+ python: "with open('contracts/domain/resource.json') as f: schema = json.load(f)"
342
+
343
+ schema_assertion:
344
+ requirement: "MANDATORY for external I/O"
345
+ priority: "first assertion (before business logic)"
346
+ examples:
347
+ dart: "expect(() => validate(result, schema), returnsNormally);"
348
+ typescript: "expect(ajv.validate(schema, response.body)).toBe(true);"
349
+ python: "jsonschema.validate(instance=result, schema=schema)"
350
+ failure_message: "Include field violations in error message"
351
+
352
+ harness_specific_validation:
353
+ http: "Validate response body against output schema"
354
+ unit: "Validate return value and args against schemas"
355
+ event: "Validate payload against event schema"
356
+ db: "Validate persisted artifact against artifact schema"
357
+ ws: "Validate messages against protocol schema"
358
+ widget: "Validate widget props against component schema"
359
+
360
+ cross_layer_enforcement:
361
+ tests:
362
+ role: "Primary enforcement"
363
+ requirement: "MUST validate against contract schemas"
364
+ implementation:
365
+ role: "Satisfy contracts"
366
+ requirement: "Code must pass schema validation tests"
367
+ ci_cd:
368
+ role: "Continuous validation"
369
+ requirement: "Block merges on schema validation failures"
370
+
371
+ validation_hierarchy:
372
+ level_1: "Schema file exists at expected path"
373
+ level_2: "Schema is valid JSON Schema Draft-07"
374
+ level_3: "I/O data validates against schema"
375
+ level_4: "Version matches acceptance expectation"
376
+
377
+ # 4-Layer Test Structure
378
+ test_structure:
379
+ description: "Tests mirror source code 4-layer architecture"
380
+ principle: "Tests are organized by architectural layer to enforce boundaries"
381
+
382
+ layers:
383
+ - presentation
384
+ - application
385
+ - domain
386
+ - integration
387
+
388
+ python:
389
+ layers: [presentation, application, domain, integration]
390
+ test_path_pattern: "python/{wagon}/{feature}/tests/{layer}/"
391
+ file_naming: "test_{component}.py"
392
+ auto_create_directories: true
393
+
394
+ layer_mapping:
395
+ presentation: ["controller", "handler", "cli", "api"]
396
+ application: ["use_case", "service", "workflow"]
397
+ domain: ["entity", "value_object", "business_rule"]
398
+ integration: ["repository", "client", "adapter"]
399
+
400
+ validation:
401
+ require_layer_directory: true
402
+ enforce_layer_structure: true
403
+ error_messages:
404
+ missing_layer: "Test file must be in a layer directory: {expected_path}"
405
+ wrong_layer: "Test for {component_type} should be in {expected_layer} layer"
406
+
407
+ dart:
408
+ layers: [presentation, application, domain, integration]
409
+ test_path_pattern: "test/{wagon}/{feature}/{layer}/"
410
+ file_naming: "{component}_test.dart"
411
+ auto_create_directories: true
412
+
413
+ layer_mapping:
414
+ presentation: ["widget", "screen", "page", "controller", "bloc", "cubit"]
415
+ application: ["use_case", "viewmodel", "interactor"]
416
+ domain: ["model", "entity", "value_object"]
417
+ integration: ["repository", "api_client", "data_source"]
418
+
419
+ validation:
420
+ require_layer_directory: true
421
+ enforce_layer_structure: true
422
+ error_messages:
423
+ missing_layer: "Test file must be in a layer directory: {expected_path}"
424
+ wrong_layer: "Test for {component_type} should be in {expected_layer} layer"
425
+
426
+ flutter:
427
+ layers: [presentation, application, domain, integration]
428
+ test_path_pattern: "test/{wagon}/{feature}/{layer}/"
429
+ file_naming: "{component}_test.dart"
430
+ auto_create_directories: true
431
+
432
+ layer_mapping:
433
+ presentation: ["widget", "screen", "page", "controller", "bloc", "cubit"]
434
+ application: ["use_case", "viewmodel", "interactor"]
435
+ domain: ["model", "entity", "value_object"]
436
+ integration: ["repository", "api_client", "data_source"]
437
+
438
+ validation:
439
+ require_layer_directory: true
440
+ enforce_layer_structure: true
441
+
442
+ preact:
443
+ layers: [presentation, application, domain, integration]
444
+ test_path_pattern: "web/tests/{wagon}/{feature}/{layer}/"
445
+ file_naming: "{WMBT}_{HARNESS}_{NNN}[_{slug_snake}].test.ts[x]"
446
+ auto_create_directories: true
447
+
448
+ layer_mapping:
449
+ presentation: ["component", "page", "view", "hook"]
450
+ application: ["use_case", "service", "port"]
451
+ domain: ["entity", "value_object", "service"]
452
+ integration: ["repository", "client", "mapper"]
453
+
454
+ validation:
455
+ require_layer_directory: true
456
+ enforce_layer_structure: true
457
+ error_messages:
458
+ missing_layer: "Test file must be in a layer directory: {expected_path}"
459
+ wrong_layer: "Test for {component_type} should be in {expected_layer} layer"
460
+
461
+ typescript:
462
+ layers: [presentation, application, domain, integration]
463
+ test_path_pattern: "supabase/functions/{wagon}/{feature}/tests/{layer}/"
464
+ file_naming: "{component}.test.ts"
465
+ auto_create_directories: true
466
+
467
+ layer_mapping:
468
+ presentation: ["controller", "handler", "route"]
469
+ application: ["use_case", "service"]
470
+ domain: ["entity", "value_object"]
471
+ integration: ["repository", "client", "supabase"]
472
+
473
+ validation:
474
+ require_layer_directory: true
475
+ enforce_layer_structure: true
476
+ error_messages:
477
+ missing_layer: "Test file must be in a layer directory: {expected_path}"
478
+ wrong_layer: "Test for {component_type} should be in {expected_layer} layer"
479
+
480
+ supabase:
481
+ layers: [presentation, application, domain, integration]
482
+ test_path_pattern: "supabase/functions/{wagon}/{feature}/tests/{layer}/"
483
+ file_naming: "{component}.test.ts"
484
+ auto_create_directories: true
485
+
486
+ layer_mapping:
487
+ presentation: ["http", "controller", "handler"]
488
+ application: ["use_case", "service"]
489
+ domain: ["entity", "value_object"]
490
+ integration: ["repository", "client", "supabase"]
491
+
492
+ validation:
493
+ require_layer_directory: true
494
+ enforce_layer_structure: true
495
+
496
+ # TypeScript/Preact Test Patterns
497
+ typescript_test_patterns:
498
+ framework: "vitest"
499
+ assertion_library: "@testing-library/preact"
500
+ test_structure:
501
+ unit_test:
502
+ template: |
503
+ // URN: acc:{wagon}:{WMBT}-{HARNESS}-{NNN}
504
+ // Purpose: {purpose}
505
+ // Layer: {domain|application|integration}
506
+ import { describe, test, expect } from 'vitest';
507
+ import { Subject } from '@/{wagon}/{feature}/{layer}/Subject';
508
+
509
+ describe('acc:{wagon}:{WMBT}-{HARNESS}-{NNN}', () => {
510
+ test('{purpose}', () => {
511
+ // GIVEN: Setup
512
+ // WHEN: Action
513
+ // THEN: Assertions
514
+ expect(true).toBe(true);
515
+ });
516
+ });
517
+
518
+ component_test:
519
+ template: |
520
+ // URN: acc:{wagon}:{WMBT}-WIDGET-{NNN}
521
+ // Purpose: {purpose}
522
+ // Layer: presentation
523
+ import { describe, test, expect } from 'vitest';
524
+ import { render, screen } from '@testing-library/preact';
525
+ import { Component } from '@/{wagon}/{feature}/presentation/components/Component';
526
+
527
+ describe('acc:{wagon}:{WMBT}-WIDGET-{NNN}', () => {
528
+ test('{purpose}', () => {
529
+ render(<Component />);
530
+ expect(screen.getByText('')).toBeTruthy();
531
+ });
532
+ });
533
+
534
+ integration_test:
535
+ template: |
536
+ // URN: acc:{wagon}:{WMBT}-HTTP-{NNN}
537
+ // Purpose: {purpose}
538
+ // Layer: integration
539
+ import { describe, test, expect, vi } from 'vitest';
540
+ import { Repository } from '@/{wagon}/{feature}/integration/repositories/Repository';
541
+
542
+ describe('acc:{wagon}:{WMBT}-HTTP-{NNN}', () => {
543
+ test('{purpose}', async () => {
544
+ global.fetch = vi.fn(() =>
545
+ Promise.resolve({
546
+ ok: true,
547
+ json: () => Promise.resolve({ data: 'test' })
548
+ } as Response)
549
+ );
550
+ const repository = new Repository();
551
+ const result = await repository.getData();
552
+ expect(result).toMatchObject({ data: 'test' });
553
+ });
554
+ });
555
+
556
+ harness_classification:
557
+ harnesses: ["unit", "widget", "integration", "e2e"]
558
+ harness_to_layer:
559
+ unit: ["domain", "application"]
560
+ widget: ["presentation"]
561
+ integration: ["integration"]
562
+ e2e: ["presentation"]
563
+
564
+ # File Organization
565
+ file_patterns:
566
+ description: "Test file naming patterns by language and harness"
567
+
568
+ dart:
569
+ test: "test/${wagon}/${feature}/${normalized_id}_${purpose_slug}_test.dart"
570
+ integration: "integration_test/${wagon}/${normalized_id}_${purpose_slug}_test.dart"
571
+
572
+ naming_rules:
573
+ normalized_id:
574
+ description: "Convert acceptance ID to snake_case"
575
+ pattern: "AC-HTTP-006 → ac_http_006"
576
+ transformation:
577
+ - "Convert to lowercase"
578
+ - "Replace hyphens with underscores"
579
+
580
+ purpose_slug:
581
+ description: "Extract key terms from identity.purpose field"
582
+ pattern: "Verify primitives API endpoint is accessible → primitive_endpoint"
583
+ transformation:
584
+ - "Remove filler words (Verify, Ensure, Confirm, is, the, etc.)"
585
+ - "Extract 2-3 key nouns/verbs"
586
+ - "Convert to snake_case"
587
+ - "Join with underscores"
588
+
589
+ examples:
590
+ - identity:
591
+ id: "AC-HTTP-006"
592
+ purpose: "Verify primitives API endpoint is accessible"
593
+ filename: "ac_http_006_primitive_endpoint_test.dart"
594
+
595
+ - identity:
596
+ id: "AC-UNIT-007"
597
+ purpose: "Ensure primitives reference only foundation tokens"
598
+ filename: "ac_unit_007_primitives_reference_foundations_test.dart"
599
+
600
+ - identity:
601
+ id: "AC-WIDGET-009"
602
+ purpose: "Verify primitives render without errors"
603
+ filename: "ac_widget_009_primitives_render_test.dart"
604
+
605
+ typescript:
606
+ test: "supabase/functions/${wagon}/test/${normalized_id}.${purpose_slug}.test.ts"
607
+ e2e: "e2e/${wagon}/${normalized_id}.${purpose_slug}.test.ts"
608
+
609
+ naming_rules:
610
+ normalized_id:
611
+ description: "Convert acceptance ID to kebab-case"
612
+ pattern: "AC-HTTP-006 → ac-http-006"
613
+ transformation:
614
+ - "Convert to lowercase"
615
+ - "Keep hyphens (TypeScript/Node convention)"
616
+
617
+ purpose_slug:
618
+ description: "Extract key terms from identity.purpose field"
619
+ pattern: "Verify primitives API endpoint is accessible → primitive-endpoint"
620
+ transformation:
621
+ - "Remove filler words (Verify, Ensure, Confirm, is, the, etc.)"
622
+ - "Extract 2-3 key nouns/verbs"
623
+ - "Convert to kebab-case"
624
+ - "Join with hyphens"
625
+
626
+ examples:
627
+ - identity:
628
+ id: "AC-HTTP-006"
629
+ purpose: "Verify primitives API endpoint is accessible"
630
+ filename: "ac-http-006.primitive-endpoint.test.ts"
631
+
632
+ - identity:
633
+ id: "AC-UNIT-007"
634
+ purpose: "Ensure primitives reference only foundation tokens"
635
+ filename: "ac-unit-007.primitives-reference-foundations.test.ts"
636
+
637
+ - identity:
638
+ id: "AC-DB-015"
639
+ purpose: "Validate user records persist correctly"
640
+ filename: "ac-db-015.user-records-persist.test.ts"
641
+
642
+ typescript_preact:
643
+ test: "web/tests/${wagon}/${feature}/${layer}/${WMBT}_${HARNESS}_${NNN}[_{slug_snake}].test.ts[x]"
644
+
645
+ naming_rules:
646
+ wmbt_harness_nnn:
647
+ description: "Use WMBT/HARNESS/NNN from acceptance URN"
648
+ pattern: "C004-E2E-019 → C004_E2E_019"
649
+ transformation:
650
+ - "Preserve WMBT and HARNESS uppercase"
651
+ - "Use underscore separators"
652
+
653
+ slug:
654
+ description: "Slug from acceptance URN in snake_case"
655
+ pattern: "user-connection → user_connection"
656
+ transformation:
657
+ - "Convert kebab-case to snake_case"
658
+
659
+ extension_rules:
660
+ ".test.ts": "Logic tests (domain, application, integration)"
661
+ ".test.tsx": "Component tests (presentation, widget harness)"
662
+
663
+ examples:
664
+ - identity:
665
+ id: "acc:maintain-ux:C004-E2E-019-user-connection"
666
+ filename: "C004_E2E_019_user_connection.test.ts"
667
+
668
+ - identity:
669
+ id: "acc:maintain-ux:C004-UNIT-001"
670
+ filename: "C004_UNIT_001.test.ts"
671
+
672
+ - identity:
673
+ id: "acc:maintain-ux:C001-WIDGET-001-button"
674
+ filename: "C001_WIDGET_001_button.test.tsx"
675
+
676
+ python:
677
+ test: "tests/${wagon}/test_${acceptance_id}.py"
678
+
679
+ go:
680
+ test: "${wagon}/${acceptance_id}_test.go"
681
+
682
+ urn_based_naming:
683
+ description: "New URN-based filename generation (replaces legacy acceptance ID approach)"
684
+ convention: "filename.convention.yaml"
685
+ status: "CURRENT"
686
+
687
+ approach: |
688
+ The URN-based approach generates filenames directly from acceptance URNs,
689
+ ensuring bidirectional traceability between acceptance criteria and test files.
690
+
691
+ URN Format: acc:{wagon}:{WMBT}-{HARNESS}-{NNN}[-{slug}]
692
+ Example: acc:maintain-ux:C004-E2E-019-user-connection
693
+
694
+ Generated Filenames:
695
+ - Dart: C004_E2E_019_user_connection_test.dart
696
+ - TypeScript: c004-e2e-019-user-connection.test.ts
697
+ - TypeScript (Preact): C004_E2E_019_user_connection.test.ts
698
+ - Python: test_c004_e2e_019_user_connection.py
699
+ - Go: c004_e2e_019_user_connection_test.go
700
+ - Java/Kotlin: C004E2E019UserConnectionTest
701
+
702
+ utilities:
703
+ module: "atdd.tester.utils.filename"
704
+ functions:
705
+ - "parse_acceptance_urn(urn: str) -> Dict"
706
+ - "dart_filename(urn: str) -> str"
707
+ - "typescript_filename(urn: str) -> str"
708
+ - "typescript_preact_filename(urn: str) -> str"
709
+ - "python_filename(urn: str) -> str"
710
+ - "go_filename(urn: str) -> str"
711
+ - "java_classname(urn: str) -> str"
712
+ - "generate_test_filename(urn: str, language: str) -> str"
713
+
714
+ migration:
715
+ from_legacy: |
716
+ Legacy file_patterns above use acceptance ID and purpose slug extraction.
717
+ New approach embeds WMBT and slug directly in URN, eliminating extraction logic.
718
+
719
+ Migration path:
720
+ 1. Extract URN from test file header comment
721
+ 2. Generate new filename using atdd.tester.utils.filename
722
+ 3. Rename file and update imports
723
+ 4. Validate with platform_validation tests
724
+
725
+ backward_compatibility: |
726
+ Both approaches supported during transition. Legacy patterns remain for
727
+ existing tests. New tests should use URN-based naming.
728
+
729
+ validation:
730
+ platform_tests:
731
+ - "test_acceptance_urn_filename_mapping.py"
732
+ - "test_dart_test_naming.py"
733
+ - "test_typescript_test_naming.py"
734
+
735
+ convention_tests:
736
+ - "conventions/tester/tests/filename/test_convention_completeness.py"
737
+
738
+ # Fallback Strategies
739
+ fallback:
740
+ on_render_failure:
741
+ 1_retry: "Simpler prompt"
742
+ 2_template: "Use template if exists"
743
+ 3_log: "Record in violations.log"
744
+
745
+ on_validation_failure:
746
+ syntax: "Log and skip"
747
+ structure: "Inject missing elements"
748
+ semantic: "Re-render with constraints"
749
+ behavioral: "Force failure injection"
750
+
751
+ # Success Metrics
752
+ metrics:
753
+ required:
754
+ generation_rate: ">= 80%"
755
+ red_state: "100%"
756
+ validation_pass: ">= 90%"
757
+
758
+ quality:
759
+ syntax_valid: "100%"
760
+ structure_complete: ">= 95%"
761
+ semantic_match: ">= 90%"
762
+ behavioral_correct: "100%"
763
+
764
+ # Template Deprecation
765
+ templates:
766
+ status: "DEPRECATED"
767
+ reason: "Replaced by neurosymbolic approach"
768
+ migration: "Templates remain for emergency fallback only"
769
+ removal_date: "After 3 successful sprints"
770
+
771
+ # Utils Dependencies
772
+ utils_required:
773
+ - utils:agents:tester:harness # Classify harness type
774
+ - utils:agents:tester:detect # Detect language
775
+ - utils:agents:tester:render # Agent rendering
776
+ - utils:agents:tester:valid # Structure validation
777
+ - utils:agents:tester:red # RED state validation (includes intent building)
778
+
779
+ # Schema Dependencies
780
+ schemas_required:
781
+ - schemas:planner:acceptance # Acceptance structure
782
+ - schemas:tester:pack # Contract reference
783
+ - schemas:tester:test_filename # URN-based filename generation
784
+
785
+ # Handoff Contract
786
+ handoff:
787
+ to: "coder"
788
+ provides:
789
+ - test_manifest: "List of generated tests"
790
+ - test_files: "Actual test code files"
791
+ - languages: "Languages used"
792
+ - acceptance_mapping: "Test to acceptance URN map"
793
+
794
+ expects:
795
+ - green_tests: "All tests passing"
796
+ - implementation: "Code satisfying tests"
797
+ - coverage: ">= 80%"