Skip to content

Split single-solution validation into SolutionValidator - #76

Merged
TomProkop merged 2 commits into
masterfrom
users/alexander.zekelin/solution-validator-split
Aug 19, 2026
Merged

Split single-solution validation into SolutionValidator#76
TomProkop merged 2 commits into
masterfrom
users/alexander.zekelin/solution-validator-split

Conversation

@zekelinAlex

Copy link
Copy Markdown
Contributor

Pulls the single-solution rules out of WorkspaceValidator into a standalone SolutionValidator, so a build pipeline can call one method on one solution folder instead of wiring validators individually. WorkspaceValidator now composes it per discovered solution and keeps the cross-solution parts for itself: the global GUID scan, files outside any solution root, and the relationship rules, which moved to workspace scope since a relationship and the entity it references may ship in different solutions. There's also a ValidateRelationships method for running just that pass on a multi-solution workspace.

CLI output stays as it was, with two small deltas: a solution that fails to load no longer aborts model validation of its siblings, and finding order shifted slightly. A missing Other/Solution.xml now reports as TXM005.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Extracts single-solution checks into SolutionValidator while retaining workspace-wide validation in WorkspaceValidator.

Changes:

  • Adds standalone solution validation and shared file scanning.
  • Moves relationship and cross-solution checks to workspace scope.
  • Adds TXM005 and multi-solution validation tests.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/TALXIS.Platform.Metadata.Validation/SolutionValidator.cs Implements single-solution validation.
src/TALXIS.Platform.Metadata.Validation/WorkspaceValidator.cs Composes solution and workspace-wide checks.
src/TALXIS.Platform.Metadata.Validation/WorkspaceFiles.cs Centralizes file enumeration rules.
src/TALXIS.Platform.Metadata.Validation/ValidationDiagnostics.cs Adds TXM005.
tests/TALXIS.Platform.Metadata.Tests/SolutionValidatorTests.cs Tests the new validator.
tests/TALXIS.Platform.Metadata.Tests/WorkspaceValidatorTests.cs Tests multi-solution behavior.
Suppressed comments (2)

src/TALXIS.Platform.Metadata.Validation/WorkspaceValidator.cs:122

  • Each relationship validator still receives one solution model; only a set of column names is workspace-wide. If a relationship is in solution A and its entity exists only in solution B, RelationshipValidator.ValidateColumnExists returns immediately because the entity is absent from A, so existence/type checks are skipped; conversely, B can report its lookup as orphaned because A's relationships are invisible. This defeats the cross-solution case that motivated moving this pass. Validate against a combined entity/relationship context (or pass workspace-wide entity and relationship indexes).
                results.AddRange(SolutionValidator.WithStage(
                    new RelationshipValidator().Validate(solution, workspaceColumns), ValidationStage.Relationship));

src/TALXIS.Platform.Metadata.Validation/WorkspaceValidator.cs:129

  • This catch handles exceptions thrown by relationship validation after the workspace has already loaded, so reporting “Failed to load workspace into model” misidentifies the failed operation and stage. Report a relationship-validation failure at the Relationship stage instead.
            catch (Exception ex)
            {
                results.Add(new ValidationResult(
                    ValidationSeverity.Error,
                    $"Failed to load workspace into model: {ex.Message}",
                    root, null, null) { Stage = ValidationStage.ModelLoad });

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +31 to +34
var solutionRoots = DiscoverSolutionRoots(workspacePath);
var workspaceIsSingleRoot = solutionRoots.Count == 0;
if (workspaceIsSingleRoot)
solutionRoots = new[] { workspacePath };
@TomProkop
TomProkop merged commit 17a07dd into master Aug 19, 2026
1 check passed
@zekelinAlex
zekelinAlex deleted the users/alexander.zekelin/solution-validator-split branch September 9, 2026 08:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants