MCPcopy Create free account
hub / github.com/github/gh-aw / compareRetainedUpdateState

Function compareRetainedUpdateState

pkg/cli/outcome_eval_update.go:127–150  ·  view source on GitHub ↗
(beforeState map[string]any, afterState map[string]any, currentState map[string]any, fields []string)

Source from the content-addressed store, hash-verified

125}
126
127func compareRetainedUpdateState(beforeState map[string]any, afterState map[string]any, currentState map[string]any, fields []string) retainedStateComparison {
128 var out retainedStateComparison
129 for _, field := range fields {
130 afterValue, ok := afterState[field]
131 if !ok {
132 continue
133 }
134 beforeValue := beforeState[field]
135 if mutableStateEqual(field, beforeValue, afterValue) {
136 continue
137 }
138 out.Changed = append(out.Changed, field)
139 currentValue := currentState[field]
140 switch {
141 case mutableStateEqual(field, currentValue, afterValue):
142 out.Retained = append(out.Retained, field)
143 case mutableStateEqual(field, currentValue, beforeValue):
144 out.Reverted = append(out.Reverted, field)
145 default:
146 out.Replaced = append(out.Replaced, field)
147 }
148 }
149 return out
150}
151
152func mutableTrackedFields(itemType string) []string {
153 switch itemType {

Callers 1

evalRetainedUpdateFunction · 0.85

Calls 1

mutableStateEqualFunction · 0.85

Tested by

no test coverage detected