(field: string, oldVal: unknown, newVal: unknown)
| 558 | const EPSILON = 0.001; |
| 559 | |
| 560 | const compare = (field: string, oldVal: unknown, newVal: unknown) => { |
| 561 | if (oldVal === undefined && newVal === undefined) return; |
| 562 | const isDiff = field.startsWith("cost.") |
| 563 | ? Math.abs((oldVal as number ?? 0) - (newVal as number ?? 0)) > EPSILON |
| 564 | : JSON.stringify(oldVal) !== JSON.stringify(newVal); |
| 565 | if (isDiff) changes.push({ field, oldValue: formatValue(oldVal), newValue: formatValue(newVal) }); |
| 566 | }; |
| 567 | |
| 568 | compare("name", existing.name, merged.name); |
| 569 | compare("reasoning", existing.reasoning, merged.reasoning); |
no test coverage detected