Repository navigation
feat(types,agent): strict runtime validation for agent DTOs - #361
Merged
Cjay-Cyber-2 merged 4 commits intoOct 1, 2026
Merged
Cjay-Cyber-2 merged 4 commits into
Cjay-Cyber-2 merged 4 commits into
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
@astroid/typesand export the agent validation utilities from@astroid/agent.Why
Catch malformed agent payloads on the client with field-specific validation errors instead of waiting for API rejection.
Testing
@astroid/types: 124 tests passed; package typecheck passed.@astroid/agent: 113 tests passed; package typecheck passed.Closes #215