Skip to content

Use OfficialRepositoryName from index instead of fetching buckets.json#117

Open
z-Fng wants to merge 1 commit intoScoopInstaller:mainfrom
z-Fng:use-bucket-name-from-index
Open

Use OfficialRepositoryName from index instead of fetching buckets.json#117
z-Fng wants to merge 1 commit intoScoopInstaller:mainfrom
z-Fng:use-bucket-name-from-index

Conversation

@z-Fng
Copy link
Copy Markdown
Member

@z-Fng z-Fng commented Mar 30, 2026

Changes

Use OfficialRepositoryName from the Azure index, instead of retrieving the official bucket name via fetching buckets.json

Relates to:

Relays on:

Summary by CodeRabbit

  • Refactor

    • Official repository names are now taken directly from search result metadata instead of an external mapping.
    • Search result rendering and selection now rely on metadata-provided repository names for display and bucket/command derivation.
  • Tests

    • Test fixtures and deserialization tests updated to include and validate the OfficialRepositoryName field.
    • Removed the mocked external buckets fixture and adjusted tests to rely on metadata-driven behavior.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 30, 2026

Walkthrough

Search no longer fetches a separate buckets.json mapping; official repository names are read from search result metadata (Metadata.OfficialRepositoryName). SearchProcessor requests the new field, SearchResult uses metadata directly, fixtures and tests updated, and MetadataJson deserializes the new property.

Changes

Cohort / File(s) Summary
Test Fixtures & Tests
src/__tests__/mocks/fixtures.ts, src/components/Search.test.tsx, src/components/SearchResult.test.tsx
Added OfficialRepositoryName values to mock metadata; removed mockGitHubBucketsJson export and removed mocked officialRepositories setup in tests.
Search UI
src/components/Search.tsx, src/components/SearchResult.tsx
Removed officialRepositories state and the fetch for buckets.json from Search; removed passing officialRepositories into SearchResult; SearchResult now reads metadata.officialRepositoryName.
Search Request / Serialization
src/components/SearchProcessor.tsx, src/serialization/MetadataJson.ts, src/serialization/MetadataJson.test.ts
Expanded SearchProcessor select clause to include Metadata/OfficialRepositoryName; added officialRepositoryName?: string to MetadataJson with JSON mapping and tests updated to assert deserialization and default ''.

Sequence Diagram(s)

sequenceDiagram
    participant Client as Client
    participant SearchUI as Search (UI)
    participant Processor as SearchProcessor
    participant Azure as AzureSearch
    participant Result as SearchResult
    rect rgba(200,200,255,0.5)
    Client->>SearchUI: trigger search
    SearchUI->>Processor: build query (include Metadata/OfficialRepositoryName)
    Processor->>Azure: execute search request
    Azure-->>Processor: results with Metadata.OfficialRepositoryName
    Processor-->>SearchUI: return results
    SearchUI->>Result: render item with metadata.officialRepositoryName
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I hopped through code to find a name,
No buckets called — the metadata came,
Official tags snug in each result,
Fewer fetches, fewer bolts to bolt,
A lighter hop and tidy game.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: switching from fetching buckets.json to using OfficialRepositoryName from the index metadata.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@z-Fng z-Fng changed the title refactor: Use OfficialRepositoryName from metadata instead of fetching buckets.json Use OfficialRepositoryName from index instead of fetching buckets.json Mar 30, 2026
@z-Fng z-Fng force-pushed the use-bucket-name-from-index branch from a8d21b7 to 068c49e Compare March 30, 2026 18:05
Copy link
Copy Markdown

@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: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/components/SearchResult.tsx`:
- Around line 115-122: The ternary/fallback expressions for
highlightedRepository replacement and bucketName are formatted in a way Biome
rejects; rewrite them with clear grouping or explicit if/else to avoid
multi-line ternary ambiguity. Specifically, for highlightedRepository (the
expression using highlightedRepository?.toString().replace(...)) ensure the
ternary is parenthesized or converted to an if/else so the two replace calls are
clearly separated; for bucketName (the metadata.repositoryOfficial ? ... : ...
expression) either put the entire ternary on one line or expand it into a short
if/else block that assigns bucketName explicitly and uses
metadata.officialRepositoryName ||
metadata.repository.substring(...).toLowerCase() in the true branch and
extractPathFromUrl(metadata.repository, '_') in the false branch; keep
references to highlightedRepository, versionPrefix, bucketName,
extractPathFromUrl and metadata as-is.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: aad452b2-09a2-428b-92e0-73ddfa051f65

📥 Commits

Reviewing files that changed from the base of the PR and between cc5a0a3 and a8d21b7.

📒 Files selected for processing (8)
  • src/__tests__/mocks/fixtures.ts
  • src/components/Search.test.tsx
  • src/components/Search.tsx
  • src/components/SearchProcessor.tsx
  • src/components/SearchResult.test.tsx
  • src/components/SearchResult.tsx
  • src/serialization/MetadataJson.test.ts
  • src/serialization/MetadataJson.ts
💤 Files with no reviewable changes (2)
  • src/components/SearchResult.test.tsx
  • src/components/Search.tsx

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.

1 participant