Skip to content

Commit 03ce523

Browse files
six-ddcclaude
andcommitted
fix: resolve 4 bugs found in code review
- report.go: use += instead of = when aggregating status codes by section, fixing count loss when multiple codes share the same section (e.g. 200+201) - charts.go: fix JS syntax error data.push[null] -> data.push(null), fixing historical data padding for new status code series - requester.go: fix off-by-one in ramp-up loop (> to >=), preventing an extra goroutine from being launched - print.go: remove colorize() calls from JSON output functions, preventing ANSI escape codes from corrupting JSON Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 25642a3 commit 03ce523

4 files changed

Lines changed: 3 additions & 7 deletions

File tree

charts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ function {{ .ViewID }}_sync() {
119119
}else{
120120
let data = [];
121121
for (let i = 0; i < code200Count; i++) {
122-
data.push[null];
122+
data.push(null);
123123
}
124124
var newSeries = {
125125
name: code,

print.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,6 @@ func (p *Printer) buildJSONErrors(writer *bytes.Buffer, snapshot *SnapshotReport
382382
tab1 := strings.Repeat(" ", indent+1)
383383
errors := sortMapStrInt(snapshot.Errors)
384384
for i, v := range errors {
385-
v[1] = colorize(v[1], FgRedColor)
386385
vb, _ := json.Marshal(v[0])
387386
writer.WriteString(fmt.Sprintf(`%s%s: %s`, tab1, vb, v[1]))
388387
if i != len(errors)-1 {
@@ -427,9 +426,6 @@ func (p *Printer) buildJSONSummary(writer *bytes.Buffer, snapshot *SnapshotRepor
427426
codes := sortMapStrInt(snapshot.Codes)
428427
for _, v := range codes {
429428
i++
430-
if v[0] != "2xx" {
431-
v[1] = colorize(v[1], FgMagentaColor)
432-
}
433429
writer.WriteString(fmt.Sprintf(`%s"%s": %s`, tab2, v[0], v[1]))
434430
if i != len(snapshot.Codes) {
435431
writer.WriteString(",")

report.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ func (s *StreamReport) Snapshot() *SnapshotReport {
244244
rs.Codes = make(map[string]int64, len(s.codes))
245245
for k, v := range s.codes {
246246
section := k / 100
247-
rs.Codes[httpStatusSectionLabelMap[section]] = v
247+
rs.Codes[httpStatusSectionLabelMap[section]] += v
248248
}
249249
rs.Errors = make(map[string]int64, len(s.errors))
250250
for k, v := range s.errors {

requester.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ func (r *Requester) Run() {
328328
loopCount := int(math.Ceil(float64(r.concurrency) / float64(r.rampUp)))
329329
for i := 0; i < loopCount; i++ {
330330
for j := 0; j < r.rampUp; j++ {
331-
if concurrencyCount > r.concurrency {
331+
if concurrencyCount >= r.concurrency {
332332
break
333333
}
334334
concurrencyCount++

0 commit comments

Comments
 (0)