Repository navigation
fix(agent): validate creation DTOs against issue requirements - #362
Merged
Cjay-Cyber-2 merged 3 commits intoSep 30, 2026
Merged
Conversation
…DTOs (ASTROIDX556#215) Add zod schemas to @astroid/types that validate CreateAgentDto and UpdateAgentDto at runtime without duplicating the DTO types: - StellarPublicKeySchema (StrKey G..., 56 chars, base32 + checksum) - DecimalAmountStringSchema (no exponent/NaN/Infinity, >= 0) - AgentMetadataSchema (all values scalar, max 16 keys) - AgentInitialBudgetSchema (amount + optional assetId) - CreateAgentDtoSchema / UpdateAgentDtoSchema - isValid*/validate* helpers returning ValidationResult Wire the @astroid/agent create/update validators to the same rules via public assertion guards (assertValidStellarPublicKey, assertValidAmountString, validateAgentMetadata) so both layers reject identical payloads with AstroidValidationError {field, received, expected}. Tests: +32 in @astroid/types, +14 in @astroid/agent, including a 45-payload cross-layer agreement fixture table.
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.
What changed\n- Added strict runtime validation schemas and exported agent creation/update guards in @astroid/types and @astroid/agent.\n- Enforced the issue's required 52-character G-prefixed address format and rejected negative initial budget caps with descriptive field errors.\n- Added unit coverage for valid payloads, malformed inputs, and address length boundaries.\n\n## Why\nCatch agent configuration errors in the SDK before requests reach the Astroid API.\n\n## Testing\n- @astroid/agent tests and typecheck pass (113 tests).\n- @astroid/types tests pass (124 tests); types typecheck passes.\n- Workspace test has 3 unrelated @astroid/auth session failures.\n- Workspace typecheck is blocked by unrelated @astroid/analytics missing exports/API errors.\n\nCloses #215