mirror of
https://github.com/SigNoz/signoz.git
synced 2026-08-06 05:00:42 +01:00
Some checks failed
build-staging / prepare (push) Has been cancelled
build-staging / js-build (push) Has been cancelled
build-staging / go-build (push) Has been cancelled
build-staging / staging (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
* fix(dashboardtypes): accept threshold value of 0 on create A NumberPanel/TimeSeries/Table threshold with `value: 0` (a legitimate value the SigNoz UI emits by default) was rejected on create with `dashboard_invalid_input` "Field validation for 'Value' failed on the 'required' tag". go-playground/validator's `required` treats a numeric field equal to its zero value as "missing", so `validate:"required"` on the float `Value` wrongly rejected 0. Drop `validate:"required"` from `Value` on ThresholdWithLabel and ComparisonThreshold; keep `required:"true"` since the field is always present in the schema (0 is a valid present value, not an absent one), so the OpenAPI/generated client are unaffected. `Color` keeps both tags — an empty colour is genuinely invalid. Drop the two "missing value" cases from TestValidateRequiredFields, which asserted the removed invariant. * fix(querybuildertypesv5): round-trip zero-valued query spec fields A dashboard/alert query that sets a zero-valued field — `disabled: false`, `legend: ""`, or an explicit empty `groupBy`/`order`/`selectFields`/etc. — created fine but the GET response omitted it, so a typed client that echoes what it sent (Terraform, SDKs, PUT-after-GET) read back `null`/absent and reported drift. `,omitempty` dropped these zero values on the way out. Fix the create -> GET asymmetry: - Slice fields use `,omitzero` instead of `,omitempty`. `omitzero` omits a nil slice (field never set stays absent) but keeps an explicit non-nil `[]`, so an empty array round-trips as `[]` and there is no `null` regression. Applied to groupBy, order, selectFields, aggregations, functions, secondaryAggregations and function args across the builder, formula, trace-operator and join specs, plus ListPanelSpec.selectFields. - Scalars `disabled` (bool) and `legend` (string) drop the tag entirely; `omitzero`/`omitempty` both suppress false/"", so the only way to round-trip them is to always serialize. Result types in resp.go keep `,omitempty` — they are server-computed and never round-tripped. Regenerate docs/api/openapi.yml and the frontend client: the omitzero slices are now `nullable: true` in the schema (never null on the wire, but the generated types gain `| null`, which existing consumers already handle via `?? []`). * test(dashboard): round-trip serialization for zero-valued fields Add a v2 dashboards integration test that creates one minimal dashboard (stripped from SigNoz/dashboards cicd-perses.json) and asserts the create -> GET round-trip preserves every zero-valued field the fix targets: - threshold value 0 (ComparisonThreshold + ThresholdWithLabel) is accepted on create and echoed back - builder slices set to an explicit [] (groupBy/order/selectFields/functions) round-trip as [], while a bare builder's unset slices stay absent (never null) on read - scalars disabled/legend always echo false/"" Table-driven: one equality table for round-tripped values and one absence table for omitted slices. * test(dashboard): fold round-trip test into 03_v2_dashboard Move test_dashboard_v2_roundtrip_preserves_zero_values alongside the other v2 dashboard tests (test_create_rejects_*, lifecycle, ...) instead of a standalone file, with the dashboard payload inlined per this suite's style.