Conversation
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Contributor
There was a problem hiding this comment.
1 issue found across 16 files
Confidence score: 5/5
- In
packages/sdk-go/scalar_unions.go,VariablePrimitiveandScrollPercentdecoding paths (especially discriminator/default branches) are under-tested, so subtle union-regression bugs could slip through and mis-handle numeric/string payloads at runtime; add focused round-trip tests for each variant and invalid non-scalar inputs to lock behavior down.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/sdk-go/scalar_unions.go">
<violation number="1" location="packages/sdk-go/scalar_unions.go:213">
P3: Successful numeric/string decoding for `VariablePrimitive` and `ScrollPercent` lacks focused coverage, leaving their discriminator/default branches unprotected. Add round-trip cases for each variant plus invalid non-scalar input.
(Based on your team's feedback about unit tests for new behavior.) [FEEDBACK_USED]</violation>
</file>
Architecture diagram
sequenceDiagram
participant Proto as Protocol Schema
participant Gen as Go Generator
participant SDK as Go SDK Package
participant CI as CI Pipeline
participant Dev as Developer
Note over Proto,Dev: Code Generation Pipeline
Dev->>Gen: Run "go generate ./..."
Gen->>Proto: Read stagehand.v4.json
Proto-->>Gen: Schema definitions
Gen->>Gen: Project schema (remove unions/unsupported)
Gen->>Gen: Pass projected schema to go-jsonschema
Gen-->>SDK: Write models.gen.go
alt CI check mode
CI->>Gen: Run generator --check
Gen->>Proto: Read stagehand.v4.json
Gen->>SDK: Read existing models.gen.go
alt Generated files match
Gen-->>CI: Exit 0
else Stale generated files
Gen-->>CI: Exit 1
end
end
Note over Dev,SDK: Build & Test Workflow
Dev->>SDK: go build ./...
Dev->>SDK: go vet ./...
Dev->>SDK: go test ./...
SDK->>SDK: Run unit tests
Note over SDK,Proto: Type System Boundary
SDK->>SDK: Generated types (models.gen.go)
SDK->>SDK: Hand-written union types (object_unions.go)
SDK->>SDK: Hand-written union types (scalar_unions.go)
SDK->>SDK: Hand-written union types (llm_unions.go)
SDK->>SDK: Flexible object handling (flexible_objects.go)
Note over SDK: Marshal/Unmarshal Flow
SDK->>SDK: JSON input arrives
alt Object union (type discriminator)
SDK->>SDK: Check "type" field
alt Known type
SDK->>SDK: Unmarshal to specific struct
else Unknown type
SDK-->>SDK: Return error
end
else Scalar union (JSON type)
SDK->>SDK: Check first JSON byte
alt String
SDK->>SDK: Unmarshal as string
else Number
SDK->>SDK: Unmarshal as number
else Boolean
SDK->>SDK: Unmarshal as bool
end
else Flexible object
SDK->>SDK: Unmarshal known fields
SDK->>SDK: Capture additional properties
end
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
sameelarif
reviewed
Jul 27, 2026
# Conflicts: # justfile
sameelarif
approved these changes
Jul 28, 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.
Adds generated Go structs, enums, and union types for the Stagehand protocol.