@sppg2001/atomize 1.2.2 → 2.0.0-alpha.0

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.
@@ -0,0 +1,556 @@
1
+ # Common Validation Errors
2
+
3
+ This guide provides solutions for common template validation errors you might encounter when creating or editing Atomize templates.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Validation Modes: Lenient vs Strict](#validation-modes-lenient-vs-strict)
8
+ - [Estimation Errors](#estimation-errors)
9
+ - [Task Count Errors](#task-count-errors)
10
+ - [Dependency Errors](#dependency-errors)
11
+ - [Condition Errors](#condition-errors)
12
+ - [Schema Errors](#schema-errors)
13
+ - [Understanding Error Messages](#understanding-error-messages)
14
+
15
+ ---
16
+
17
+ ## Validation Modes: Lenient vs Strict
18
+
19
+ Atomize has two validation modes that affect how warnings are treated.
20
+
21
+ | Mode | Warnings | Usage |
22
+ |------|----------|-------|
23
+ | **Lenient** (default) | Non-blocking — template is still valid | Development, flexible templates |
24
+ | **Strict** | Promoted to errors — template is invalid | Production, CI/CD, team templates |
25
+
26
+ **Set mode via CLI:**
27
+ ```bash
28
+ atomize validate my-template.yaml --strict # Warnings become errors
29
+ atomize validate my-template.yaml # Warnings are non-blocking (default)
30
+ ```
31
+
32
+ **Set mode in template YAML:**
33
+ ```yaml
34
+ validation:
35
+ mode: "strict" # or "lenient"
36
+ ```
37
+
38
+ See [Validation Modes](./Validation-Modes.md) for a full explanation.
39
+
40
+ ---
41
+
42
+ ## Estimation Errors
43
+
44
+ ### Total Estimation Does Not Equal 100%
45
+
46
+ > **Note:** Without `totalEstimationMustBe` or `totalEstimationRange` configured, a mismatched total is a **warning** (not an error) in lenient mode — the template is still usable. It only becomes an error when a strict constraint is configured, or when running in strict mode.
47
+
48
+ **Error Message** (when `totalEstimationMustBe: 100` is set):
49
+ ```
50
+ Total estimation is 70%, but must be 100%.
51
+ 💡 Add 30% to existing tasks or create a new task with 30% estimation.
52
+ ```
53
+
54
+ **Cause:** Your task estimation percentages don't add up to 100%, and a strict validation constraint requires them to.
55
+
56
+ **Solutions:**
57
+ 1. **Adjust existing tasks:**
58
+ ```yaml
59
+ tasks:
60
+ - title: "Design"
61
+ estimationPercent: 40 # Was 30
62
+ - title: "Development"
63
+ estimationPercent: 60 # Was 40
64
+ ```
65
+
66
+ 2. **Add a new task:**
67
+ ```yaml
68
+ tasks:
69
+ - title: "Design"
70
+ estimationPercent: 30
71
+ - title: "Development"
72
+ estimationPercent: 40
73
+ - title: "Testing" # New task
74
+ estimationPercent: 30
75
+ ```
76
+
77
+ ### Total Estimation Exceeds 100%
78
+
79
+ **Error Message:**
80
+ ```
81
+ Total estimation is 120%, but must be 100%.
82
+ 💡 Reduce task estimations by 20% to reach 100%.
83
+ ```
84
+
85
+ **Cause:** Your task estimation percentages exceed 100%.
86
+
87
+ **Solutions:**
88
+ 1. **Reduce task percentages proportionally:**
89
+ ```yaml
90
+ tasks:
91
+ - title: "Design"
92
+ estimationPercent: 25 # Was 40
93
+ - title: "Development"
94
+ estimationPercent: 50 # Was 60
95
+ - title: "Testing"
96
+ estimationPercent: 25 # Was 20
97
+ ```
98
+
99
+ 2. **Use the wizard's auto-normalization feature:**
100
+ ```bash
101
+ atomize template create --scratch
102
+ # The wizard will offer to normalize estimations automatically
103
+ ```
104
+
105
+ ### Estimation Outside Range
106
+
107
+ **Error Message:**
108
+ ```
109
+ Total estimation is 80%, but must be between 95% and 105%.
110
+ 💡 Increase task estimations by 15% to meet the minimum of 95%.
111
+ ```
112
+
113
+ **Cause:** Total estimation falls outside the configured acceptable range.
114
+
115
+ **Solution:**
116
+ ```yaml
117
+ tasks:
118
+ - title: "Task 1"
119
+ estimationPercent: 50 # Increase from 40
120
+ - title: "Task 2"
121
+ estimationPercent: 45 # Increase from 40
122
+ ```
123
+
124
+ ### Negative or Excessive Estimation
125
+
126
+ **Error Message:**
127
+ ```
128
+ Estimation percentage cannot be negative.
129
+ 💡 Estimation percentage cannot be negative. Use a value between 0 and 100.
130
+ ```
131
+
132
+ **Cause:** Task has invalid estimation value (negative or > 100).
133
+
134
+ **Solution:**
135
+ ```yaml
136
+ tasks:
137
+ - title: "Task 1"
138
+ estimationPercent: 50 # Fix: was -10 or 150
139
+ ```
140
+
141
+ ---
142
+
143
+ ## Task Count Errors
144
+
145
+ ### Too Few Tasks
146
+
147
+ **Error Message:**
148
+ ```
149
+ Template has 1 task(s), but minimum is 3. Add 2 more task(s).
150
+ 💡 Add 2 more task(s) to meet the minimum requirement of 3 tasks.
151
+ ```
152
+
153
+ **Cause:** Template doesn't have enough tasks to meet minimum requirement.
154
+
155
+ **Solution:**
156
+ ```yaml
157
+ validation:
158
+ minTasks: 3
159
+
160
+ tasks:
161
+ - title: "Task 1"
162
+ estimationPercent: 33
163
+ - title: "Task 2" # Added
164
+ estimationPercent: 33
165
+ - title: "Task 3" # Added
166
+ estimationPercent: 34
167
+ ```
168
+
169
+ ### Too Many Tasks
170
+
171
+ **Error Message:**
172
+ ```
173
+ Template has 5 task(s), but maximum is 3. Remove 2 task(s) or increase maxTasks.
174
+ 💡 Remove 2 task(s) or increase the maxTasks limit to 5.
175
+ ```
176
+
177
+ **Cause:** Template has more tasks than the maximum allowed.
178
+
179
+ **Solutions:**
180
+ 1. **Remove excess tasks:**
181
+ ```yaml
182
+ tasks:
183
+ - title: "Task 1"
184
+ - title: "Task 2"
185
+ - title: "Task 3"
186
+ # Removed Task 4 and Task 5
187
+ ```
188
+
189
+ 2. **Increase the limit:**
190
+ ```yaml
191
+ validation:
192
+ maxTasks: 5 # Increased from 3
193
+ ```
194
+
195
+ ### At Least One Task Required
196
+
197
+ **Error Message:**
198
+ ```
199
+ At least one task is required
200
+ 💡 Add at least one task to the template.
201
+ ```
202
+
203
+ **Cause:** Template has no tasks defined.
204
+
205
+ **Solution:**
206
+ ```yaml
207
+ tasks:
208
+ - title: "Initial Task"
209
+ description: "First task description"
210
+ estimationPercent: 100
211
+ ```
212
+
213
+ ---
214
+
215
+ ## Dependency Errors
216
+
217
+ ### Non-Existent Task Dependency
218
+
219
+ **Error Message:**
220
+ ```
221
+ Task depends on non-existent task ID: "setup-db". Available task IDs: "task1", "task2"
222
+ 💡 Either add a task with id: "setup-db" or update the dependsOn field to reference an existing task ID.
223
+ ```
224
+
225
+ **Cause:** A task references a dependency that doesn't exist.
226
+
227
+ **Solutions:**
228
+ 1. **Fix the dependency reference:**
229
+ ```yaml
230
+ tasks:
231
+ - id: "task1"
232
+ title: "Setup Database"
233
+ estimationPercent: 30
234
+ - id: "task2"
235
+ title: "Create API"
236
+ estimationPercent: 70
237
+ dependsOn: ["task1"] # Fixed: was "setup-db"
238
+ ```
239
+
240
+ 2. **Add the missing task:**
241
+ ```yaml
242
+ tasks:
243
+ - id: "setup-db" # Added missing task
244
+ title: "Setup Database"
245
+ estimationPercent: 30
246
+ - id: "task2"
247
+ title: "Create API"
248
+ estimationPercent: 70
249
+ dependsOn: ["setup-db"]
250
+ ```
251
+
252
+ ### Task Has Dependencies But No ID
253
+
254
+ **Error Message:**
255
+ ```
256
+ Task "Create API" has dependencies but no id field.
257
+ 💡 Add an 'id' field to this task, e.g., 'id: "create-api"'
258
+ ```
259
+
260
+ **Cause:** A task specifies dependencies but doesn't have an ID itself.
261
+
262
+ **Solution:**
263
+ ```yaml
264
+ tasks:
265
+ - id: "setup-db"
266
+ title: "Setup Database"
267
+ estimationPercent: 30
268
+ - id: "create-api" # Added missing ID
269
+ title: "Create API"
270
+ estimationPercent: 70
271
+ dependsOn: ["setup-db"]
272
+ ```
273
+
274
+ ### Task Referenced But Has No ID
275
+
276
+ **Error Message:**
277
+ ```
278
+ Task "Setup Database" is referenced by other tasks but has no id field.
279
+ 💡 Add 'id: "setup-database"' to this task. Referenced by: "Create API", "Write Tests"
280
+ ```
281
+
282
+ **Cause:** Other tasks depend on this task, but it doesn't have an ID.
283
+
284
+ **Solution:**
285
+ ```yaml
286
+ tasks:
287
+ - id: "setup-database" # Added ID
288
+ title: "Setup Database"
289
+ estimationPercent: 30
290
+ - id: "create-api"
291
+ title: "Create API"
292
+ estimationPercent: 40
293
+ dependsOn: ["setup-database"]
294
+ - id: "write-tests"
295
+ title: "Write Tests"
296
+ estimationPercent: 30
297
+ dependsOn: ["setup-database"]
298
+ ```
299
+
300
+ ### Circular Dependencies
301
+
302
+ **Error Message:**
303
+ ```
304
+ Circular dependency detected: task1 -> task2 -> task1
305
+ Break the circular dependency by removing one of these dependencies: "task1" depends on "task2", "task2" depends on "task1"
306
+ ```
307
+
308
+ **Cause:** Tasks have circular dependency relationships.
309
+
310
+ **Solution:**
311
+ ```yaml
312
+ # Before (circular):
313
+ tasks:
314
+ - id: "task1"
315
+ title: "Task 1"
316
+ dependsOn: ["task2"] # ❌ Circular!
317
+ - id: "task2"
318
+ title: "Task 2"
319
+ dependsOn: ["task1"] # ❌ Circular!
320
+
321
+ # After (fixed):
322
+ tasks:
323
+ - id: "task1"
324
+ title: "Task 1"
325
+ # No dependencies
326
+ - id: "task2"
327
+ title: "Task 2"
328
+ dependsOn: ["task1"] # ✅ Linear dependency
329
+ ```
330
+
331
+ ---
332
+
333
+ ## Condition Errors
334
+
335
+ ### Invalid Condition Syntax
336
+
337
+ **Error Message:**
338
+ ```
339
+ Invalid input for condition
340
+ 💡 Conditions use structured objects such as `field`, `customField`, `all`, and `any`.
341
+ ```
342
+
343
+ **Cause:** Condition uses the old string expression syntax instead of the structured condition format Atomize validates now.
344
+
345
+ **Solutions:**
346
+ 1. **Use story variables:**
347
+ ```yaml
348
+ tasks:
349
+ - title: "Backend Task"
350
+ estimationPercent: 50
351
+ condition:
352
+ field: "tags"
353
+ operator: "contains"
354
+ value: "backend"
355
+ ```
356
+
357
+ 2. **Use custom fields:**
358
+ ```yaml
359
+ tasks:
360
+ - title: "High Priority Task"
361
+ estimationPercent: 30
362
+ condition:
363
+ customField: "Custom.Priority"
364
+ operator: "equals"
365
+ value: "High"
366
+ ```
367
+
368
+ 3. **Combine conditions:**
369
+ ```yaml
370
+ tasks:
371
+ - title: "Complex Condition"
372
+ estimationPercent: 40
373
+ condition:
374
+ all:
375
+ - field: "tags"
376
+ operator: "contains"
377
+ value: "api"
378
+ - field: "estimation"
379
+ operator: "gt"
380
+ value: 5
381
+ ```
382
+
383
+ **Valid Operators:**
384
+ - `contains` / `not-contains`
385
+ - `equals` / `not-equals`
386
+ - `gt` / `lt` / `gte` / `lte`
387
+ - `all` / `any`
388
+
389
+ ---
390
+
391
+ ## Schema Errors
392
+
393
+ ### Missing Required Field
394
+
395
+ **Error Message:**
396
+ ```
397
+ Task title is required
398
+ 💡 This field cannot be empty. Please provide a value.
399
+ ```
400
+
401
+ **Cause:** A required field is missing or empty.
402
+
403
+ **Solution:**
404
+ ```yaml
405
+ tasks:
406
+ - title: "My Task" # Added required title
407
+ estimationPercent: 100
408
+ ```
409
+
410
+ ### Invalid Email Format
411
+
412
+ **Error Message:**
413
+ ```
414
+ Invalid email
415
+ 💡 Use a valid email address format (e.g., user@example.com) or the special value "@Me".
416
+ ```
417
+
418
+ **Cause:** Email field has invalid format.
419
+
420
+ **Solutions:**
421
+ 1. **Use valid email:**
422
+ ```yaml
423
+ filter:
424
+ assignedTo: ["john.doe@example.com"]
425
+ ```
426
+
427
+ 2. **Use @Me macro:**
428
+ ```yaml
429
+ filter:
430
+ assignedTo: ["@Me"] # Refers to current user
431
+ ```
432
+
433
+ ### Type Mismatch
434
+
435
+ **Error Message:**
436
+ ```
437
+ Expected a number but received string.
438
+ 💡 Expected a number but received string. Remove quotes from numeric values.
439
+ ```
440
+
441
+ **Cause:** Field has wrong type (e.g., string instead of number).
442
+
443
+ **Solutions:**
444
+ ```yaml
445
+ # Wrong:
446
+ tasks:
447
+ - title: "Task"
448
+ estimationPercent: "50" # ❌ String
449
+
450
+ # Correct:
451
+ tasks:
452
+ - title: "Task"
453
+ estimationPercent: 50 # ✅ Number
454
+ ```
455
+
456
+ ---
457
+
458
+ ## Understanding Error Messages
459
+
460
+ ### Error Message Format
461
+
462
+ Validation errors now include actionable suggestions:
463
+
464
+ ```
465
+ [Error Path]: [Error Message]
466
+ 💡 [Suggestion]
467
+ ```
468
+
469
+ **Example:**
470
+ ```
471
+ tasks: Total estimation is 70%, but must be 100%.
472
+ 💡 Add 30% to existing tasks or create a new task with 30% estimation.
473
+ ```
474
+
475
+ ### Error vs Warning
476
+
477
+ - **Errors** (❌): Block template from being used. Must be fixed.
478
+ - **Warnings** (⚠️): Non-blocking issues. Template can still be used but may not work as expected.
479
+
480
+ **Example Output:**
481
+ ```
482
+ Template validation failed:
483
+
484
+ Errors:
485
+ - tasks: Total estimation is 70%, but must be 100%.
486
+ 💡 Add 30% to existing tasks or create a new task with 30% estimation.
487
+
488
+ Warnings:
489
+ tasks[0].condition: Condition must be a structured object
490
+ 💡 Example: `condition: { field: "tags", operator: "contains", value: "backend" }`
491
+ ```
492
+
493
+ ### Validation Commands
494
+
495
+ **Validate a template:**
496
+ ```bash
497
+ atomize validate my-template.yaml
498
+ ```
499
+
500
+ **Strict validation (promotes warnings to errors):**
501
+ ```bash
502
+ atomize validate my-template.yaml --strict
503
+ ```
504
+
505
+ **Validation in CI/CD:**
506
+ ```bash
507
+ # Exit code 0 = valid, 1 = invalid
508
+ atomize validate templates/*.yaml
509
+ if [ $? -eq 0 ]; then
510
+ echo "All templates valid!"
511
+ else
512
+ echo "Validation failed!"
513
+ exit 1
514
+ fi
515
+ ```
516
+
517
+ ---
518
+
519
+ ## Quick Reference
520
+
521
+ | Error Type | Key Indicator | Quick Fix |
522
+ |------------|---------------|-----------|
523
+ | Estimation too low | "Add X%" | Increase task percentages or add tasks |
524
+ | Estimation too high | "Reduce X%" | Decrease task percentages |
525
+ | Too few tasks | "Add X more task(s)" | Add more tasks |
526
+ | Too many tasks | "Remove X task(s)" | Remove tasks or increase limit |
527
+ | Invalid dependency | "non-existent task ID" | Fix ID or add missing task |
528
+ | Missing ID | "no id field" | Add `id: "task-name"` |
529
+ | Circular dependency | "Circular dependency detected" | Remove one dependency from cycle |
530
+ | Invalid condition | "structured object" | Use `field` / `customField` conditions |
531
+ | Invalid email | "Invalid email" | Use valid email or "@Me" |
532
+ | Wrong type | "Expected X but received Y" | Fix value type (number vs string) |
533
+
534
+ ---
535
+
536
+ ## Getting Help
537
+
538
+ If you encounter an error not covered here:
539
+
540
+ 1. **Check the error message suggestion** - It often contains the exact fix needed
541
+ 2. **Run with --strict** - Promotes warnings to errors for a complete picture
542
+ 3. **Use the template wizard** - Interactive mode catches errors as you type
543
+ 4. **Validate incrementally** - Test after each change
544
+
545
+ **Report Issues:**
546
+ - GitHub: https://github.com/Simao-Pereira-Gomes/Atomize/issues
547
+ - Include: Error message, template YAML, and validation output
548
+
549
+ ---
550
+
551
+ ## See Also
552
+
553
+ - [Template Reference](./Template-Reference.md) - Complete template schema
554
+ - [Validation Modes](./Validation-Modes.md) - Strict vs lenient validation explained
555
+ - [Getting Started](./Getting-Started.md) - Template basics
556
+ - [Template Wizard Guide](./template-wizard-guide.md) - Interactive template creation