fix: use owners.name facet for user profile pkgs#2513
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
📝 WalkthroughSummary by CodeRabbitRelease Notes
WalkthroughRenamed and re-exported the maintainer-targeted search helper and switched Algolia owner filters to use Changes
Possibly related PRs
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the 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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
6739d56 to
7296731
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
app/composables/npm/useAlgoliaSearch.ts (1)
164-165: Update the JSDoc to match the new facet name.Line 164 still mentions
owner.name, but the implementation now usesowners.name. Keeping the comment in sync will avoid confusion during maintenance.Suggested doc fix
- /** Fetch all packages for an owner using `owner.name` filter with pagination. */ + /** Fetch all packages for an owner using `owners.name` filter with pagination. */🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/composables/npm/useAlgoliaSearch.ts` around lines 164 - 165, Update the JSDoc for the async function searchByOwner to reference the correct facet name "owners.name" instead of the outdated "owner.name"; locate the comment above the function searchByOwner in useAlgoliaSearch.ts and change any mention of owner.name to owners.name so the documentation matches the current implementation.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@app/composables/npm/useAlgoliaSearch.ts`:
- Around line 164-165: Update the JSDoc for the async function searchByOwner to
reference the correct facet name "owners.name" instead of the outdated
"owner.name"; locate the comment above the function searchByOwner in
useAlgoliaSearch.ts and change any mention of owner.name to owners.name so the
documentation matches the current implementation.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: ff059c65-ab55-4a03-aa06-79426e4c38d3
📒 Files selected for processing (1)
app/composables/npm/useAlgoliaSearch.ts
7296731 to
8a9258e
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (2)
app/composables/npm/useUserPackages.ts (1)
31-31: Update stale JSDoc wording to match the new filter semantics.The composable comment still mentions
owner.name; it should now reference maintainer-based filtering (owners.name) to avoid confusion for future edits.As per coding guidelines: "Add comments only to explain complex logic or non-obvious implementations".
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/composables/npm/useUserPackages.ts` at line 31, The JSDoc above the composable still refers to outdated owner.name semantics; update the comment for the composable containing useUserPackages and the reference to searchByMaintainer to describe maintainer-based filtering and the correct property name owners.name (or “owners.name” in examples) so it matches the new filter behavior and avoids confusion for future edits.app/composables/npm/useAlgoliaSearch.ts (1)
165-167: Consider renamingownerNametomaintainerNamefor API clarity.The function name and filter target maintainers, so aligning the parameter name would make intent clearer.
♻️ Proposed tidy-up
async function searchByMaintainer( - ownerName: string, + maintainerName: string, options: { maxResults?: number } = {}, ): Promise<NpmSearchResponse> { @@ - filters: `owners.name:${ownerName}`, + filters: `owners.name:${maintainerName}`,As per coding guidelines: "Use clear, descriptive variable and function names".
Also applies to: 188-188
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@app/composables/npm/useAlgoliaSearch.ts` around lines 165 - 167, Rename the parameter ownerName to maintainerName in the searchByMaintainer function signature and its internal usages (function searchByMaintainer and any references within that function), update all call sites and related references (also the occurrence around the other mention at the same file) to use maintainerName, and keep the options param unchanged; ensure TypeScript types and JSDoc (if any) are updated accordingly to avoid type errors.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@app/composables/npm/useAlgoliaSearch.ts`:
- Around line 165-167: Rename the parameter ownerName to maintainerName in the
searchByMaintainer function signature and its internal usages (function
searchByMaintainer and any references within that function), update all call
sites and related references (also the occurrence around the other mention at
the same file) to use maintainerName, and keep the options param unchanged;
ensure TypeScript types and JSDoc (if any) are updated accordingly to avoid type
errors.
In `@app/composables/npm/useUserPackages.ts`:
- Line 31: The JSDoc above the composable still refers to outdated owner.name
semantics; update the comment for the composable containing useUserPackages and
the reference to searchByMaintainer to describe maintainer-based filtering and
the correct property name owners.name (or “owners.name” in examples) so it
matches the new filter behavior and avoids confusion for future edits.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 7a1f27ee-cde7-4508-8502-4ef427fdff7b
📒 Files selected for processing (2)
app/composables/npm/useAlgoliaSearch.tsapp/composables/npm/useUserPackages.ts
🔗 Linked issue
closes #2504
🧭 Context
The profiles for users was querying against an Algolia field which represented repo owner, not npm username. That meant that the packages being displayed on profiles were only tangentially related to said npm username, or completely unrelated.
Once algolia/npm-search#1357 landed upstream at the algolia index, it opened us up to filter on a field which represents an npm user.
This PR switches to that field.
After this PR, user profile pages will return all packages that an npm user is listed as a maintainer on. This will still include deprecated packages, just like it did previously (whcih was not a bug, just the nature of the data source being used and no filtering, there's some issue about it but that's out of scope here)
Before 📸
any package whos repository field in package.json has the same username as the npm user will show up on the user's page, even if said user is not a maintainer/owner of said package

and any packages a user maintains which are not in a repo of the same username are omitted

After 📸
no more spoofing possible!

now all packages that an npm user is a maintainer of will be displayed on their profile (express is now accounted for in my profile, hence the download stat change)
