Skip to content

CXH-2164: add workspace exclude flag to scope sync - #52

Open
al-conductorone wants to merge 2 commits into
mainfrom
cxh-2164-baton-databricks-exclude-workspaces
Open

CXH-2164: add workspace exclude flag to scope sync#52
al-conductorone wants to merge 2 commits into
mainfrom
cxh-2164-baton-databricks-exclude-workspaces

Conversation

@al-conductorone

Copy link
Copy Markdown

Customers can now exclude specific Databricks workspaces from a sync by name or ID, so an inaccessible or unwanted workspace no longer has to be synced or granted access to.

Add --databricks-exclude-workspaces (BATON_DATABRICKS_EXCLUDE_WORKSPACES),
a comma-separated denylist of workspaces to omit from sync, matched by
workspace name, deployment name, or numeric workspace ID. Filtering
happens in client.ListWorkspaces so both Validate and sync honor it;
excluded workspaces and their roles are skipped entirely.
@al-conductorone
al-conductorone requested a review from a team July 28, 2026 19:26
@linear-code

linear-code Bot commented Jul 28, 2026

Copy link
Copy Markdown

CXH-2164

Comment thread pkg/databricks/client.go
Comment on lines +64 to +69
for _, w := range excludeWorkspaces {
if w == "" {
continue
}
excludeSet[w] = struct{}{}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Suggestion: Entries aren't trimmed before being added to the exclude set, and matching is exact. The README/docs advertise a "comma-separated list," so a user setting BATON_DATABRICKS_EXCLUDE_WORKSPACES=ws-a, ws-b will get " ws-b" (pflag's StringSlice does not trim whitespace), which silently fails to exclude ws-b. Consider strings.TrimSpace(w) before the empty check. (medium confidence)

Suggested change
for _, w := range excludeWorkspaces {
if w == "" {
continue
}
excludeSet[w] = struct{}{}
}
for _, w := range excludeWorkspaces {
w = strings.TrimSpace(w)
if w == "" {
continue
}
excludeSet[w] = struct{}{}
}

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Connector PR Review: CXH-2164: add workspace exclude flag to scope sync

Blocking Issues: 0 | Suggestions: 0 | Threads Resolved: 0
Criteria: Criteria status: loaded .claude/skills/ci-review.md from trusted base 5aba277.
Review mode: incremental since 6530b0f
View review run

Review Summary

The new commit addresses both prior findings: strings.TrimSpace is now applied to each exclude entry before matching in pkg/databricks/client.go:64, and a new table-driven test in pkg/databricks/client_test.go covers name, deployment-name, and numeric-ID matching plus empty, whitespace, and space-padded entries. The full PR diff was scanned for security and correctness. Workspace.ID is an int so strconv.Itoa is correct, and the ListWorkspaces filtering is safe. No new issues found.

Security Issues

None found.

Correctness Issues

None found.

Suggestions

None.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues found.

Comma-separated --databricks-exclude-workspaces values arrive
space-padded (pflag CSV parsing does not trim), and isWorkspaceExcluded
does exact map lookups, so an entry like " ws-b" silently never
matched. TrimSpace each entry when building the exclude set.

Adds a table-driven test covering exclusion by name, deployment name,
and numeric ID, plus empty/whitespace entries being ignored.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blocking issues found.

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.

2 participants