✨ fix: include eeid & improve misc settings dump#2303
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Egg Inc coop-status fetch logic to optionally use an alternate endpoint with a user-specific EEID override (gated by a global guild setting), and improves the misc settings “dump” output to show raw values plus parsed CSV items with snowflake resolution.
Changes:
- Extend
ei.GetCoopStatus/ei.GetCoopStatusForCompletedContractsto accept aneeidOverrideand optionally switch to/ei/coop_status. - Wire a feature-toggle callback from
main.go(DEFAULT.coop_status_fix == "1") to enable the alternate endpoint. - Improve misc settings dump formatting and update all call sites for the new function signatures (including passing
encrypted_ei_idfor replay completed-contract lookups).
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/ei/coop_status.go | Adds EEID override + feature toggle hook, and switches endpoint when enabled. |
| main.go | Wires ei.CoopStatusFixEnabled to a guild setting to avoid import cycles. |
| src/boost/replay.go | Passes the user’s encrypted_ei_id into completed-contract coop-status fetches. |
| src/guildstate/slashcmd.go | Makes misc settings dump include raw values and parsed items with resolutions. |
| src/track/track_update.go | Updates GetCoopStatus call site for new signature. |
| src/boost/teamwork.go | Updates GetCoopStatus call site for new signature. |
| src/boost/stones.go | Updates GetCoopStatus call site for new signature. |
| src/boost/contract_report.go | Updates GetCoopStatusForCompletedContracts call site for new signature. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| func GetCoopStatus(contractID string, coopID string, eeidOverride string) (*ContractCoopStatusResponse, time.Time, string, error) { | ||
| eggIncID := config.EIUserIDBasic | ||
| reqURL := "https://www.auxbrain.com/ei/coop_status_bot" | ||
| if eeidOverride != "" && CoopStatusFixEnabled != nil && CoopStatusFixEnabled() { | ||
| eggIncID = DecryptEID(eeidOverride) | ||
| reqURL = "https://www.auxbrain.com/ei/coop_status" | ||
| } |
There was a problem hiding this comment.
When eeidOverride is provided and the fix is enabled, this switches to the user-authenticated coop_status endpoint but still uses the same in-memory cache key / file cache scheme (keyed only by contractID+coopID later in the function). That can let a response fetched with one user’s Egg Inc ID be served from cache to other callers (or to callers using the bot endpoint), effectively bypassing the endpoint’s authorization. Consider either including the effective Egg Inc ID + endpoint in the cache key / filename, or disabling cache reads/writes when using eeidOverride.
| if eeidOverride != "" && CoopStatusFixEnabled != nil && CoopStatusFixEnabled() { | ||
| eggIncID = DecryptEID(eeidOverride) | ||
| reqURL = "https://www.auxbrain.com/ei/coop_status" | ||
| } |
There was a problem hiding this comment.
DecryptEID returns an empty string on decode/decrypt failure, but the code will still proceed and send a request with UserId="" when eeidOverride is set. That likely yields confusing Unauthorized errors and can also poison caches with a response keyed only by contract+coop. Consider validating the decrypted ID (non-empty, looks like an EI* ID) and either falling back to the bot ID/endpoint or returning a clear error.
| func GetCoopStatusForCompletedContracts(contractID string, coopID string, eeidOverride string) (*ContractCoopStatusResponse, time.Time, string, error) { | ||
| eggIncID := config.EIUserIDBasic | ||
| reqURL := "https://www.auxbrain.com/ei/coop_status_bot" | ||
| if eeidOverride != "" && CoopStatusFixEnabled != nil && CoopStatusFixEnabled() { | ||
| eggIncID = DecryptEID(eeidOverride) | ||
| reqURL = "https://www.auxbrain.com/ei/coop_status" | ||
| } |
There was a problem hiding this comment.
The pb-completed on-disk cache is keyed only by contractID+coopID, but with eeidOverride enabled this function may fetch via the user-authenticated coop_status endpoint. Persisting that response to a shared filename allows later callers without the same Egg Inc ID (or without any ID) to read the cached data and bypass authorization. Consider namespacing the completed-cache filename by effective Egg Inc ID / endpoint, or skipping disk cache when eeidOverride is used.
No description provided.