fleet-memory/hindsight-clients/go/model_observation_scopes.go
Nicolò Boschi 55af468187
feat: observation_scopes field to drive observations granularity (#447)
* feat: observation_scopes field to drive observations granularity

* fix(migration): make a2b3c4d5e6f7 a no-op to fix CI on fresh DB

The z1u2v3w4x5y6 migration already creates observation_scopes directly,
so the rename migration fails on fresh installs where observation_tags
never existed.

* chore: remove no-op migration a2b3c4d5e6f7

* feat: regenerate clients with observation_scopes field

- Add observation_scopes to OpenAPI spec and all generated clients
- Fix Rust build.rs to handle anyOf with >2 variants containing null
  (previously only handled 2-item anyOf, causing progenitor to panic
  on the observation_scopes union type)

* fix(rust): add observation_scopes: None to MemoryItem struct literals

* fix(api): add title to observation_scopes Field for deterministic client generation

Adding title="ObservationScopes" makes the inline anyOf schema use
the explicit name instead of deriving it from the field name, which
was non-deterministic between arm64 (macOS) and amd64 (CI) Docker.

Also fixes description: "each entity" -> "each tag".

* fix(scripts): use linux/amd64 Docker for client generation to ensure reproducibility

Both Python and Go client generation now use --platform linux/amd64
Docker, ensuring identical output on macOS arm64 (local) and Linux
amd64 (CI). Also switches Go from JAR+Java to Docker to eliminate
Java version variability.

* chore: update generated clients to API v0.4.14

* fix(test): add retry logic to test_retain_chinese_content to handle non-deterministic LLM output

* fix(test): mark test_retain_chinese_content as xfail due to non-deterministic LLM translation
2026-02-28 10:46:21 +01:00

112 lines
2.8 KiB
Go

/*
Hindsight HTTP API
HTTP API for Hindsight
API version: 0.4.14
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package hindsight
import (
"encoding/json"
"fmt"
)
// ObservationScopes How to scope observations during consolidation. 'per_tag' runs one consolidation pass per individual tag, creating separate observations for each tag. 'combined' (default) runs a single pass with all tags together. A list of tag lists runs one pass per inner list, giving full control over which combinations to use.
type ObservationScopes struct {
ArrayOfArrayOfString *[][]string
String *string
}
// Unmarshal JSON data into any of the pointers in the struct
func (dst *ObservationScopes) UnmarshalJSON(data []byte) error {
var err error
// this object is nullable so check if the payload is null or empty string
if string(data) == "" || string(data) == "{}" {
return nil
}
// try to unmarshal JSON data into ArrayOfArrayOfString
err = json.Unmarshal(data, &dst.ArrayOfArrayOfString);
if err == nil {
jsonArrayOfArrayOfString, _ := json.Marshal(dst.ArrayOfArrayOfString)
if string(jsonArrayOfArrayOfString) == "{}" { // empty struct
dst.ArrayOfArrayOfString = nil
} else {
return nil // data stored in dst.ArrayOfArrayOfString, return on the first match
}
} else {
dst.ArrayOfArrayOfString = nil
}
// try to unmarshal JSON data into String
err = json.Unmarshal(data, &dst.String);
if err == nil {
jsonString, _ := json.Marshal(dst.String)
if string(jsonString) == "{}" { // empty struct
dst.String = nil
} else {
return nil // data stored in dst.String, return on the first match
}
} else {
dst.String = nil
}
return fmt.Errorf("data failed to match schemas in anyOf(ObservationScopes)")
}
// Marshal data from the first non-nil pointers in the struct to JSON
func (src *ObservationScopes) MarshalJSON() ([]byte, error) {
if src.ArrayOfArrayOfString != nil {
return json.Marshal(&src.ArrayOfArrayOfString)
}
if src.String != nil {
return json.Marshal(&src.String)
}
return nil, nil // no data in anyOf schemas
}
type NullableObservationScopes struct {
value *ObservationScopes
isSet bool
}
func (v NullableObservationScopes) Get() *ObservationScopes {
return v.value
}
func (v *NullableObservationScopes) Set(val *ObservationScopes) {
v.value = val
v.isSet = true
}
func (v NullableObservationScopes) IsSet() bool {
return v.isSet
}
func (v *NullableObservationScopes) Unset() {
v.value = nil
v.isSet = false
}
func NewNullableObservationScopes(val *ObservationScopes) *NullableObservationScopes {
return &NullableObservationScopes{value: val, isSet: true}
}
func (v NullableObservationScopes) MarshalJSON() ([]byte, error) {
return json.Marshal(v.value)
}
func (v *NullableObservationScopes) UnmarshalJSON(src []byte) error {
v.isSet = true
return json.Unmarshal(src, &v.value)
}