Skip to content

Track contributions for team achievements. - #137

Open
zyro wants to merge 3 commits into
mainfrom
aim-team-achievement-contributions
Open

Track contributions for team achievements.#137
zyro wants to merge 3 commits into
mainfrom
aim-team-achievement-contributions

Conversation

@zyro

@zyro zyro commented Dec 17, 2025

Copy link
Copy Markdown
Member

No description provided.

@zyro
zyro requested review from novabyte and a lite review from Copilot December 17, 2025 14:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 adds contribution tracking for team achievements, allowing the system to record and display which team members contributed to achievement progress and when.

Key Changes:

  • Updated team achievement method signatures to use TeamAchievement types instead of generic Achievement types
  • Added new protobuf message types for team achievements with contributor tracking
  • Defined TeamAchievementContributor message to track individual user contributions

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
teams.go Updated interface method signatures to return team-specific achievement types
hiro.proto Added new message types for team achievements with contributor tracking and updated RPC output types

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread hiro.proto
Comment on lines +3151 to +3153
int64 start_time_sec = 22;
// The UNIX timestamp when this achievement will allow updates. This may be before its next reset. A zero means it does not end.
int64 end_time_sec = 23;

Copilot AI Dec 17, 2025

Copy link

Choose a reason for hiding this comment

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

Line 3151 describes end_time_sec but states 'when this achievement will allow updates', which appears to be copied from the start_time_sec comment above. The comment should clarify that end_time_sec represents when the achievement stops allowing updates or when it ends.

Copilot uses AI. Check for mistakes.
Comment thread hiro.proto
Comment on lines +3047 to +3062
message TeamAchievementContributor {
// User identifier.
string user_id = 1;
// Username.
string username = 2;
// Avatar URL.
string avatar_url = 3;
// Display name.
string display_name = 4;
// The UNIX time (for gRPC clients) or ISO string (for REST clients) when the user first contributed.
int64 create_time_sec = 5;
// The UNIX time (for gRPC clients) or ISO string (for REST clients) when the user most recently updated their contribution.
int64 update_time_sec = 6;
// Count contributed by this user.
int64 count = 7;
}

@Calm0 Calm0 Jan 14, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It would be useful to have a metadata field here similar to the TeamEventLeaderboardsContributors. What do you think?

Copilot AI review requested due to automatic review settings August 14, 2026 16:07
@andresfelipemendez
andresfelipemendez force-pushed the aim-team-achievement-contributions branch from 29d9f7b to add1e9d Compare August 14, 2026 16:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated no new comments.

Suppressed comments (2)

teams.go:202

  • ResetAchievements still returns user-level *Achievement types while the other team achievement methods in this interface now return *TeamAchievement. This makes the team achievements API inconsistent and will force callers to handle two different result shapes for the same domain object (and may break any implementation expecting TeamAchievement everywhere).
	UpdateAchievements(ctx context.Context, logger runtime.Logger, nk runtime.NakamaModule, userID, teamID string, achievementUpdates map[string]int64) (achievements map[string]*TeamAchievement, repeatAchievements map[string]*TeamAchievement, err error)

	// ResetAchievements resets one or more achievements by their IDs by deleting their progress from the storage entry.
	ResetAchievements(ctx context.Context, logger runtime.Logger, nk runtime.NakamaModule, userID, teamID string, achievementIDs []string) (achievements map[string]*Achievement, repeatAchievements map[string]*Achievement, err error)

hiro.proto:147

  • The TEAMS_ACHIEVEMENTS RPCs now declare TeamAchievementsUpdateAck/TeamAchievementList as outputs, but the checked-in OpenAPI spec still references AchievementsUpdateAck and AchievementList for these endpoints (hiro-openapi.yml:1150-1215). If OpenAPI/client artifacts are expected to stay in sync with hiro.proto, they need to be regenerated/updated to match these new response message types.
  // Claim one or more team achievements which have completed their progress.
  RPC_ID_TEAMS_ACHIEVEMENTS_CLAIM = 105 [(input) = "TeamAchievementsClaimRequest", (output) = "TeamAchievementsUpdateAck"];
  // Get all team achievements with progress accumulated by the team.
  RPC_ID_TEAMS_ACHIEVEMENTS_GET = 106 [(input) = "TeamAchievementsGetRequest", (output) = "TeamAchievementList"];
  // Update one or more team achievements with the same progress amount.
  RPC_ID_TEAMS_ACHIEVEMENTS_UPDATE = 107 [(input) = "TeamAchievementsUpdateRequest", (output) = "TeamAchievementsUpdateAck"];

Copilot AI review requested due to automatic review settings August 19, 2026 14:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated no new comments.

Suppressed comments (4)

hiro-openapi.yml:6506

  • TeamAchievementList is defined with an empty properties block, but the proto message includes achievements and repeat_achievements maps of TeamAchievement. Add these so REST/OpenAPI clients can rely on the documented response shape.
    TeamAchievementList:
      type: object
      properties:

teams.go:203

  • TeamsSystem achievement methods now return TeamAchievement, but ResetAchievements still returns Achievement. This makes the interface inconsistent and likely forces callers/implementers to handle two different achievement shapes (and loses contributor data on reset results). Consider updating ResetAchievements to return TeamAchievement as well for consistency with Claim/Get/Update.
	UpdateAchievements(ctx context.Context, logger runtime.Logger, nk runtime.NakamaModule, userID, teamID string, achievementUpdates map[string]int64) (achievements map[string]*TeamAchievement, repeatAchievements map[string]*TeamAchievement, err error)

	// ResetAchievements resets one or more achievements by their IDs by deleting their progress from the storage entry.
	ResetAchievements(ctx context.Context, logger runtime.Logger, nk runtime.NakamaModule, userID, teamID string, achievementIDs []string) (achievements map[string]*Achievement, repeatAchievements map[string]*Achievement, err error)

hiro-openapi.yml:6481

  • TeamAchievement in OpenAPI is missing the sub_achievements map that exists in hiro.proto (map<string, TeamSubAchievement> sub_achievements). This makes the REST schema incomplete for clients consuming nested/sub-achievement progress and contributor data.
        available_total_reward:
          $ref: '#/components/schemas/AvailableRewards'
        total_reward:
          $ref: '#/components/schemas/Reward'
        auto_claim:

hiro-openapi.yml:6504

  • TeamAchievementsUpdateAck is defined with an empty properties block, but the proto message includes achievements and repeat_achievements maps of TeamAchievement. Without these properties the REST/OpenAPI response contract is effectively undocumented/incorrect.

This issue also appears on line 6504 of the same file.

    TeamAchievementsUpdateAck:
      type: object
      properties:
    TeamAchievementList:

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.

4 participants