Skip to content

fix: quest test alerts missing static maps#153

Merged
hokiepokedad2 merged 1 commit into
mainfrom
fix/quest-test-alert-static-maps
Apr 7, 2026
Merged

fix: quest test alerts missing static maps#153
hokiepokedad2 merged 1 commit into
mainfrom
fix/quest-test-alert-static-maps

Conversation

@hokiepokedad2
Copy link
Copy Markdown
Contributor

Summary

  • Restructured BuildQuestWebhook to use Golbat's webhook format with a proper rewards array ([{type, info}]) and correct field names (type, target, title), so PoracleNG's enricher can resolve imgUrl and generate static map tiles
  • Fixed BuildInvasionWebhook sending grunt_type as string instead of int, which caused silent JSON deserialization failure in PoracleNG (grunt type defaulted to 0)

Test plan

  • dotnet build succeeds
  • All 29 TestAlert tests pass
  • Send a quest test alert from the web UI and verify the Discord notification includes a static map image
  • Send an invasion test alert and verify the correct grunt type is displayed

Closes #152

…ormat

The BuildQuestWebhook method was sending quest data in a flat format
(quest_type, quest_reward_type, pokemon_id) that doesn't match
PoracleNG's expected QuestWebhook structure. Without a proper `rewards`
array, the enricher couldn't resolve imgUrl, causing the tileservercache
to fail and produce empty staticMap fields.

Restructured to use Golbat's webhook format with a typed rewards array
and correct field names (type, target, title).

Also fixed BuildInvasionWebhook sending grunt_type as string instead of
int, which caused silent JSON deserialization failure in PoracleNG.

Closes #152
@hokiepokedad2 hokiepokedad2 force-pushed the fix/quest-test-alert-static-maps branch from c789c34 to a0738e9 Compare April 7, 2026 15:31
Copy link
Copy Markdown
Contributor Author

@hokiepokedad2 hokiepokedad2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review — PR #153

Executive Summary

Metric Rating
Overall ✅ Approved
Code Quality Good
Requirements Satisfied Yes
Architecture Fit Consistent
Risk Level Low

Review Findings

No critical or major issues found.

Minor Observations (Informational)

File Line Observation Notes
TestAlertService.cs 239 Stardust default 1000 Sensible default; matches typical stardust quest rewards
TestAlertService.cs 243 Candy amount hardcoded to 3 Reasonable for test purposes
TestAlertService.cs 251 Mega energy hardcoded to 50 Standard mega energy amount
TestAlertService.cs 254 Default case falls back to pokemon encounter Good safety net — ensures imgUrl is always resolvable
TestAlertService.cs 267 title hardcoded to catch_3 Acceptable for test alerts — the quest title is cosmetic in the DTS template (questString is resolved by PoracleNG's translation layer from this key)

What's Good

  1. Root cause correctly identified: The Golbat webhook format requires a rewards array with {type, info} objects. The old flat format (quest_reward_type, pokemon_id) was silently ignored by PoracleNG's QuestWebhook struct, leaving rewards empty → no imgUrl → tileserver failure.

  2. Reward type coverage is thorough: All 5 reward types (item, stardust, candy, pokemon, mega energy) are handled with correct info field structures matching parseQuestReward() in the PoracleNG processor.

  3. Default case is a smart addition: Unknown reward types fall back to pokemon encounter, ensuring imgUrl is always populated so the tileserver never receives an empty marker URL.

  4. Invasion fix is correct: grunt_type must be int to match InvasionWebhook.GruntType int json:"grunt_type". The old string value caused Go's json.Unmarshal to silently skip the field, defaulting to 0 (unknown grunt).

  5. Field name corrections are accurate: type (not quest_type), target (not quest_target), title (not quest_reward_type) — verified against QuestWebhook struct in processor/internal/webhook/types.go.

Test Coverage

  • All 29 TestAlert backend tests pass
  • All 721 backend tests pass
  • All 509 frontend tests pass
  • Existing tests validate API contract (type, target, template) — they don't assert webhook payload structure, which is acceptable since the payload format is a PoracleNG integration contract, not a unit-testable business rule

Risk Assessment

Risk Level Notes
Breaking Change None Only affects test alert payloads, not real webhook processing
Data Integrity None No database changes
Performance None Same code path, slightly more object construction
Security None No auth/input changes
Rollback Trivial Single file revert

Verdict: ✅ APPROVED

Clean, well-scoped fix that correctly aligns the test alert webhook payload with PoracleNG's expected Golbat format. The invasion grunt_type fix is a good bonus catch.

@hokiepokedad2 hokiepokedad2 merged commit ac96e42 into main Apr 7, 2026
4 checks passed
@hokiepokedad2 hokiepokedad2 deleted the fix/quest-test-alert-static-maps branch April 7, 2026 15:56
github-actions Bot added a commit that referenced this pull request Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: quest test alerts missing static maps due to incorrect webhook format

1 participant