prod#133
Merged
Merged
Conversation
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a variety of improvements and fixes across the stats, items, and helper modules, with adjustments to value calculations, logging, and optional result handling. Key updates include improved naming and type conversion for enrichment and color values, modifications to branch conditions and error logging, and changes to the getUsername API to optionally return null.
Reviewed Changes
Copilot reviewed 17 out of 25 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/lib/server/stats/missing.ts | Renamed variable for enrichment and applied a mapping from constants. |
| src/lib/server/stats/misc.ts | Adjusted optional chaining for consistent access of nested properties. |
| src/lib/server/stats/members.ts | Updated getUsername call to include a new option (returnNull). |
| src/lib/server/stats/items/processing.ts | Changed type conversion for color and updated branch condition from "storage_icons" to "backpack". |
| src/lib/server/stats/items.ts | Added networth calculation for backpack items and simplified error logging. |
| src/lib/server/stats/garden.ts | Updated optional chaining on garden commission data references. |
| src/lib/server/stats/collections.ts | Modified getUsername invocation with the new returnNull option. |
| src/lib/server/stats.ts | Removed redundant timing and debug logging for cache hits. |
| src/lib/server/lib.ts | Strengthened null checking in username resolution and added caching for empty garden data on error. |
| src/lib/server/helper/renderer.ts | Introduced caching of rendered items using Redis. |
| src/lib/server/constants/update-collections.ts | Removed extraneous logging. |
| src/lib/server/constants/accessories.ts | Added ENRICHMENT_TO_STAT mapping for accessories. |
Files not reviewed (8)
- src/lib/components/Item.svelte: Language not supported
- src/lib/components/header/Info.svelte: Language not supported
- src/lib/components/item/item-content.svelte: Language not supported
- src/lib/layouts/stats/AdditionalStats.svelte: Language not supported
- src/lib/layouts/stats/PlayerProfile.svelte: Language not supported
- src/lib/sections/stats/Accessories.svelte: Language not supported
- src/lib/sections/stats/Dungeons.svelte: Language not supported
- src/lib/sections/stats/farming/garden.svelte: Language not supported
Comments suppressed due to low confidence (6)
src/lib/server/stats/members.ts:9
- Adding the 'returnNull: true' option changes the contract of getUsername. Please verify that all consumers of the username value handle a possible null return to avoid unexpected errors.
username: await getUsername(member, { cache: true, returnNull: true }),
src/lib/server/stats/items/processing.ts:130
- The double cast to convert the color value to a number might hide type issues. Consider enforcing the correct type earlier in the data flow instead of relying on forceful casting.
const hex = (item.tag.display.color as unknown as number).toString(16).padStart(6, "0");
src/lib/server/stats/items/processing.ts:151
- Changing the condition from 'storage_icons' to 'backpack' alters the branch logic. Verify that this change reflects the intended filtering of sources.
if (source.startsWith("backpack") === false) {
src/lib/server/stats/collections.ts:75
- The modified getUsername call now may return null, which could lead to null entries in cachedUsernames. Please confirm that downstream logic properly handles these null values.
cachedUsernames[member] = await getUsername(member, { cache: true, returnNull: true });
src/lib/server/lib.ts:105
- The updated resolveUsernameOrUUID function now returns null when options.returnNull is true. Ensure that all callers of getUsername and resolveUsernameOrUUID are updated to handle null values appropriately.
if (options.returnNull) {
src/lib/server/lib.ts:201
- Caching an empty object when garden data fetch fails may lead to stale or misleading results. Verify that this behavior is intended, or consider an alternative error handling strategy.
REDIS.SETEX(`GARDEN:${profileId}`, 60 * 5, JSON.stringify({}));
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.