* ci: add Go client integration tests Add test-go-client job to CI workflow following the same pattern as Python, TypeScript, and Rust client tests. The job: - Sets up Go 1.23 with dependency caching - Starts the Hindsight API server - Runs integration tests using the 'integration' build tag - Displays server logs on failure The integration tests (hindsight-clients/go/integration_test.go) cover all core operations: retain, recall, reflect, bank management, and end-to-end workflows. * Move Go cookbook content to hindsight-cookbook repo Removes Go-specific cookbook content that was added in PR #375: - applications/go-memory-service.md - recipes/go-quickstart.md - recipes/go-concurrent-pipeline.md These have been moved to the hindsight-cookbook repository where cookbook content should live per project conventions. * feat(go): add CI test for Go client and patch for ogen null handling - Add test-go-client job to GitHub Actions CI workflow - Create post-generation patch script (patch-ogen.sh) to fix ogen's handling of null values in optional string fields - Patch OptString.Decode() to check jx.Next() type before decoding, properly handling explicit null in JSON responses The patch ensures generated code persists across regenerations and handles the Hindsight API's nullable optional fields correctly. Fixes: Go client integration tests for retain and bank operations Note: Some tests still fail for nullable arrays/objects - those require additional patches for other Opt* types. * feat: use official go generator for Go client * feat: use official go generator for Go client * ci fixes * chore: sync Go client with latest OpenAPI spec - Add model_child_operation_status.go (new model) - Update model_operation_status_response.go with child operations - Update go.mod/go.sum dependencies - Update api/openapi.yaml
49 lines
1.1 KiB
Go
49 lines
1.1 KiB
Go
package hindsight
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
// Test that the client can handle null values in responses
|
|
func TestNullHandling(t *testing.T) {
|
|
apiURL := os.Getenv("HINDSIGHT_API_URL")
|
|
if apiURL == "" {
|
|
apiURL = "http://localhost:8888"
|
|
}
|
|
|
|
cfg := NewConfiguration()
|
|
cfg.Servers = ServerConfigurations{
|
|
{URL: apiURL},
|
|
}
|
|
|
|
client := NewAPIClient(cfg)
|
|
ctx := context.Background()
|
|
|
|
// Test retain which returns operation_id as null
|
|
req := RetainRequest{
|
|
Items: []MemoryItem{
|
|
{Content: "Test content for null handling"},
|
|
},
|
|
}
|
|
|
|
resp, httpResp, err := client.MemoryAPI.RetainMemories(ctx, "test_null_bank").RetainRequest(req).Execute()
|
|
if err != nil {
|
|
t.Fatalf("Retain failed: %v", err)
|
|
}
|
|
defer httpResp.Body.Close()
|
|
|
|
if !resp.GetSuccess() {
|
|
t.Error("Expected success=true")
|
|
}
|
|
|
|
// Check that operation_id can be accessed even if null
|
|
if resp.HasOperationId() {
|
|
t.Logf("OperationId is set: %s", resp.GetOperationId())
|
|
} else {
|
|
t.Log("OperationId is not set (null or omitted) - this is OK!")
|
|
}
|
|
|
|
t.Logf("✅ Successfully handled response with nullable fields")
|
|
}
|