Skip to content

✨feat: pass encrypted_e_id coop status calls#2304

Merged
mkmccarty merged 1 commit intomainfrom
mm-branch-3
Apr 2, 2026
Merged

✨feat: pass encrypted_e_id coop status calls#2304
mkmccarty merged 1 commit intomainfrom
mm-branch-3

Conversation

@mkmccarty
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings April 2, 2026 20:02
@mkmccarty mkmccarty merged commit c59143e into main Apr 2, 2026
12 of 14 checks passed
@mkmccarty mkmccarty deleted the mm-branch-3 branch April 2, 2026 20:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 (from farmerstate) 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.

Comment on lines +64 to +73
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)
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

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).

Copilot uses AI. Check for mistakes.
Comment on lines 248 to 264
@@ -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 {
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

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).

Copilot uses AI. Check for mistakes.
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.

2 participants