Skip to content

Conversation

@anttimaki
Copy link
Contributor

No description provided.

@coderabbitai
Copy link

coderabbitai bot commented Dec 18, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This PR extends package listing detail fetching to support optional version specification across the entire stack. Changes propagate from UI components through the Dapper SDK and into the API schemas and request handling. The ListingIdentifiers interface gains an optional packageVersion field, which flows through getPublicListing and getPrivateListing to the underlying getPackageListingDetails calls. The API endpoint conditionally appends the version to the request path when provided. The package version page component is refactored to consume a unified listing object instead of separate version data structures.

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 22.22% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ❓ Inconclusive No description was provided by the author, making it impossible to assess relevance to the changeset. Add a pull request description explaining the motivation, approach, and any relevant context for this data fetching enhancement.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding support for fetching a specific version of a listed package by introducing optional version parameters across the data fetching layer.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Dec 18, 2025

Codecov Report

❌ Patch coverage is 2.48756% with 196 lines in your changes missing coverage. Please review.
✅ Project coverage is 11.63%. Comparing base (76a882e) to head (046f1cd).
⚠️ Report is 4 commits behind head on moderation-tools-feature-branch.

Files with missing lines Patch % Lines
apps/cyberstorm-remix/app/p/packageVersion.tsx 0.00% 181 Missing ⚠️
apps/cyberstorm-remix/app/p/listingUtils.ts 0.00% 7 Missing ⚠️
packages/dapper-fake/src/fakers/package.ts 0.00% 6 Missing ⚠️
.../thunderstore-api/src/get/packageListingDetails.ts 50.00% 2 Missing ⚠️
Additional details and impacted files
@@                         Coverage Diff                         @@
##           moderation-tools-feature-branch    #1671      +/-   ##
===================================================================
+ Coverage                            11.61%   11.63%   +0.02%     
===================================================================
  Files                                  322      322              
  Lines                                23056    22990      -66     
  Branches                               513      511       -2     
===================================================================
- Hits                                  2677     2676       -1     
+ Misses                               20379    20314      -65     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@anttimaki
Copy link
Contributor Author

@coderabbitai full review

@coderabbitai
Copy link

coderabbitai bot commented Dec 18, 2025

✅ Actions performed

Full review triggered.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/dapper-ts/src/methods/packageListings.ts (1)

121-143: Type signature mismatch with GetPackageListingDetails.

The implementation includes a useSession parameter that isn't reflected in the public type definition at packages/dapper/src/types/methods.ts. The type only defines 4 parameters, but the implementation (and actual usage in apps/cyberstorm-remix/app/p/listingUtils.ts:63-69) passes a 5th argument as useSession.

Add useSession?: boolean to the GetPackageListingDetails type definition to align with the implementation.

🧹 Nitpick comments (1)
packages/thunderstore-api/src/schemas/requestSchemas.ts (1)

169-178: Consider adding version format validation.

The schema accepts any string for version_number. Other schemas in this file (e.g., packageChangelogRequestParamsSchema at line 150) use a union with z.literal("latest"). If your API expects semantic versioning, consider adding a regex constraint.

🔎 Optional: Add semver format validation
 export const packageListingDetailsRequestParamsSchema = z.object({
   community_id: z.string(),
   namespace_id: z.string(),
   package_name: z.string(),
-  version_number: z.string().optional(),
+  version_number: z.string().regex(/^\d+\.\d+\.\d+$/).optional(),
 });
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6a0841f and 046f1cd.

📒 Files selected for processing (7)
  • apps/cyberstorm-remix/app/p/listingUtils.ts (4 hunks)
  • apps/cyberstorm-remix/app/p/packageVersion.tsx (9 hunks)
  • packages/dapper-fake/src/fakers/package.ts (2 hunks)
  • packages/dapper-ts/src/methods/packageListings.ts (2 hunks)
  • packages/dapper/src/types/methods.ts (1 hunks)
  • packages/thunderstore-api/src/get/packageListingDetails.ts (1 hunks)
  • packages/thunderstore-api/src/schemas/requestSchemas.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
packages/dapper-fake/src/fakers/package.ts (1)
packages/dapper-fake/src/fakers/utils.ts (1)
  • setSeed (74-77)
apps/cyberstorm-remix/app/p/packageVersion.tsx (1)
apps/cyberstorm-remix/app/p/listingUtils.ts (2)
  • getPublicListing (16-35)
  • getPrivateListing (43-76)
packages/thunderstore-api/src/get/packageListingDetails.ts (1)
packages/thunderstore-api/src/index.ts (1)
  • BASE_LISTING_PATH (17-17)
🔇 Additional comments (9)
packages/dapper/src/types/methods.ts (1)

44-49: LGTM!

The optional version parameter addition is consistent with similar type signatures in this file (e.g., GetPackageChangelog, GetPackageReadme). Backward compatible change.

packages/dapper-fake/src/fakers/package.ts (1)

130-136: Optional version parameter correctly integrated.

The logic to use provided version or fall back to generated one is clean. Note that the seed (line 133) doesn't include version, so all versions of the same package will produce identical fake data - acceptable for test fixtures.

apps/cyberstorm-remix/app/p/listingUtils.ts (3)

4-9: LGTM!

Clean extension of ListingIdentifiers with optional packageVersion. The property flows correctly through both public and private listing fetchers.


16-35: LGTM!

Version parameter correctly threaded through to dapper.getPackageListingDetails.


43-76: LGTM!

Private listing fallback correctly includes packageVersion in both the initial attempt (lines 50-55) and the authenticated retry (lines 63-68).

apps/cyberstorm-remix/app/p/packageVersion.tsx (4)

61-87: LGTM!

Server loader correctly awaits all data before returning. The guard now properly checks for packageVersion presence.


89-118: LGTM!

Client loader correctly uses getPrivateListing for authenticated access. The un-awaited community and team promises enable streaming with Suspense/Await pattern in the component. The hydrate = true flag is appropriately set.


392-425: LGTM!

Actions component signature updated to use listing and team. Property access correctly uses listing.download_url.


427-464: LGTM!

packageMeta helper correctly updated to use listing properties for download count, size, and dependency string.

PackageListing as a concept is version-agnostic, but to ensure we don't
serve pages for rejected package versions, they need to be
community-scoped, as rejection is tied to PackageListing object.

This commit adds the support to Dapper and listingUtils, the actual
usage will be done in a separate commit.

Since by default a PackageListing shows the latest package version, the
version argument remains optional.
- Use Dapper's getPackageListingDetails method rather than
  getPackageVersionDetails as the latter may serve rejected content
  which we don't want to show
- SSR loader and clientLoader mimic what their counterparts in
  packageListing.tsx does, namely loader makes the request
  unauthenticated and returns undefined if the response is 404, while
  clientLoader first does an unauthenticated request, and should that
  fail, another one as authenticated. This is done to improve cache
  hits
- Since both loaders now await the responses for listing, it's never
  a promise and lot of the Suspense/Await elements become obsolete
@anttimaki anttimaki force-pushed the secure-listing-version branch from 046f1cd to e384759 Compare December 18, 2025 13:57
@anttimaki anttimaki requested a review from Oksamies December 18, 2025 14:11
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