clamp checkpoint token delta overflow · Entire

clamp checkpoint token delta overflow

0828cf5→main

Sessions

70741de008a8View transcript

Changes

2

55 unmodified lines

...
func newCheckpointTokensCmd() *cobra.Command {

}

func buildCheckpointMetricDelta(baseline, current int) *checkpointTokensMetricDelta {
  change := saturatingIntSub(current, baseline)
  delta := &checkpointTokensMetricDelta{
    ...
  }
  return delta
}

func saturatingIntSub(a, b int) int {
  ...
}

func maxInt() int {
  return int(^uint(0) >> 1)
}

func minInt() int {
  return -maxInt() - 1
}

func checkpointDeltaDirection(change int) string {
  switch {
  case change < 0:
    return "down"
  case change > 0:
    return "up"
  default:
    return "unchanged"
  }
}
func TestCheckpointTokensCmd_ComparisonUnavailableWhenBaselineTokenDataMissing(t *testing.T) {
  repo, _ := runExplainAutoTestRepo(t)
  ctx := context.Background()
}