@sppg2001/atomize 1.2.4 → 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,252 @@
1
+ # Validation Modes
2
+
3
+ Atomize supports two validation modes that control how strictly templates are checked: **lenient** (default) and **strict**.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Overview](#overview)
8
+ - [Lenient Mode](#lenient-mode)
9
+ - [Strict Mode](#strict-mode)
10
+ - [Errors vs Warnings](#errors-vs-warnings)
11
+ - [How to Set the Mode](#how-to-set-the-mode)
12
+ - [When to Use Each Mode](#when-to-use-each-mode)
13
+ - [Examples](#examples)
14
+
15
+ ---
16
+
17
+ ## Overview
18
+
19
+ | | Lenient | Strict |
20
+ |--|---------|--------|
21
+ | **Errors** | Block template use | Block template use |
22
+ | **Warnings** | Non-blocking, shown as info | Promoted to errors, block template use |
23
+ | **Default** | Yes | No |
24
+ | **Use case** | Development, flexible templates | Production, QA gates, CI/CD |
25
+
26
+ ---
27
+
28
+ ## Lenient Mode
29
+
30
+ Lenient is the **default** mode. Only hard errors block a template from being used. Warnings are displayed but do not cause the validation to fail.
31
+
32
+ **Characteristics:**
33
+ - Errors → template is invalid, must be fixed
34
+ - Warnings → template is valid, but may behave unexpectedly
35
+ - Great for development and iterating on templates
36
+
37
+ **Example output (lenient):**
38
+ ```
39
+ Template is valid! [Lenient]
40
+
41
+ Warnings:
42
+ • tasks[*].customFields: 1 task(s) have custom fields that could not be verified.
43
+ Run with --profile <name> (or choose Online when prompted) to validate field names, types, and picklist values.
44
+
45
+ Ready to use with: atomize generate my-template.yaml
46
+ ```
47
+
48
+ ---
49
+
50
+ ## Strict Mode
51
+
52
+ In strict mode, **all warnings are promoted to errors**. The template is invalid if any warning exists, regardless of whether errors are present.
53
+
54
+ **Characteristics:**
55
+ - Errors → template is invalid
56
+ - Warnings → also treated as errors, template is invalid
57
+ - Best for production templates and automated pipelines
58
+ - Enforces high quality and catches potential issues early
59
+
60
+ **Example output (strict):**
61
+ ```
62
+ Template validation failed [Strict]
63
+
64
+ Errors:
65
+ • tasks[*].customFields: 1 task(s) have custom fields that could not be verified.
66
+ Run with --profile <name> (or choose Online when prompted) to validate field names, types, and picklist values.
67
+
68
+ Fix the errors above and try again.
69
+ ```
70
+
71
+ ---
72
+
73
+ ## Errors vs Warnings
74
+
75
+ Understanding which issues are hard errors and which are warnings helps you prioritize fixes.
76
+
77
+ ### Always Errors (Both Modes)
78
+
79
+ These issues always block template use:
80
+
81
+ | Issue | Example Message |
82
+ |-------|----------------|
83
+ | Total ≠ configured `totalEstimationMustBe` | `Total estimation is 70%, but must be 100%` |
84
+ | Estimation outside configured `totalEstimationRange` | `Total estimation is 80%, must be 95%-105%` |
85
+ | Task count below minimum | `Template has 1 task(s), but minimum is 3` |
86
+ | Task count above maximum | `Template has 12 task(s), but maximum is 10` |
87
+ | Non-existent dependency reference | `Task depends on non-existent task ID: "setup-db"` |
88
+ | Task uses `dependsOn` but has no `id` | `Task "Create API" has dependencies but no id field` |
89
+ | Circular dependency | `Circular dependency detected: task1 -> task2 -> task1` |
90
+ | Missing required field | `Task title is required` |
91
+ | Invalid email format | `Invalid email: bad-email` |
92
+ | Wrong field type | `Expected number but received string` |
93
+ | Negative estimation | `Estimation percentage cannot be negative` |
94
+ | Invalid custom field in connected validation | `Field "Custom.ClientTier" not found for work item type "Task"` |
95
+
96
+ ### Warnings (Errors in Strict Mode)
97
+
98
+ These issues are warnings in lenient mode but become errors in strict mode:
99
+
100
+ | Issue | Example Message |
101
+ |-------|----------------|
102
+ | Offline custom field verification | `1 task(s) have custom fields that could not be verified` |
103
+ | Total estimation not 100% (no `totalEstimationMustBe` or `totalEstimationRange` configured) | `Total estimation is 70% (expected 100%)` |
104
+ | Estimation below `taskEstimationRange.min` | `Task estimation 0.2 is below minimum 0.5` |
105
+ | Task missing recommended field | `Task "Implementation" has no activity set` |
106
+ | Template has no filter criteria | `No filter criteria configured — template will match all work items` |
107
+
108
+ ---
109
+
110
+ ## How to Set the Mode
111
+
112
+ ### Via CLI Flags (Recommended)
113
+
114
+ Override the mode at the command line for the current run:
115
+
116
+ ```bash
117
+ # Use strict mode for this validation
118
+ atomize validate my-template.yaml --strict
119
+
120
+ # Connect to ADO for live custom-field and saved-query validation
121
+ atomize validate my-template.yaml --profile work-ado
122
+ ```
123
+
124
+ ### Via Template YAML
125
+
126
+ Set the default mode inside the template itself. This is useful when you want to enforce a mode for a specific template regardless of how it's called.
127
+
128
+ ```yaml
129
+ validation:
130
+ mode: "strict" # or "lenient"
131
+ totalEstimationMustBe: 100
132
+ minTasks: 3
133
+ ```
134
+
135
+ ### Precedence
136
+
137
+ CLI flags override the template's `validation.mode` setting:
138
+
139
+ ```
140
+ CLI --strict > template validation.mode > lenient (default)
141
+ ```
142
+
143
+ When ADO-backed validation is needed:
144
+ - `atomize validate` runs offline by default and only checks structure
145
+ - `atomize validate --profile <name>` performs live validation against Azure DevOps
146
+ - In interactive terminals, Atomize may prompt you to choose offline vs online validation
147
+
148
+ ---
149
+
150
+ ## When to Use Each Mode
151
+
152
+ ### Use Lenient Mode for:
153
+
154
+ - **Developing new templates** — iterate quickly without strict checks blocking you
155
+ - **Experimental or personal templates** — where flexibility matters more than rigidity
156
+ - **Templates with optional tasks** — where conditional tasks may cause warning-level issues
157
+ - **Generating tasks interactively** — the default mode is appropriate for everyday use
158
+
159
+ ### Use Strict Mode for:
160
+
161
+ - **Shared team templates** — enforce quality for templates used across the team
162
+ - **CI/CD pipelines** — ensure templates meet all quality gates before merging
163
+ - **Production-critical templates** — for templates that run automatically
164
+ - **Template reviews** — catch every potential issue before releasing a template
165
+
166
+ ```bash
167
+ # CI/CD example: validate all templates strictly
168
+ for template in templates/*.yaml; do
169
+ atomize validate "$template" --strict
170
+ done
171
+ ```
172
+
173
+ ---
174
+
175
+ ## Examples
176
+
177
+ ### Template That Passes Both Modes
178
+
179
+ ```yaml
180
+ version: "1.0"
181
+ name: "Bug Fix Workflow"
182
+ description: "Standard bug fix process"
183
+
184
+ filter:
185
+ workItemTypes: ["Bug"]
186
+ states: ["New", "Active"]
187
+ excludeIfHasTasks: true
188
+
189
+ tasks:
190
+ - id: "investigate"
191
+ title: "Investigate & Reproduce Bug"
192
+ estimationPercent: 30
193
+ activity: "Testing"
194
+
195
+ - id: "fix"
196
+ title: "Implement Fix"
197
+ estimationPercent: 40
198
+ activity: "Development"
199
+ dependsOn: ["investigate"]
200
+
201
+ - id: "test"
202
+ title: "Test & Verify Fix"
203
+ estimationPercent: 20
204
+ activity: "Testing"
205
+ dependsOn: ["fix"]
206
+
207
+ - id: "review"
208
+ title: "Review & Deploy"
209
+ estimationPercent: 10
210
+ activity: "Documentation"
211
+ dependsOn: ["test"]
212
+
213
+ validation:
214
+ mode: "strict"
215
+ totalEstimationMustBe: 100
216
+ minTasks: 3
217
+ ```
218
+
219
+ ### Template That Passes Lenient but Fails Strict
220
+
221
+ ```yaml
222
+ tasks:
223
+ - title: "Implementation"
224
+ estimationPercent: 70
225
+ customFields:
226
+ Custom.ReleaseVersion: "{{ story.customFields['Custom.ReleaseVersion'] }}"
227
+
228
+ - title: "Testing"
229
+ estimationPercent: 30
230
+ ```
231
+
232
+ **Lenient output:**
233
+ ```
234
+ Template is valid! [Lenient]
235
+ Warnings:
236
+ • tasks[*].customFields: 1 task(s) have custom fields that could not be verified.
237
+ ```
238
+
239
+ **Strict output:**
240
+ ```
241
+ Template validation failed [Strict]
242
+ Errors:
243
+ • tasks[*].customFields: 1 task(s) have custom fields that could not be verified.
244
+ ```
245
+
246
+ ---
247
+
248
+ ## See Also
249
+
250
+ - [Common Validation Errors](./Common-Validation-Errors.md) - Fix specific errors
251
+ - [Template Reference](./Template-Reference.md) - Full template schema
252
+ - [CLI Reference](./Cli-Reference.md) - `validate` command options