Skip to content

Commit 018f463

Browse files
authored
Enhance validation logging and documentation for WorkItemTypeValidatorTool (#2948)
This pull request introduces improvements to the work item type validation process and related documentation in the migration tools project. The main focus is on enhancing logging for better traceability, updating documentation references, and improving code clarity. **Enhancements to Work Item Type Validation:** * Added detailed logging to the `ValidateWorkItemTypes` method in `TfsWorkItemMigrationProcessor.cs`, including clear start/end markers and guidance for configuration, to improve traceability and user guidance. [[1]](diffhunk://#diff-b0a23408b76051c7078de3664c94b03ef26ca367ede9f084067d8722393f130eR252-R256) [[2]](diffhunk://#diff-b0a23408b76051c7078de3664c94b03ef26ca367ede9f084067d8722393f130eR284-R285) * Added an explicit error log message when validation of work item types fails, making it easier to diagnose issues during migration. * Added a summary XML comment to the `TfsWorkItemTypeValidatorTool` class, clarifying its purpose and usage for developers. **Documentation and Configuration Updates:** * Added a new alias (`/TfsWorkItemTypeValidatorTool`) to the documentation for the Work Item Type Validator Tool, improving discoverability. * Updated `.vscode/settings.json` to set the default .NET solution to `MigrationTools.slnx`, streamlining development setup.
2 parents 59bc659 + 5a907ab commit 018f463

File tree

95 files changed

+3375
-435
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+3375
-435
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
applyTo: "docs/content/docs/**"
3+
---
4+
5+
# Documentation Standards
6+
7+
All documentation content **must stay in sync with the codebase**.
8+
Every page must accurately reflect the associated **data files** and **schemas**.
9+
10+
---
11+
12+
## Front Matter
13+
14+
Each documentation file **may include** the following properties:
15+
16+
- **dataFile**: Path to the generated documentation data file (stored in `docs/data/classes`)
17+
Example: `reference.tools.fieldmappingtool.yaml`
18+
19+
- **schemaFile**: Path to the JSON schema file (stored in `docs/static/schema`)
20+
Example: `schema.tools.fieldmappingtool.json`
21+
22+
> ⚠️ Documentation pages **must not** contain options, properties, or samples that do not exist in the corresponding `dataFile`.
23+
24+
---
25+
26+
## Documentation Structure
27+
28+
Documentation files should generally include these sections (in order):
29+
30+
1. **Overview**
31+
- Subsections: *How It Works*, *Use Cases*
32+
33+
2. **Configuration Structure**
34+
- Subsections: *Options*, *Sample*, *Defaults*, *Basic Examples*, *Complex Examples*
35+
36+
3. **Common Scenarios**
37+
- A list of common scenarios with supporting samples
38+
39+
4. **Good Practices**
40+
- Focus on maintainability, readability, and clarity
41+
42+
5. **Troubleshooting**
43+
- Common issues and their resolutions
44+
45+
6. **Schema**
46+
- Use the `{{< class-schema >}}` shortcode to render the schema from `schemaFile`
47+
48+
---
49+
50+
## Rules
51+
52+
- **Options** → use `{{< class-options >}}` to render the options table from `dataFile`.
53+
- **Sample** → use `{{< class-sample sample="sample" >}}` to render the main sample from `dataFile`.
54+
- **Defaults** → use `{{< class-sample sample="defaults" >}}` to render defaults from `dataFile`.
55+
- **Basic Examples / Complex Examples**
56+
- Include generated samples based on the `dataFile`.
57+
- Cross-reference the class object and its usage context.
58+
59+
---

.vscode/launch.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,21 @@
3939
"type": "coreclr",
4040
"request": "attach",
4141
"processId": "${command:azureFunctions.pickProcess}"
42+
},
43+
{
44+
"name": "Documentation Generator",
45+
"type": "coreclr",
46+
"request": "launch",
47+
"preLaunchTask": "build only",
48+
"program": "${workspaceFolder}/src/MigrationTools.ConsoleDataGenerator/bin/Debug/net8.0/MigrationTools.ConsoleDataGenerator.dll",
49+
"args": [],
50+
"cwd": "${workspaceFolder}/src/MigrationTools.ConsoleDataGenerator/bin/Debug/net8.0",
51+
"console": "internalConsole",
52+
"stopAtEntry": false,
53+
"justMyCode": true,
54+
"env": {
55+
"DOTNET_ENVIRONMENT": "Development"
56+
}
4257
}
4358
]
4459
}

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
"azureFunctions.projectLanguage": "C#",
44
"azureFunctions.projectRuntime": "~4",
55
"debug.internalConsoleOptions": "neverOpen",
6-
"azureFunctions.preDeployTask": "publish (functions)"
6+
"azureFunctions.preDeployTask": "publish (functions)",
7+
"dotnet.defaultSolution": "MigrationTools.slnx"
78
}

appsettings.json

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@
178178
"Enabled": true,
179179
"Mappings": {
180180
}
181+
},
182+
"TfsWorkItemTypeValidatorTool": {
183+
"Enabled": true
181184
}
182185
},
183186
"CommonToolSamples": {
@@ -187,9 +190,25 @@
187190
"RepoInSource": "RepoInTarget"
188191
}
189192
},
190-
"TfsValidateRequiredFieldTool": {
193+
"TfsWorkItemTypeValidatorTool": {
191194
"Enabled": true,
192-
"Exclusions": [ "Work Request", "Opertunity", "Assumption" ]
195+
"IncludeWorkItemtypes": [
196+
"Bug",
197+
"Task",
198+
"User Story",
199+
"Product Backlog Item",
200+
"Feature",
201+
"Epic",
202+
"Risk"
203+
],
204+
"SourceFieldMappings": {
205+
"User Story": {
206+
"Microsoft.VSTS.Common.Prirucka": "Custom.Prirucka"
207+
}
208+
},
209+
"FixedTargetFields": {
210+
"User Story": ["Custom.Prirucka"]
211+
}
193212
},
194213
"FieldMappingTool": {
195214
"Enabled": true,

docs/content/docs/get-started/getting-started/index.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,49 @@ The default [TfsWorkItemMigrationProcesor]({{< ref "docs/reference/processors/tf
6565
7. Adjust the [`NodeBasePaths`]({{< ref "docs/reference/processors/workitem-tracking-processor" >}}) or leave empty to migrate all nodes
6666
8. From your working folder run `devopsmigration execute --config .\configuration.json`
6767

68+
### Common Issue: Work Item Type Validation Failures
69+
70+
> **⚠️ IMPORTANT:** The migration tools include automatic validation that runs before migration starts and can cause your migration to fail if source and target systems have different work item types or fields.
71+
72+
The [TfsWorkItemTypeValidatorTool]({{< ref "docs/reference/tools/tfsworkitemtypevalidatortool" >}}) automatically validates that:
73+
74+
- All source work item types exist in the target system (or have mappings configured)
75+
- Required fields exist in target work item types
76+
- Field types are compatible between source and target
77+
- The ReflectedWorkItemId field exists in target work item types
78+
79+
**If validation fails**, the migration will stop immediately with detailed error messages. Here's how to resolve common validation issues:
80+
81+
**Missing Work Item Types:**
82+
83+
```text
84+
Work item type 'Risk' does not exist in target system.
85+
```
86+
87+
- **Solution 1:** Create the missing work item type in your target system
88+
- **Solution 2:** Configure a work item type mapping to map 'Risk' to an existing type like 'Issue'
89+
- **Solution 3:** Exclude the work item type from your migration query
90+
91+
**Missing ReflectedWorkItemId Field:**
92+
93+
```text
94+
'User Story' does not contain reflected work item ID field 'Custom.ReflectedWorkItemId'.
95+
```
96+
97+
- **Solution:** Add the custom field to ALL work item types in your target project (see [ReflectedWorkItemId setup]({{< ref "docs/setup/reflected-workitem-id" >}}))
98+
99+
**Missing Custom Fields:**
100+
101+
```text
102+
Missing field 'Microsoft.VSTS.Common.CustomField' in 'User Story'.
103+
```
104+
105+
- **Solution 1:** Add the missing field to the target work item type
106+
- **Solution 2:** Configure field mapping to map to an existing field
107+
- **Solution 3:** Exclude the field from validation if it's not needed
108+
109+
For detailed troubleshooting and configuration options, see the [TfsWorkItemTypeValidatorTool documentation]({{< ref "docs/reference/tools/tfsworkitemtypevalidatortool" >}}).
110+
68111
**Remember:** If you want a processor to run, its `Enabled` attribute must be set to `true`.
69112

70113
Refer to the [Reference Guide]({{< ref "docs/reference" >}}) for more details.

docs/content/docs/how-to/creating-iteration-and-area-maps/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ discussionId: 1846
77
date: 2025-06-24T12:07:31Z
88

99
---
10-
As per the [documentation]({{< ref "docs/reference/tools/tfs-node-structure-tool" >}}), you need to add Iteration Maps and Area Maps that adapt the old locations to new ones that are valid in the Target.
10+
As per the [documentation]({{< ref "docs/reference/tools/tfsnodestructuretool" >}}), you need to add Iteration Maps and Area Maps that adapt the old locations to new ones that are valid in the Target.
1111

1212
**NOTE: It is NOT possible to migrate a work item if the Area or Iteration path does not exist on the target project. This is because the work item will be created with the same Area and Iteration path as the source work item. If the path does not exist, the work item will not be created. _There is no way around this!_**
1313

1414
Before your migration starts, it will validate that all of the Areas and Iterations from the **Source** work items revisions exist on the **Target**. Any that do not exist will be flagged in the logs, and if you have `"StopMigrationOnMissingAreaIterationNodes": true,` set, the migration will stop just after it outputs a list of the missing nodes.
1515

16-
Our algorithm that converts the Source nodes to Target nodes processes the [mappings]({{< ref "docs/reference/tools/tfs-node-structure-tool" >}}) at that time. This means that any valid mapped nodes will never be caught by the `This path is not anchored in the source project` message, as they are already altered to be valid.
16+
Our algorithm that converts the Source nodes to Target nodes processes the [mappings]({{< ref "docs/reference/tools/tfsnodestructuretool" >}}) at that time. This means that any valid mapped nodes will never be caught by the `This path is not anchored in the source project` message, as they are already altered to be valid.
1717

1818
> We recently updated the logging for this part of the system to more easily debug both your mappings and to see what the system is doing with the nodes and their current state. You can set `"LogLevel": "Debug"` to see the details.
1919
@@ -248,4 +248,4 @@ Here's a complete example showing the TfsNodeStructureTool configuration with bo
248248
}
249249
```
250250

251-
For more detailed information and advanced configuration options, refer to the complete [TFS Node Structure Tool documentation]({{< ref "docs/reference/tools/tfs-node-structure-tool" >}}).
251+
For more detailed information and advanced configuration options, refer to the complete [TFS Node Structure Tool documentation]({{< ref "docs/reference/tools/tfsnodestructuretool" >}}).
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
22
title: Field Maps
33
description: |
4-
Field Maps are used to define how fields in the source system map to fields in the target system during migration. This section provides an overview of the field maps used in the Azure DevOps Migration Tools, including their configuration and usage. See [Field Mapping Tool]({{< ref "docs/reference/tools/field-mapping-tool" >}}) for more information.
4+
Field Maps are used to define how fields in the source system map to fields in the target system during migration. This section provides an overview of the field maps used in the Azure DevOps Migration Tools, including their configuration and usage. See [Field Mapping Tool]({{< ref "docs/reference/tools/fieldmappingtool" >}}) for more information.
55
short_title: Field Maps
66
date: 2025-06-24T12:07:31Z
77
discussionId: 2792
88
aliases:
99
- /learn/azure-devops-migration-tools/Reference/FieldMaps/
1010

1111
---
12-
These fieldmaps are usied by the [Field Mapping Tool]({{< ref "docs/reference/tools/field-mapping-tool" >}}) to map fields from the source to the target system. The field maps are defined in the `fieldMaps` section of the configuration file.`
12+
These fieldmaps are usied by the [Field Mapping Tool]({{< ref "docs/reference/tools/fieldmappingtool" >}}) to map fields from the source to the target system. The field maps are defined in the `fieldMaps` section of the configuration file.`

0 commit comments

Comments
 (0)