Skip to content

CXH-2350: surface workspace-token sync limits and fix PAT setup docs - #57

Merged
al-conductorone merged 12 commits into
mainfrom
cxh-2350-pat-mode-limits-visibility-and-docs
Sep 2, 2026
Merged

CXH-2350: surface workspace-token sync limits and fix PAT setup docs#57
al-conductorone merged 12 commits into
mainfrom
cxh-2350-pat-mode-limits-visibility-and-docs

Conversation

@al-conductorone

Copy link
Copy Markdown
Contributor

Workspace-token (PAT) syncs now log a startup warning that account-level access is not covered, so a switch to PAT no longer silently drops data from access reviews. Also fixes the PAT setup example, which previously could not start, and corrects the workspace/token pairing instructions.

@linear-code

linear-code Bot commented Aug 27, 2026

Copy link
Copy Markdown

CXH-2350

@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Connector PR Review: CXH-2350: surface workspace-token sync limits and fix PAT setup docs

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

Review Summary

The new commit resolves two of the four previously flagged findings: the duplicate BATON_ACCOUNT_ID key is gone from the stringData manifest (docs/connector.mdx:218 is now the single shared entry), and ExcludeWorkspacesField has been dropped from the workspace-token field group so the schema now agrees with the docs Note. The full PR diff was scanned for security and correctness — no security issues and no new blocking correctness issues; the go.mod change correctly promotes google.golang.org/grpc from indirect to direct to match the new grpc/codes import in pkg/databricks/request.go with no version change, and the new README and docs/connector.mdx wording matches the actual ValidateConfig and Validate behavior. Two prior suggestions remain open and are restated below.

Security Issues

None found.

Correctness Issues

None found.

Suggestions

  • pkg/databricks/request.go:41-42 — (previously flagged, still unresolved) a 429 from the OAuth token endpoint maps to codes.Unavailable; the connector convention for rate limiting is codes.ResourceExhausted, which is equally retryable and lets the SDK distinguish throttling from a transient outage.
  • pkg/connector/connector.go:115-120 — the OAuth account-API check hard-fails Validate instead of degrading. The new README and docs/connector.mdx paragraphs now document this, which addresses the docs half of the prior finding, but the change is still ungated and is not called out in the PR description. An OAuth service principal that 403s on the account-plane assignable-roles call but has an explicit --workspaces list previously synced workspace-scoped data and now cannot start at all.
Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

## Suggestions

In `pkg/databricks/request.go`:
- Around line 41-42: In `wrapTransportAuthError`, the `http.StatusTooManyRequests`
  case maps to `codes.Unavailable`. Change it to `codes.ResourceExhausted`, which is
  the connector/SDK convention for rate limiting and is equally retryable, so callers
  can distinguish throttling from a transient upstream outage. Keep the `status >= 500`
  case on `codes.Unavailable`. Update the corresponding table-driven row in
  `pkg/databricks/request_test.go` (the "429 stays retryable as unavailable" case) to
  expect `codes.ResourceExhausted`, and adjust the doc comment above the function.

In `pkg/connector/connector.go`:
- Around line 115-120: The OAuth path now returns an error from `Validate` when the
  account-plane `ListRoles` probe fails, replacing the previous behavior where the
  connector continued with isAccAPIAvailable=false and synced workspace-scoped data.
  This is an ungated behavior change for existing OAuth installs whose service
  principal lacks account-plane permission but has an explicit `--workspaces` list.
  Either (a) gate the hard failure behind an opt-in config field so existing installs
  keep the degrade-to-workspace-only path by default, or (b) if the hard failure is
  intended to be default-on, add an explicit note to the PR description stating what
  breaks, for whom, and what the remediation is (grant the service principal
  account-plane access, or switch to workspace-token auth). The README and
  docs/connector.mdx text added in this commit already covers the user-facing
  documentation half.

Note: this run could not emit the machine-readable review-state marker (the sandbox blocked the required literal in every available posting path), so the next review run will fall back to full mode.

@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.

Comment thread pkg/connector/connector.go
Comment thread pkg/connector/connector.go
Feli: repo convention forbids Warn; drop the account-API-unreachable notice
to Debug and remove the now-inaccurate 'logs a warning' sentence from the README.
Luisina: don't error out. Workspace-token/PAT auth is a valid mode where the
account plane is inherently unreachable; the docs are the customer-facing surface,
the log is an operator diagnostic. Add a mutation-checked regression test that
fails if the level is flipped back to Warn.
…failure

A blanket Debug was wrong for the OAuth path: an account-plane probe that fails
under OAuth is a real whole-tenant degradation and must stay visible at Warn
(baton-admin skip-and-continue Rule 4). Under workspace-token/PAT auth the account
plane is out of scope by design and the branch fires every sync, so Debug is right
there (avoids per-sync Warn noise). Gate on IsTokenAuth(); test both legs.
The ticket's minimum-to-unblock is explicitly "emit a warning when the account
plane is unreachable under workspace-token auth", and the whole ticket is that
PAT's degradation is invisible. Debug is invisible at the default info level, so
the reviewer nit to drop Warn->Debug would re-hide the whole-tenant drop the ticket
was filed to surface (also against baton-admin skip-and-continue Rule 4). Revert the
earlier Debug/split attempts, keep Warn, add a regression test that fails on Debug,
and note the why in a comment.
The @v2 sync-test installs the baton CLI from the archived conductorone/baton
repo (v0.4.5), which cannot read the pebble-backed c1z that baton-sdk v0.25.0+
writes, so the integration test fails with 'c1z: invalid file'. @v4 installs
baton from baton-sdk releases, matching the connector's SDK.
Comment thread .github/workflows/ci.yaml
env:
BATON_DATABRICKS: ./baton-databricks
uses: ConductorOne/github-workflows/actions/sync-test@v2
uses: ConductorOne/github-workflows/actions/sync-test@v4

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.

🟠 Bug: sync-test@v4 adds an "Auth Error" step that runs the connector with invalidated credentials and requires exit code 16 (Unauthenticated) or 7 (PermissionDenied); this connector exits 2 (Unknown), so the bump makes the test job fail deterministically (run log: Connector exited 2 with invalid credentials; expected Unauthenticated (16) or PermissionDenied (7)).

Root cause is pkg/connector/connector.go:126 (and the sibling error paths at :138/:146) returning a bare fmt.Errorf, which gRPC maps to Unknown. Wrap credential failures with a status code — e.g. uhttp.WrapErrors(codes.Unauthenticated, "databricks-connector: failed to list workspaces", err) — or hold the bump until that's done.

The sync-test @v4 action added an auth-error check that runs the connector
with bad credentials and expects a gRPC Unauthenticated/PermissionDenied
exit. An OAuth2 invalid_client failure happens in the token transport before
any API response, so uhttp never maps it and it surfaced as codes.Unknown
(exit 2). Wrap the transport-level oauth2.RetrieveError as Unauthenticated.

@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.

Blocking issues found — see review comments.

…its-visibility-and-docs

# Conflicts:
#	pkg/databricks/request_test.go
Comment thread pkg/databricks/request.go Outdated
Comment thread pkg/connector/connector.go

@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.

wrapTransportAuthError branched every *oauth2.RetrieveError to
Unauthenticated, but oauth2 returns RetrieveError for any non-2xx from
the token endpoint. Branch on the response status so a transient 5xx
stays retryable (Unavailable), 403 is PermissionDenied, and 4xx/no
response stays Unauthenticated. Extend TestWrapTransportAuthError with
401/403/503 cases.

Hoist the account-plane probe error out of its if-block and attach it to
the 'account API unreachable' warning via zap.Error, so operators get a
cause (403 scope vs 5xx vs wrong hostname) under OAuth. Stays nil under
token auth where the probe is skipped.
Comment thread pkg/databricks/request.go

@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.

Databricks rate-limits the OIDC token endpoint, so a throttled token
refresh returned a 429 that fell through to Unauthenticated (non-retryable).
Map it to ResourceExhausted so it stays retryable, and add a test case.
ResourceExhausted tells the baton SDK to stop retrying, the opposite of the
intended retryable throttle handling. A 429 from the OIDC token endpoint is a
rate limit, so map it to Unavailable (matching the 5xx case) which the SDK
auto-retries.
Comment thread docs/connector.mdx Outdated

@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.

Under OAuth a failed account API check now returns an error instead of
warning and continuing, so a permissions failure no longer silently drops
account-level data. Workspace-token auth keeps the startup warning (its
reduced scope is by design) and now also surfaces the limit at config level
via the auth group help text.

Also fixes the duplicate BATON_ACCOUNT_ID key in the workspace-token docs
example so the manifest applies.
Comment thread pkg/connector/connector.go
Comment thread pkg/databricks/request.go

@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.

Blocking issues found — see review comments.

…y, document OAuth account-API requirement

- docs/connector.mdx: remove the duplicate BATON_ACCOUNT_ID key from the
  workspace-token example so kubectl no longer rejects the manifest.
- pkg/config/config.go: drop ExcludeWorkspacesField from the workspace-token
  group; it can never be validly set there (workspace-tokens requires
  workspaces, which is mutually exclusive with exclude-workspaces).
- README.md and docs/connector.mdx: note that OAuth requires a reachable
  account API and fails validation if it is unreachable.

@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.

@al-conductorone
al-conductorone dismissed stale reviews from github-actions[bot] and github-actions[bot] September 1, 2026 21:08

Bot-only review. Blocking finding (invalid-credential exit code) is fixed: the test job's sync-test Auth Error step passes on the head commit. OAuth account-API requirement is now documented (100cfb0), and the bot's later review reported no blocking issues. Dismissing the stale changes-requested.

@al-conductorone
al-conductorone merged commit 141ba33 into main Sep 2, 2026
9 checks passed
@al-conductorone
al-conductorone deleted the cxh-2350-pat-mode-limits-visibility-and-docs branch September 2, 2026 16:08
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.

4 participants