Skip to content

feat(gitlab): Add exclude.userOwnedProjects config setting#498

Merged
brendan-kellam merged 3 commits intomainfrom
bkellam/gitlab_exclude_user_owned_projects
Sep 9, 2025
Merged

feat(gitlab): Add exclude.userOwnedProjects config setting#498
brendan-kellam merged 3 commits intomainfrom
bkellam/gitlab_exclude_user_owned_projects

Conversation

@brendan-kellam
Copy link
Copy Markdown
Contributor

@brendan-kellam brendan-kellam commented Sep 9, 2025

Adds exclude.userOwnedProjects to GitLab config setting to allow for excluding all user owned projects from syncing.

Summary by CodeRabbit

  • New Features

    • Added a GitLab exclude option to omit user-owned projects from syncing (configurable, default off).
  • Documentation

    • Updated GitLab connection docs, examples, and schemas to include the new userOwnedProjects exclude setting.
    • Added an Unreleased changelog entry describing the new configuration.
  • Tests

    • Added test coverage to verify exclusion behavior for user-owned projects.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Sep 9, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

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

Introduces a new exclude option userOwnedProjects across GitLab connection schemas, docs, and configuration. Implements corresponding exclusion logic in backend shouldExcludeProject and adds a unit test. Updates CHANGELOG. No other behavioral or public API signature changes.

Changes

Cohort / File(s) Summary of changes
Changelog
CHANGELOG.md
Documented new GitLab config setting exclude.userOwnedProjects under Unreleased.
Docs – GitLab connection
docs/docs/connections/gitlab.mdx
Added exclude.userOwnedProjects example and description in “Exclude projects from syncing.”
Docs – Schema snippets (MDX)
docs/snippets/schemas/v3/connection.schema.mdx, docs/snippets/schemas/v3/gitlab.schema.mdx, docs/snippets/schemas/v3/index.schema.mdx
Added userOwnedProjects boolean (default false) to GitLab exclude with description.
Backend logic
packages/backend/src/gitlab.ts
In shouldExcludeProject, added check to exclude projects with namespace.kind === 'user' when exclude.userOwnedProjects is true.
Backend tests
packages/backend/src/gitlab.test.ts
Added unit test verifying exclusion of user-owned projects when exclude.userOwnedProjects is true.
Schemas – TS (schema objects)
packages/schemas/src/v3/connection.schema.ts, packages/schemas/src/v3/gitlab.schema.ts, packages/schemas/src/v3/index.schema.ts
Added userOwnedProjects boolean (default false, described) to GitLab exclude properties.
Types – TS (interfaces)
packages/schemas/src/v3/connection.type.ts, packages/schemas/src/v3/gitlab.type.ts, packages/schemas/src/v3/index.type.ts
Added optional userOwnedProjects?: boolean to GitlabConnectionConfig.exclude.
Schemas – JSON
schemas/v3/gitlab.json
Added exclude.userOwnedProjects boolean with default and description to GitLab schema.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Scheduler as Sync Scheduler
  participant GitLab as GitLab API
  participant Backend as GitLab Sync Backend
  participant Filter as shouldExcludeProject

  Scheduler->>Backend: Start sync
  Backend->>GitLab: List projects
  GitLab-->>Backend: Projects[]
  loop For each project
    Backend->>Filter: Evaluate exclusions
    alt exclude.userOwnedProjects && project.namespace.kind == "user"
      Note over Filter: Exclude due to user-owned project
      Filter-->>Backend: true (reason: exclude.userOwnedProjects)
      Backend-->>Backend: Skip project
    else other exclusion checks
      Filter-->>Backend: true/false
    end
    Backend-->>Scheduler: Continue next project
  end
  Scheduler-->>Scheduler: Sync complete
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • msukkari

Pre-merge checks (3 passed)

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title clearly and concisely summarizes the primary change—adding the exclude.userOwnedProjects configuration setting to the GitLab integration—and follows conventional commit style without extraneous detail.
Description Check ✅ Passed The description directly relates to the change by stating that exclude.userOwnedProjects is added to the GitLab config to enable excluding user-owned projects from syncing, providing clear context for reviewers.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Poem

I twitch my whiskers, schemas grow,
A toggle for user-owned—now we know.
Backend hops, excludes with grace,
Tests keep pace in every case.
Docs nibble clarity, neat and bright—
Carrot-approved config, synced just right. 🥕🐇

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bkellam/gitlab_exclude_user_owned_projects

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.

@github-actions

This comment has been minimized.

@brendan-kellam
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Sep 9, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor

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

Caution

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

⚠️ Outside diff range comments (1)
docs/docs/connections/gitlab.mdx (1)

87-89: Fix broken JSON example: add missing comma after groups.

Without a comma after the closing bracket of "groups", the example can’t be copy-pasted as valid JSON.

Apply:

-            ]
+            ],
             // ...except:
             "exclude": {
🧹 Nitpick comments (3)
packages/schemas/src/v3/gitlab.type.ts (1)

59-62: Type addition looks good

Field name and doc match the intended behavior. Consider clarifying in the JSDoc that “user-owned” maps to projects where project.namespace.kind === 'user' for completeness.

docs/docs/connections/gitlab.mdx (1)

93-94: Clarify what “user-owned projects” means and its precedence.

Suggest adding a short note that “user-owned” refers to projects in a personal namespace (namespace.kind === "user") and that this exclusion applies even when specific users are listed under "users".

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

609-613: Add exclude.userOwnedProjects: LGTM; consider clarifying wording and precedence

Wording nit: to avoid ambiguity, consider “Exclude projects in a user’s personal namespace (namespace.kind == 'user') from syncing.” Also, if this exclusion takes precedence over explicit includes (users/projects/all), add a short note mirroring how other exclude flags behave.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b05fc7a and e5274ba.

📒 Files selected for processing (14)
  • CHANGELOG.md (1 hunks)
  • docs/docs/connections/gitlab.mdx (1 hunks)
  • docs/snippets/schemas/v3/connection.schema.mdx (1 hunks)
  • docs/snippets/schemas/v3/gitlab.schema.mdx (1 hunks)
  • docs/snippets/schemas/v3/index.schema.mdx (1 hunks)
  • packages/backend/src/gitlab.test.ts (1 hunks)
  • packages/backend/src/gitlab.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/gitlab.schema.ts (1 hunks)
  • packages/schemas/src/v3/gitlab.type.ts (1 hunks)
  • packages/schemas/src/v3/index.schema.ts (1 hunks)
  • packages/schemas/src/v3/index.type.ts (1 hunks)
  • schemas/v3/gitlab.json (1 hunks)
⏰ 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)
schemas/v3/gitlab.json (1)

100-104: Schema change is consistent

Boolean with default false and clear description. All good.

CHANGELOG.md (1)

10-12: Changelog entry is clear

Correct scope, link, and placement under Unreleased.

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

128-132: Schema update LGTM

Matches JSON schema and types; no additional constraints needed.

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

129-133: Docs snippet synced

Accurately reflects the new option.

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

281-284: Type surface synchronized

Matches other schema/type files and backend usage.

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

156-159: LGTM: type surface matches docs and schema.

The new optional exclude flag is clear and consistent with other providers’ exclude options.

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

346-350: LGTM: schema snippet correctly documents userOwnedProjects.

Type, default, and description align with the code and generated schemas.

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

345-349: Verify schema and backend integration of userOwnedProjects
No occurrences of userOwnedProjects were found beyond its declaration in packages/schemas/src/v3/connection.schema.ts – confirm that both generated JSON schemas (schemas/v3/gitlab.json and packages/schemas/src/v3/gitlab.json) include it with "type": "boolean", "default": false, and that packages/backend/src/gitlab.ts implements the exclusion logic.

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

608-612: LGTM: index schema mirrors connection schema for userOwnedProjects.

Consistent default and description.

Comment thread packages/backend/src/gitlab.test.ts
Comment thread packages/backend/src/gitlab.ts
@brendan-kellam brendan-kellam merged commit 7d0c658 into main Sep 9, 2025
9 checks passed
@brendan-kellam brendan-kellam deleted the bkellam/gitlab_exclude_user_owned_projects branch September 9, 2025 02:38
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