Skip to content

fix(s3aar): correct enrich lookup inputs + close empty-payload gap (#151 #152 #153 #154)#156

Merged
SyniRon merged 3 commits into
developfrom
fix/151-s3aar-enrich-followups
Jun 4, 2026
Merged

fix(s3aar): correct enrich lookup inputs + close empty-payload gap (#151 #152 #153 #154)#156
SyniRon merged 3 commits into
developfrom
fix/151-s3aar-enrich-followups

Conversation

@SyniRon

@SyniRon SyniRon commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Bundles the four ready-for-agent follow-ups from the #150 review. All four converge on commands/s3aar.go / commands/s3aar_test.go, so they were implemented as one sequential TDD pass to avoid self-collision.

Issues

Verification

Full CI gate re-run independently in the worktree: golangci-lint 0 issues, go mod tidy clean, go test ./... -race -cover pass, coverage floors met (commands 82.6% ≥ 81%, utils 88.1% ≥ 87%), go build OK.

Manual review gate

⚠️ /s3aar is a user-facing command — per CLAUDE.md this needs a smoke test on the test guild before merge (CI can't exercise the live Discord gateway). The empty-payload and raw-tag paths are the behaviors to eyeball.

🤖 Generated with Claude Code

SyniRon and others added 3 commits June 3, 2026 22:30
 #152 #153 #154)

Four #150-review follow-ups, all on commands/s3aar.go / s3aar_test.go:

- #151: pass the raw BattleMetrics name to enrichPlayer so the gamertag
  fallback queries the uncleaned in-game tag; the username branch still
  cleans. Stops inflated "verify manually" lines.
- #152: validateProfile rejects a milpacs 2xx with empty rank/username or
  empty roster, routing such players to the ⚠️ warning field instead of
  emitting a blank [URL='...'] [/URL] ghost forum line. EnrichFailed now
  means "usable enrichment", not merely "HTTP succeeded".
- #153: assert EnrichFailed round-trips (value + json:"enrich_failed" tag)
  in the /s3aar debug JSON.
- #154: cover the enrichPlayer UniformUrl-regex-failure branch (2xx with
  malformed UniformUrl) as a surfaced enrichment failure.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Fix inverted invariant + present-tense rationale in validateProfile doc
  comment (a non-failed player means "usable enrichment", and the ghost-line
  hazard it guards is the pre-fix motivation, not current behavior).
- Fold the player name into validateProfile error strings so an enrichment
  failure stays attributable even if a future caller logs only the error.
- Add TestRunS3aar_EmptyRosterOnlyTreatedAsFailure covering validateProfile's
  empty-Roster-only clause (the existing empty-fields test only trips the
  rank/username clause).
- Tighten the #154 regex-branch test to assert the WARN log carries the
  UniformUrl error text, pinning that branch vs an identical-looking 404.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- gofmt: align trailing comments in s3aar_test.go (golangci-lint defaults
  don't run gofmt, so this wasn't caught by the CI gate).
- Distinguish the two UniformUrl regex-miss errors by lookup origin
  (username-lookup vs gamertag-lookup) so an operator can tell which profile
  carried the malformed URL from the WARN log alone.
- Add TestRunS3aar_GamertagFallbackEmptyFieldsTreatedAsFailure, pinning the
  validateProfile guard on the gamertag fallback branch (previously a copy
  uncovered by any test — mutation-confirmed it fails when the guard is
  dropped).
- Tighten the empty-fields / empty-roster WARN assertions to pin the specific
  validateProfile clause ("unusable enrichment" / "empty roster") and the
  attributed player name, matching the #154 test's precision.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@SyniRon SyniRon merged commit 2fb2372 into develop Jun 4, 2026
2 checks passed
@SyniRon SyniRon deleted the fix/151-s3aar-enrich-followups branch June 4, 2026 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment