Add UNKNOWN and NOT_IMPLEMENTED measure states

Introduce two new measure states across the full stack: database
migration, Go coredata, GraphQL schema, MCP specification, and
frontend UI (labels, badge variants, and colors).

Signed-off-by: Bryan Frimin <bryan@getprobo.com>
This commit is contained in:
Bryan Frimin
2026-04-01 17:45:19 +02:00
parent d069201899
commit a2f0a37b7b
8 changed files with 49 additions and 1 deletions

View File

@@ -19,6 +19,8 @@ export const measureStates = [
"IN_PROGRESS", "IN_PROGRESS",
"NOT_APPLICABLE", "NOT_APPLICABLE",
"NOT_STARTED", "NOT_STARTED",
"UNKNOWN",
"NOT_IMPLEMENTED",
] as const; ] as const;
export function getMeasureStateLabel(__: Translator, state: string) { export function getMeasureStateLabel(__: Translator, state: string) {
@@ -31,6 +33,10 @@ export function getMeasureStateLabel(__: Translator, state: string) {
return __("Not Applicable"); return __("Not Applicable");
case "NOT_STARTED": case "NOT_STARTED":
return __("Not Started"); return __("Not Started");
case "UNKNOWN":
return __("Unknown");
case "NOT_IMPLEMENTED":
return __("Not Implemented");
default: default:
return __("Unknown"); return __("Unknown");
} }

View File

@@ -31,6 +31,8 @@ const stateToVariant: Record<
IN_PROGRESS: "info", IN_PROGRESS: "info",
NOT_APPLICABLE: "neutral", NOT_APPLICABLE: "neutral",
NOT_STARTED: "neutral", NOT_STARTED: "neutral",
UNKNOWN: "neutral",
NOT_IMPLEMENTED: "danger",
}; };
export function MeasureBadge({ state }: Props) { export function MeasureBadge({ state }: Props) {

View File

@@ -25,7 +25,7 @@ export default {
type Story = StoryObj<typeof MeasureImplementation>; type Story = StoryObj<typeof MeasureImplementation>;
type MeasureState = "IMPLEMENTED" | "IN_PROGRESS" | "NOT_APPLICABLE" | "NOT_STARTED"; type MeasureState = "IMPLEMENTED" | "IN_PROGRESS" | "NOT_APPLICABLE" | "NOT_STARTED" | "UNKNOWN" | "NOT_IMPLEMENTED";
export const Default: Story = { export const Default: Story = {
args: { args: {

View File

@@ -31,6 +31,8 @@ const stateToColor: Record<MeasureState, string> = {
IN_PROGRESS: "bg-border-warning", IN_PROGRESS: "bg-border-warning",
NOT_APPLICABLE: "bg-border-info", NOT_APPLICABLE: "bg-border-info",
NOT_STARTED: "bg-highlight", NOT_STARTED: "bg-highlight",
UNKNOWN: "bg-highlight",
NOT_IMPLEMENTED: "bg-border-danger",
}; };
export function MeasureImplementation({ measures, className }: Props) { export function MeasureImplementation({ measures, className }: Props) {

View File

@@ -28,6 +28,8 @@ const (
MeasureStateInProgress MeasureStateInProgress
MeasureStateNotApplicable MeasureStateNotApplicable
MeasureStateImplemented MeasureStateImplemented
MeasureStateUnknown
MeasureStateNotImplemented
) )
func MeasureStates() []MeasureState { func MeasureStates() []MeasureState {
@@ -36,6 +38,8 @@ func MeasureStates() []MeasureState {
MeasureStateInProgress, MeasureStateInProgress,
MeasureStateNotApplicable, MeasureStateNotApplicable,
MeasureStateImplemented, MeasureStateImplemented,
MeasureStateUnknown,
MeasureStateNotImplemented,
} }
} }
@@ -55,6 +59,10 @@ func (ms *MeasureState) UnmarshalText(data []byte) error {
*ms = MeasureStateNotApplicable *ms = MeasureStateNotApplicable
case MeasureStateImplemented.String(): case MeasureStateImplemented.String():
*ms = MeasureStateImplemented *ms = MeasureStateImplemented
case MeasureStateUnknown.String():
*ms = MeasureStateUnknown
case MeasureStateNotImplemented.String():
*ms = MeasureStateNotImplemented
default: default:
return fmt.Errorf("invalid MeasureState value: %q", val) return fmt.Errorf("invalid MeasureState value: %q", val)
} }
@@ -74,6 +82,10 @@ func (ms MeasureState) String() string {
val = "NOT_APPLICABLE" val = "NOT_APPLICABLE"
case MeasureStateImplemented: case MeasureStateImplemented:
val = "IMPLEMENTED" val = "IMPLEMENTED"
case MeasureStateUnknown:
val = "UNKNOWN"
case MeasureStateNotImplemented:
val = "NOT_IMPLEMENTED"
} }
return val return val

View File

@@ -0,0 +1,16 @@
-- Copyright (c) 2025-2026 Probo Inc <hello@getprobo.com>.
--
-- Permission to use, copy, modify, and/or distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
--
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
-- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
-- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
-- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-- PERFORMANCE OF THIS SOFTWARE.
ALTER TYPE mitigation_state ADD VALUE IF NOT EXISTS 'UNKNOWN';
ALTER TYPE mitigation_state ADD VALUE IF NOT EXISTS 'NOT_IMPLEMENTED';

View File

@@ -54,6 +54,14 @@ enum MeasureState
@goEnum( @goEnum(
value: "go.probo.inc/probo/pkg/coredata.MeasureStateImplemented" value: "go.probo.inc/probo/pkg/coredata.MeasureStateImplemented"
) )
UNKNOWN
@goEnum(
value: "go.probo.inc/probo/pkg/coredata.MeasureStateUnknown"
)
NOT_IMPLEMENTED
@goEnum(
value: "go.probo.inc/probo/pkg/coredata.MeasureStateNotImplemented"
)
} }
enum TaskState @goModel(model: "go.probo.inc/probo/pkg/coredata.TaskState") { enum TaskState @goModel(model: "go.probo.inc/probo/pkg/coredata.TaskState") {

View File

@@ -1350,6 +1350,8 @@ components:
- IN_PROGRESS - IN_PROGRESS
- NOT_APPLICABLE - NOT_APPLICABLE
- IMPLEMENTED - IMPLEMENTED
- UNKNOWN
- NOT_IMPLEMENTED
go.probo.inc/mcpgen/type: go.probo.inc/probo/pkg/coredata.MeasureState go.probo.inc/mcpgen/type: go.probo.inc/probo/pkg/coredata.MeasureState
MeasureOrderField: MeasureOrderField: