Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates several coop-status fetch paths to pass the caller’s stored encrypted_ei_id into Egg Inc coop status API calls, enabling the codepath that uses the alternate /ei/coop_status endpoint when the “coop status fix” is enabled.
Changes:
- Thread
encrypted_ei_id(fromfarmerstate) through teamwork, stones, contract report, and tracker coop-status fetch flows. - Extend teamwork/stones caches to retain the EI ID override for refresh/page interactions.
- Update estimated-time refresh logic to supply user context to the tracker coop-status fetch.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/track/track_update.go | Passes encrypted_ei_id into ei.GetCoopStatus for tracker refresh; updates tracker download signature. |
| src/boost/teamwork.go | Fetches encrypted_ei_id and passes it into teamwork coop-status download; stores it in cache. |
| src/boost/teamwork_pages.go | Persists eiID in cache and uses it on refresh/page rebuild. |
| src/boost/stones.go | Fetches encrypted_ei_id and passes it into stones coop-status download; stores it in cache. |
| src/boost/stones_pages.go | Persists eiID in cache and uses it on refresh/page rebuild. |
| src/boost/estimate_scores.go | Uses interaction user’s encrypted_ei_id when downloading teamwork coop status for estimates. |
| src/boost/contract_report.go | Passes caller’s encrypted_ei_id into GetCoopStatusForCompletedContracts. |
| src/boost/boost_speedrun.go | Updates estimated-time refresh call to pass reacting user ID. |
| src/boost/boost_reactions.go | Updates estimated-time refresh plumbing and tracker calls to include user ID. |
| src/boost/boost_menu.go | Updates menu “time” action to pass user ID into estimated-time refresh. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| func DownloadCoopStatusTracker(contractID string, coopID string, userID string) (time.Time, float64, error) { | ||
| nowTime := time.Now() | ||
|
|
||
| eiContract := ei.EggIncContractsAll[contractID] | ||
| if eiContract.ID == "" { | ||
| return time.Time{}, 0, fmt.Errorf("invalid contract ID") | ||
| } | ||
|
|
||
| coopStatus, _, _, err := ei.GetCoopStatus(contractID, coopID, "") | ||
| eiID := farmerstate.GetMiscSettingString(userID, "encrypted_ei_id") | ||
| coopStatus, _, _, err := ei.GetCoopStatus(contractID, coopID, eiID) |
There was a problem hiding this comment.
DownloadCoopStatusTracker now accepts a Discord userID and reaches into farmerstate to fetch "encrypted_ei_id" internally. This couples the track package to farmerstate and makes the function harder to reuse/test; it also hides a potentially mutating map access (newFarmer / map init) behind what looks like a pure API call. Consider changing this to accept an eeidOverride (encrypted EI ID) like the other DownloadCoopStatus* helpers, and do the farmerstate lookup at the call site (where you already have user context).
| @@ -260,7 +260,7 @@ func updateEstimatedTime(s *discordgo.Session, channelID string, contract *Contr | |||
| data.Content = "⏱️ reaction received, updating contract duration." | |||
| data.Flags = discordgo.MessageFlagsEphemeral | |||
| msg, msgErr := s.ChannelMessageSendComplex(channelID, &data) | |||
| startTime, contractDurationSeconds, err := track.DownloadCoopStatusTracker(contract.ContractID, contract.CoopID) | |||
| startTime, contractDurationSeconds, err := track.DownloadCoopStatusTracker(contract.ContractID, contract.CoopID, userID) | |||
| if err == nil { | |||
There was a problem hiding this comment.
updateEstimatedTime is launched in a goroutine and now calls track.DownloadCoopStatusTracker, which (after this PR) performs a farmerstate lookup to get "encrypted_ei_id". farmerstate.GetMiscSettingString can mutate shared maps (newFarmer / map init), so doing this from background goroutines increases the chance of concurrent map access panics. Safer pattern: resolve the encrypted EI ID before starting the goroutine and pass the eeidOverride string through (and/or update DownloadCoopStatusTracker to take eeidOverride directly).
No description provided.