Align action API validation across SDKs with shared conformance cases - #1
Open
chinnuteja wants to merge 1 commit into
Open
chinnuteja wants to merge 1 commit into
chinnuteja wants to merge 1 commit into
Conversation
Require metric action_kind and decision, validate ActionKind values, and check Python tool.name. Reject malformed Python kinds with ValidationError. Add 36 shared cases with request-count assertions. Require each mandatory field omission to pair with an otherwise identical accepted input, and exercise the coverage guard with regression tests. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This branch has not been deployed
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.
Python and TypeScript currently send metrics that omit required
action_kindordecisionvalues, while Go rejects them locally. The action endpoints also disagree with the publishedActionKindenum and requiredToolCall.name. This change aligns those validation paths and adds shared regression cases.Reproduced inconsistencies
These are client-side results against upstream
e24b983. Accept means the client reaches the request path; reject means it fails locally.action_kinddecision: ""kind: "tests"tool: {}Missing
decisionalso passes Python and TypeScript validation: their token checks default absent values to an empty string, which matches the token pattern.Changes
action_kindand nonemptydecisionin Python and TypeScript metrics.tool.namein Python actions, and report non-string kinds asValidationError.MetricEventandActionEnvelopeneeds a reject-case that differs from an accepted input only by omission of that field. Invalid-value cases and descriptive field labels cannot substitute for omission coverage. Four regression tests exercise this guard.No new runtime or test dependencies and no Makefile changes.
Verification
go test -count=1 ./...passes.py.typed), pack/install/import the npm package, typecheck its declarations with strict NodeNext settings, and build/run a Go downstream consumer. The repository's Bashmake test-distremains for Linux CI.Server behavior has not been tested. These changes enforce the published request contract locally and tighten previously permissive validation, including rejection of unknown enum values.
All three clients still reject
result: "", although the schema permits it. This existing discrepancy is left for a separate decision about whether the schema or clients should change.