Skip to content

Commit ec00259

Browse files
committed
Fix Reason error format and update AGENTS.md with gating checks
Change error messages in Reason.Validate() and Reason.MarshalJSON() to use %d instead of %q. Reason is an integer type, and %q prints the value as a rune character rather than its integer representation, making the error message misleading. Add a dedicated "Gating Checks" section to AGENTS.md that lists the three mandatory pre-submit commands: gofmt, go test, and golangci-lint. Remove the now-redundant guidelines that mentioned running tests and following Go conventions, and merge the remaining numbered list.
1 parent 48323d0 commit ec00259

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

AGENTS.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@
1212
- It installs `cmd/list-models` and `cmd/scoreboard`, writes `docs/MODELS.md`, then runs `go generate ./...`.
1313
- If a provider fails after the env check, inspect the `list-models -strict -provider <provider>` error. The script deletes that provider's `Warmup.yaml` and runs `go test ./providers/<provider>/...` to expose stale recording issues. Never use `RECORD=all`.
1414

15+
## Gating Checks
16+
17+
Before submitting changes, run:
18+
19+
1. `gofmt -w -s .`
20+
2. `go test ./...`
21+
3. `golangci-lint run ./...`
22+
1523
## Directory Structure
1624

1725
- Shared client implementation: `base/`
@@ -165,9 +173,7 @@ func (o *Options) Validate() error {
165173
1. **Before making changes**: Understand the existing patterns and conventions
166174
2. **Write tests first**: Test-driven development is preferred
167175
3. **Update documentation**: Keep README.md and code comments current
168-
4. **Run the full test suite**: Ensure all tests pass before submitting
169-
5. **Follow Go conventions**: Use `gofmt`, `golint`, `go vet -vettool=shadow`, `staticcheck` and `gosec`
170-
6. **Add examples**: Include usage examples for new features
176+
4. **Add examples**: Include usage examples for new features
171177

172178
---
173179

scoreboard/scoreboard.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ func (t Reason) Validate() error {
383383
case ReasonNone, ReasonInline, ReasonAuto:
384384
return nil
385385
default:
386-
return fmt.Errorf("invalid Reason: %q", t)
386+
return fmt.Errorf("invalid Reason: %d", t)
387387
}
388388
}
389389

@@ -398,7 +398,7 @@ func (t Reason) MarshalJSON() ([]byte, error) {
398398
case ReasonAuto:
399399
return []byte(`"auto"`), nil
400400
default:
401-
return nil, fmt.Errorf("invalid Reason: %q", t)
401+
return nil, fmt.Errorf("invalid Reason: %d", t)
402402
}
403403
}
404404

0 commit comments

Comments
 (0)