fix: normalize repo url in rubygems - #4330
Conversation
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
Signed-off-by: Mouad BANI <mouad-mb@outlook.com>
|
|
|
Your PR title doesn't contain a Jira issue key. Consider adding it for better traceability. Example:
Projects:
Please add a Jira issue key to your PR title. |
There was a problem hiding this comment.
Pull request overview
Adds canonical RubyGems repository URL storage and package-to-repository linking.
Changes:
- Canonicalizes
source_code_uri. - Persists canonical URLs and repository relationships.
Blocking: Stale declared-repository links are not reconciled. The PR title also lacks the required Conventional Commit format and JIRA key.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
rubygems/types.ts |
Adds canonical repository metadata. |
rubygems/normalize.ts |
Canonicalizes declared repository URLs. |
rubygems/runRubyGemsCoreLoop.ts |
Stores and links repositories. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| }) | ||
| pkgChanged.forEach((f) => changed.add(f)) | ||
|
|
||
| if (normalized.repo) { |
This pull request introduces enhancements to the RubyGems package normalization and synchronization process, focusing on improved repository URL handling and integration with the repository database. The changes ensure that repository URLs are consistently canonicalized, stored, and linked to packages in the database.
Repository URL handling and database integration:
normalizeRubyGemsPackagenow canonicalizes thedeclaredRepositoryUrlusingcanonicalizeRepoUrland adds a newrepofield to the normalized package object. [1] [2] [3] [4]getOrCreateRepoByUrl) and links it to the package usingupsertPackageRepo. [1] [2]Data model and synchronization improvements:
NormalizedRubyGemsPackagetype is updated to include the newrepofield, reflecting the canonicalized repository information.repositoryUrland ensures all relevant changes are tracked.These updates improve the reliability and consistency of repository data associated with RubyGems packages.
Note
Medium Risk
Touches package upsert and repo linkage in the ingestion transaction; bad canonicalization could mis-associate repos, but the pattern matches existing npm/PyPI workers.
Overview
RubyGems ingestion now canonicalizes
source_code_uriviacanonicalizeRepoUrland exposes the result on normalized packages as arepofield (alongside the rawdeclaredRepositoryUrl).During sync, when a canonical repo exists, the worker persists
repositoryUrlon the package, upserts the repo row withgetOrCreateRepoByUrl, and links package↔repo withupsertPackageRepo(declared, confidence0.8), with those changes folded into audit tracking like other ecosystems.Reviewed by Cursor Bugbot for commit 44f3b19. Bugbot is set up for automated code reviews on this repo. Configure here.