🌐 AI搜索 & 代理 主页
Skip to content

Conversation

@brendan-kellam
Copy link
Contributor

@brendan-kellam brendan-kellam commented Aug 5, 2025

This PR adds support for multi-branch indexing to Gerrit.

Summary by CodeRabbit

  • New Features

    • Added support for multi-branch and multi-tag indexing in Gerrit connections, allowing users to specify which branches and tags to include during repository indexing.
    • Updated documentation to reflect Gerrit's new multi-branch indexing capability and revised platform support indicators.
  • Documentation

    • Enhanced schema and configuration documentation to detail the new "revisions" property for Gerrit, including usage examples and constraints.
    • Updated changelog to document the addition.

@brendan-kellam brendan-kellam requested a review from msukkari August 5, 2025 23:12
@coderabbitai
Copy link

coderabbitai bot commented Aug 5, 2025

Walkthrough

This update introduces multi-branch indexing support for Gerrit. Documentation, changelogs, schemas, and type definitions have been updated to add an optional revisions property for Gerrit connection configuration, enabling users to specify which branches and tags to index. Associated metadata handling and platform support documentation were also updated.

Changes

Cohort / File(s) Change Summary
Documentation & Changelog
CHANGELOG.md, docs/docs/features/search/multi-branch-indexing.mdx
Updated the changelog to record the addition of multi-branch indexing for Gerrit. Updated feature documentation to indicate Gerrit now supports multi-branch indexing.
Schema Documentation
docs/snippets/schemas/v3/connection.schema.mdx, docs/snippets/schemas/v3/gerrit.schema.mdx, docs/snippets/schemas/v3/index.schema.mdx
Added documentation for the new optional revisions property in Gerrit connection schemas, specifying branches and tags arrays with glob pattern support and entry limits.
Type Definitions
packages/schemas/src/v3/connection.type.ts, packages/schemas/src/v3/gerrit.type.ts, packages/schemas/src/v3/index.type.ts
Extended GerritConnectionConfig interfaces to include an optional revisions property of type GitRevisions, and introduced or referenced the GitRevisions interface.
JSON Schemas
packages/schemas/src/v3/connection.schema.ts, packages/schemas/src/v3/gerrit.schema.ts, packages/schemas/src/v3/index.schema.ts, schemas/v3/gerrit.json
Updated JSON schemas for Gerrit connection configuration to add the optional revisions property, referencing or defining branches and tags arrays, with metadata, entry limits, and pattern support.
Backend Logic
packages/backend/src/repoCompileUtils.ts
Modified the Gerrit config compiler to include branches and tags from config.revisions in the repository metadata output, aligning with handling for other code hosts.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ConfigFile
    participant Backend
    participant Gerrit

    User->>ConfigFile: Adds/updates Gerrit connection with revisions (branches/tags)
    ConfigFile->>Backend: Loads Gerrit connection config
    Backend->>Backend: Reads revisions (branches/tags) from config
    Backend->>Gerrit: Requests refs for specified branches/tags
    Gerrit-->>Backend: Returns matching refs
    Backend->>Backend: Indexes code for each specified branch/tag
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested labels

sourcebot-team

Poem

A rabbit hopped through schema fields,
Where branches and tags now yield,
Gerrit's grown with multi-branch might,
Docs and types all shining bright.
From changelog lines to backend code,
This bunny cheers the new upload! 🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bkellam/gerrit-multi-branch

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions

This comment has been minimized.

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

♻️ Duplicate comments (1)
docs/snippets/schemas/v3/connection.schema.mdx (1)

641-682: Same maxItems enforcement missing here – see comment in the generated TypeScript schema.

🧹 Nitpick comments (3)
packages/schemas/src/v3/gerrit.type.ts (1)

32-44: Consider consolidating duplicate GitRevisions interface.

The GitRevisions interface appears to be duplicated across multiple type files (connection.type.ts, gerrit.type.ts, etc.). Since this is an auto-generated file, consider updating the generation process to import the interface from a shared location rather than duplicating the definition.

This would improve maintainability and reduce the risk of inconsistencies between identical interface definitions across different files.

docs/snippets/schemas/v3/index.schema.mdx (1)

904-945: Consider encoding the 64-entry ceiling directly in the schema

The description for both branches and tags mentions that only the first 64 entries are honoured, yet the JSON Schema itself does not include a maxItems: 64 constraint. Encoding the limit in the schema gives earlier feedback to users and schema-driven tooling, rather than deferring checks to runtime.

Example diff for the branches array (same idea for tags):

           "items": {
             "type": "string"
           },
+          "maxItems": 64,
           "examples": [

If the omission is intentional (e.g., to share one generator across hosts), feel free to disregard.

packages/schemas/src/v3/gerrit.schema.ts (1)

61-102: Schema generator: add maxItems to reflect documented behaviour

Same as the MDX snippet, the runtime cap of 64 revisions isn’t enforced in this auto-generated TS schema. Adding

          "items": { "type": "string" },
+         "maxItems": 64,

to both branches and tags would make validation consistent with the docs and with the rest of the host schemas.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d74c943 and c710242.

📒 Files selected for processing (13)
  • CHANGELOG.md (1 hunks)
  • docs/docs/features/search/multi-branch-indexing.mdx (1 hunks)
  • docs/snippets/schemas/v3/connection.schema.mdx (1 hunks)
  • docs/snippets/schemas/v3/gerrit.schema.mdx (1 hunks)
  • docs/snippets/schemas/v3/index.schema.mdx (1 hunks)
  • packages/backend/src/repoCompileUtils.ts (1 hunks)
  • packages/schemas/src/v3/connection.schema.ts (1 hunks)
  • packages/schemas/src/v3/connection.type.ts (1 hunks)
  • packages/schemas/src/v3/gerrit.schema.ts (1 hunks)
  • packages/schemas/src/v3/gerrit.type.ts (1 hunks)
  • packages/schemas/src/v3/index.schema.ts (1 hunks)
  • packages/schemas/src/v3/index.type.ts (1 hunks)
  • schemas/v3/gerrit.json (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*

📄 CodeRabbit Inference Engine (.cursor/rules/style.mdc)

Filenames should always be camelCase. Exception: if there are filenames in the same directory with a format other than camelCase, use that format to keep things consistent.

Files:

  • CHANGELOG.md
  • schemas/v3/gerrit.json
  • docs/docs/features/search/multi-branch-indexing.mdx
  • packages/schemas/src/v3/connection.type.ts
  • docs/snippets/schemas/v3/gerrit.schema.mdx
  • packages/schemas/src/v3/index.type.ts
  • packages/schemas/src/v3/gerrit.type.ts
  • packages/schemas/src/v3/index.schema.ts
  • packages/backend/src/repoCompileUtils.ts
  • packages/schemas/src/v3/connection.schema.ts
  • packages/schemas/src/v3/gerrit.schema.ts
  • docs/snippets/schemas/v3/index.schema.mdx
  • docs/snippets/schemas/v3/connection.schema.mdx
🧬 Code Graph Analysis (3)
packages/schemas/src/v3/connection.type.ts (1)
packages/schemas/src/v3/gerrit.type.ts (1)
  • GitRevisions (35-44)
packages/schemas/src/v3/index.type.ts (1)
packages/schemas/src/v3/connection.type.ts (1)
  • GitRevisions (90-99)
packages/schemas/src/v3/gerrit.type.ts (1)
packages/schemas/src/v3/connection.type.ts (1)
  • GitRevisions (90-99)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (9)
CHANGELOG.md (1)

10-11: LGTM!

The changelog entry accurately documents the new multi-branch indexing support for Gerrit and follows the established format with proper PR reference.

docs/docs/features/search/multi-branch-indexing.mdx (1)

92-92: LGTM!

Correctly updates Gerrit's multi-branch indexing support status from unsupported to supported, reflecting the new feature implementation.

packages/schemas/src/v3/index.type.ts (1)

372-372: LGTM!

The addition of the optional revisions property to GerritConnectionConfig is consistent with other connection types and properly typed using the existing GitRevisions interface.

schemas/v3/gerrit.json (1)

61-62: LGTM!

The JSON schema correctly adds the optional revisions property with proper reference to the shared GitRevisions definition, maintaining consistency with other connection schemas.

packages/schemas/src/v3/connection.type.ts (1)

247-247: LGTM!

The addition of the optional revisions property to GerritConnectionConfig maintains consistency with other connection types and is properly typed with the well-documented GitRevisions interface.

packages/backend/src/repoCompileUtils.ts (1)

313-314: LGTM! Consistent implementation of multi-branch indexing for Gerrit.

The addition of branches and tags properties to the Gerrit metadata follows the same pattern established in other compile functions throughout this file. The use of optional chaining and nullish coalescing operators appropriately handles the optional nature of the revisions property.

packages/schemas/src/v3/gerrit.type.ts (1)

30-30: LGTM! Proper addition of revisions support.

The optional revisions property correctly extends the Gerrit configuration to support multi-branch indexing.

docs/snippets/schemas/v3/gerrit.schema.mdx (1)

62-103: LGTM! Comprehensive schema definition for revisions.

The JSON schema properly defines the revisions property with:

  • Clear descriptions explaining the 64-item limit and glob pattern support
  • Appropriate examples showing both specific patterns and wildcards
  • Proper validation constraints with additionalProperties: false
  • Consistent structure with other connection schemas

The schema documentation accurately reflects the multi-branch indexing functionality.

packages/schemas/src/v3/index.schema.ts (1)

903-944: LGTM! Well-structured schema addition for Gerrit multi-branch indexing.

The revisions property addition is consistent with existing connection types and follows established schema patterns. The implementation includes comprehensive documentation, appropriate constraints (64-entry limit), and proper validation rules.

@brendan-kellam brendan-kellam merged commit a3d9711 into main Aug 5, 2025
7 checks passed
@brendan-kellam brendan-kellam deleted the bkellam/gerrit-multi-branch branch August 5, 2025 23:35
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.

3 participants