feat(#1632): reject Guid-shaped display_name on entity create/update - #1640
Merged
Merged
Conversation
A display_name that parses as a Guid in any standard form would collide with the Guid-first addressing surface defined by #1629 — CLI lookups and API by-id routes would silently bypass display-name search (or worse, return a different real entity whose Guid happens to match). Adds Cvoya.Spring.Core.Validation.DisplayNameValidator covering all five Guid forms (N, D, B, P, X) explicitly via Guid.TryParseExact; also rejects empty/whitespace, control characters, and >256-char input with structured error codes. Wires it into the agent / unit / platform- tenant create+update endpoints behind a shared DisplayNameProblems helper that emits 400 ProblemDetails with the structured `code` extension so the CLI and portal can pattern-match on a stable code. Closes #1632. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
savasp
approved these changes
May 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A
display_namethat parses as a Guid in any standard form would collide with the Guid-first addressing surface defined by #1629 — CLI lookups and API by-id routes would silently bypass display-name search (or, worse, return a different real entity whose Guid happens to match). This PR rejects the collision class at write time.Cvoya.Spring.Core.Validation.DisplayNameValidatorcovers every Guid form (N,D,B,P,X) explicitly viaGuid.TryParseExact—Guid.TryParseis lenient but does NOT accept the hex-blockXform, so the explicit fan-out is load-bearing.display_name_is_empty,display_name_is_guid_shape,display_name_contains_control_chars,display_name_too_long).DisplayNameProblemshelper that emits400 ProblemDetailswith the structuredcodeextension so the CLI and portal can pattern-match on a stable contract.display_name(those values come from the type descriptor); agent metadata PATCH carries nodisplay_namefield. No other create/update surface needed wiring.Per the issue brief, the portal change is intentionally out of scope for this PR — the portal will surface the API's 400 generically and a friendlier message can be a follow-up.
Closes #1632.
Test plan
dotnet build SpringVoyage.slnx— 0 warnings, 0 errors.dotnet format SpringVoyage.slnx --verify-no-changes— clean.dotnet test --solution SpringVoyage.slnx --no-build— 3490/3490 passing (4 skipped, 0 failed).npm run lint— clean.npm --workspace=spring-voyage-dashboard run typecheck— clean.npm run --workspace=spring-voyage-dashboard build— clean.codeshape onPOST /api/v1/tenant/agents,POST /api/v1/tenant/units,PATCH /api/v1/tenant/units/{id},POST /api/v1/platform/tenants,PATCH /api/v1/platform/tenants/{id}, plus the PATCH-with-null-DisplayName no-op path.