Skip to content

[CXH-2721] - Add Unity Catalog catalog sync - Databricks Connector - #71

Draft
mateoHernandez123 wants to merge 8 commits into
stagingfrom
mateoHernandez123/unity-catalog-catalog-sync
Draft

mateoHernandez123 wants to merge 8 commits into
stagingfrom
mateoHernandez123/unity-catalog-catalog-sync

Conversation

@mateoHernandez123

@mateoHernandez123 mateoHernandez123 commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Description

  • Bug fix
  • New feature

Second of four stacked PRs for Unity Catalog (CXH-2721). Adds the catalog resource: sync, entitlements, grants, and Grant/Revoke of catalog privileges. No new config field, no credential change.

Merge #90 first. It branches from staging beside this PR and changes five of the same files.

What this adds

metastore was a leaf. Catalogs now hang from it, opt-in, keyed {metastore_id}::{name}, with a read-only owner entitlement.

flowchart TD
  account[account] --> user[user]
  account --> group[group]
  account --> sp[service principal]
  account --> role[role]
  account --> workspace[workspace]
  account --> metastore[metastore]
  metastore --> catalog[catalog]
  style catalog fill:#1f6feb,color:#fff,stroke:#1f6feb
Loading

Who may read a catalog

The decision the sync hangs on. Databricks shows any other caller only the grants it may see, so a list that cannot be proved complete is unusable — reporting it would make C1 revoke the rest.

flowchart TD
  q["Can every privilege on this catalog be read?"] --> own{"owns the metastore,<br/>or owns the catalog?"}
  own -->|yes| ok["trusted — sync it"]
  own -->|no| grp{"owner is _workspace_admins_&lt;ws&gt;_&lt;id&gt;<br/>and the connector is a <b>direct</b> Admin there?"}
  grp -->|yes| ok
  grp -->|no| man{"holds MANAGE on the catalog?"}
  man -->|yes| ok
  man -->|no| deny["PermissionDenied naming the catalog<br/>and the remedy — C1 removes nothing"]
  style ok fill:#238636,color:#fff,stroke:#238636
  style deny fill:#da3633,color:#fff,stroke:#da3633
Loading

What the sync does in each case

The rule throughout: nothing is removed on an answer the connector could not prove.

Situation Connector Effect in C1
Listed by a running in-scope workspace emitted once per metastore synced
Reachable only from excluded workspaces not emitted removed with its grants
A workspace refuses the catalog listing FailedPrecondition nothing removed
Privilege list not provably complete PermissionDenied nothing removed
404 carrying CATALOG_DOES_NOT_EXIST skips that catalog that catalog removed
Any other 404 FailedPrecondition nothing removed
system, or typed SYSTEM_CATALOG always excluded never synced

Provisioning

PATCH .../permissions/catalog/{name}, with an uncached pre-read deciding GrantAlreadyExists / GrantAlreadyRevoked and the echo confirming the write. A catalog no workspace lists is not proof of deletion — an unbound workspace answers the same 404 as a deleted one.

flowchart TD
  start[Grant or Revoke] --> route[rebuild the route]
  route -->|a workspace serves the catalog| write[PATCH permissions]
  route -->|every workspace answers CATALOG_DOES_NOT_EXIST| proof{connector owns the metastore?}
  proof -->|no| unknown[FailedPrecondition: deletion cannot be proved]
  proof -->|yes| unbound[list with include_unbound=true]
  unbound -->|catalog is in the listing| exists[FailedPrecondition: it exists, out of reach]
  unbound -->|catalog is absent| gone[Revoke: GrantAlreadyRevoked / Grant: NotFound]
Loading

Measured on the Baton account

  • Excluding system catalogs: 3 catalogs / 2647 grants → 1 / 1087. The 1560 that go are samples and system; the real catalog is unchanged.
  • Catalogs are children of a metastore: enabling Catalogs without Metastores syncs nothing and still exits 0.
  • Grant/Revoke round trip writes and reads back, through the recorded route and through a stale one.
  • Revoke on a deleted catalog returns GrantAlreadyRevoked; Grant returns NotFound.

Links

@linear-code

linear-code Bot commented Oct 9, 2026

Copy link
Copy Markdown

CXH-2721

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

Did a pass on this one. Main thing is the first comment: Revoke can say "already revoked" while the privilege still exists. The rest are perf and dupe stuff.

Comments tagged (out of scope / non-blocking) are low-confidence or nits I didn't fully verify, so treat them as FYI. Also out of scope: the databricks-connector: error prefix vs baton-databricks: is a convention that predates this PR, not something it introduced.

Heads up: the unreachable-catalog thing below is still the same in #72 / #73.

Comment thread pkg/connector/catalog.go Resolved
Comment thread pkg/connector/unity_catalog.go Resolved
Comment thread docs/docs-info.md Resolved
Comment thread pkg/connector/unity_catalog.go Resolved
Comment thread pkg/connector/catalog.go Resolved
Comment thread pkg/connector/catalog.go Resolved
Comment thread pkg/connector/catalog.go Resolved
Comment thread pkg/connector/catalog_filter.go Resolved
Comment thread pkg/connector/unity_catalog.go Resolved

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

Image

@mateoHernandez123
mateoHernandez123 force-pushed the mateoHernandez123/unity-catalog-catalog-sync branch from 5933db6 to 6add251 Compare October 9, 2026 19:31
Comment thread pkg/config/config.go Resolved
Comment thread pkg/connector/privileges.go Resolved
Comment thread pkg/connector/unity_catalog.go Resolved
Comment thread pkg/connector/catalog.go Resolved
Comment thread pkg/connector/catalog.go Resolved
Comment thread README.md Resolved
mateoHernandez123 added a commit that referenced this pull request Nov 3, 2026
CXH-2721. Catalogs hang from the metastore, keyed {metastore_id}::{name},
with one entitlement per catalog privilege plus a read-only owner. The
connector reads them through every running in-scope workspace attached to
the metastore, caches the routes in the sync session store, and grants and
revokes privileges with a live read that bypasses the response cache.

The tree is unchanged from 60501e2, which is the state reviewed on #71.
The branch is rebuilt on top of the staging-to-main landing so the PR shows
only the catalog layer instead of the 42 staging commits it used to carry.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@mateoHernandez123
mateoHernandez123 force-pushed the mateoHernandez123/unity-catalog-catalog-sync branch from 60501e2 to a343b68 Compare November 3, 2026 18:27
@mateoHernandez123
mateoHernandez123 changed the base branch from main to mateoHernandez123/land-staging-on-main November 3, 2026 18:27
@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor
Superseded — see the current review report for commit a343b6888be7

Connector PR Review: [CXH-2721] - Add Unity Catalog catalog sync - Databricks Connector

Blocking Issues: 1 | Suggestions: 2 | Threads Resolved: 0
Criteria: Criteria status: none loaded - base ref mateoHernandez123/land-staging-on-main is not the default branch main for .claude/skills/ci-review.md.
Review mode: full
View review run

Review Summary

This PR adds an opt-in Unity Catalog catalog resource that hangs from metastore, keyed {metastore_id}::{name}. Each catalog gets static per-privilege entitlements plus a read-only owner. Grants and Grant/Revoke reuse the shared securable helpers. Metastore List stores each metastore's routes (running in-scope workspaces and owner) in the session store, and catalog List reads them back and walks one workspace per page-bag frame. main.go now enables the session store. I scanned the full PR diff for security and correctness, focusing on catalog.go, catalog_session.go, securable_helpers.go, metastore*.go, unity_catalog.go, and the wiring in connector.go, resource_types.go and main.go. I did not read the test files and docs line by line. No repo-local criteria loaded, so I applied the base prompt and the connector mixin.

The pagination, the 401/403/404 handling (no empty-list fallbacks, and the CATALOG_DOES_NOT_EXIST skip is documented), OptInRequired/SkipEntitlements on the type, ChildResourceType on the metastore, and the Grant/Revoke entity sources all look correct.

Security Issues

None found.

Correctness Issues

  • Prior — still present, pkg/databricks/unity_catalog.go:132: GetCatalog still joins the raw catalog name with JoinPath and skips the addressesSecurable guard that permissionsUrl (unity_catalog.go:342) applies. prepareRequest (request.go:267-272) unescapes the URL again, so a name containing ?, # or % reads a different catalog: sales?x reads sales. catalogThrough (catalog.go:405) checks only MetastoreID. routedEntitlement (catalog.go:704) then rebuilds the resource id from the returned catalog.Name, so resolveChange and the guarded permissionsUrl both see sales, and the PATCH lands on that catalog. Confidence: high on the code path, medium on how often such names occur. The existing open thread already covers this.

Suggestions

  • Prior — still present, pkg/connector/metastore_helpers.go:263: workspaceIsUsable still accepts CANCELLING, but the comments at lines 34-35 and 245-247 say such workspaces are out of scope. A metastore attached only to a cancelling workspace fails metastore and catalog List with FailedPrecondition on every sync. This fails closed. Confidence: high. These lines are no longer in this PR's diff, so I could not open a fresh inline thread; it is recorded here only.
  • New, pkg/databricks/unity_catalog.go:23-24,118-139 (B10, endpoint added): the PR adds the catalogs list/get endpoints, and the repo has no spec/openapi.json. Run the build-openapi-spec.md skill so the spec covers the Unity Catalog endpoints. Confidence: high. Not blocking.
Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

## Correctness Issues

In `pkg/databricks/unity_catalog.go`:
- Around line 132: GetCatalog builds its URL with JoinPath(unityCatalogCatalogsEndpoint, name) and does not check that the name survives URL assembly. prepareRequest unescapes the URL again, so a name containing "?", "#" or "%" reads a different catalog, and Grant/Revoke then PATCH that catalog through routedEntitlement in catalog.go. Before sending the request, call addressesSecurable(u, "/"+name) and return invalidArgument when it fails, the same way permissionsUrl does. Also consider checking in catalogThrough (pkg/connector/catalog.go around line 405) that the returned catalog.Name equals the requested catalogName. Add a test with a name like "sales?x".

## Suggestions

In `pkg/connector/metastore_helpers.go`:
- Around line 261-268: workspaceIsUsable returns true for CANCELLING, but the comments at lines 34-35 and 245-247 say a cancelling workspace will not become RUNNING and is left out of scope. Either remove workspaceStatusCancelling from the true case or update the comments to match the behavior.

In `pkg/databricks/unity_catalog.go`:
- Around lines 23-24 and 118-139: new Unity Catalog catalog endpoints were added and the repo has no spec/openapi.json. Run the build-openapi-spec.md skill to generate it so it covers these endpoints.

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Connector PR Review: [CXH-2721] - Add Unity Catalog catalog sync - Databricks Connector

Blocking Issues: 1 | Suggestions: 2 | Threads Resolved: 0
Criteria: Criteria status: none loaded - base ref mateoHernandez123/land-staging-on-main is not the default branch main for .claude/skills/ci-review.md.
Review mode: full
View review run

Review Summary

This PR adds an opt-in Unity Catalog catalog resource that hangs from metastore, keyed {metastore_id}::{name}. Each catalog gets static per-privilege entitlements plus a read-only owner. Grants and Grant/Revoke reuse the shared securable helpers. Metastore List stores each metastore's routes (running in-scope workspaces and owner) in the session store, and catalog List reads them back and walks one workspace per page-bag frame. main.go now enables the session store. I scanned the full PR diff for security and correctness, focusing on catalog.go, catalog_session.go, securable_helpers.go, metastore*.go, unity_catalog.go, and the wiring in connector.go, resource_types.go and main.go. I did not read the test files and docs line by line. No repo-local criteria loaded, so I applied the base prompt and the connector mixin.

The pagination, the 401/403/404 handling (no empty-list fallbacks, and the CATALOG_DOES_NOT_EXIST skip is documented), OptInRequired/SkipEntitlements on the type, ChildResourceType on the metastore, and the Grant/Revoke entity sources all look correct.

Security Issues

None found.

Correctness Issues

  • Prior — still present, pkg/databricks/unity_catalog.go:132: GetCatalog still joins the raw catalog name with JoinPath and skips the addressesSecurable guard that permissionsUrl (unity_catalog.go:342) applies. prepareRequest (request.go:267-272) unescapes the URL again, so a name containing ?, # or % reads a different catalog: sales?x reads sales. catalogThrough (catalog.go:405) checks only MetastoreID. routedEntitlement (catalog.go:704) then rebuilds the resource id from the returned catalog.Name, so resolveChange and the guarded permissionsUrl both see sales, and the PATCH lands on that catalog. Confidence: high on the code path, medium on how often such names occur. The existing open thread already covers this.

Suggestions

  • Prior — still present, pkg/connector/metastore_helpers.go:263: workspaceIsUsable still accepts CANCELLING, but the comments at lines 34-35 and 245-247 say such workspaces are out of scope. A metastore attached only to a cancelling workspace fails metastore and catalog List with FailedPrecondition on every sync. This fails closed. Confidence: high. These lines are no longer in this PR's diff, so I could not open a fresh inline thread; it is recorded here only.
  • New, pkg/databricks/unity_catalog.go:23-24,118-139 (B10, endpoint added): the PR adds the catalogs list/get endpoints, and the repo has no spec/openapi.json. Run the build-openapi-spec.md skill so the spec covers the Unity Catalog endpoints. Confidence: high. Not blocking.
Prompt for AI agents
Verify each finding against the current code and only fix it if needed.

## Correctness Issues

In `pkg/databricks/unity_catalog.go`:
- Around line 132: GetCatalog builds its URL with JoinPath(unityCatalogCatalogsEndpoint, name) and does not check that the name survives URL assembly. prepareRequest unescapes the URL again, so a name containing "?", "#" or "%" reads a different catalog, and Grant/Revoke then PATCH that catalog through routedEntitlement in catalog.go. Before sending the request, call addressesSecurable(u, "/"+name) and return invalidArgument when it fails, the same way permissionsUrl does. Also consider checking in catalogThrough (pkg/connector/catalog.go around line 405) that the returned catalog.Name equals the requested catalogName. Add a test with a name like "sales?x".

## Suggestions

In `pkg/connector/metastore_helpers.go`:
- Around line 261-268: workspaceIsUsable returns true for CANCELLING, but the comments at lines 34-35 and 245-247 say a cancelling workspace will not become RUNNING and is left out of scope. Either remove workspaceStatusCancelling from the true case or update the comments to match the behavior.

In `pkg/databricks/unity_catalog.go`:
- Around lines 23-24 and 118-139: new Unity Catalog catalog endpoints were added and the repo has no spec/openapi.json. Run the build-openapi-spec.md skill to generate it so it covers these endpoints.

Reviewed commit: a343b6888be7

@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 the full review report

@mateoHernandez123
mateoHernandez123 dismissed github-actions[bot]’s stale review November 3, 2026 20:57

Dismissing: this review is on a343b68 and both findings have moved since.

The blocking one, GetCatalog addressing a different catalog, is fixed in 2855a2b. GetCatalog now runs the same addressesSecurable guard permissionsUrl runs and rejects an answer whose name is not the one it asked for, and catalogThrough passes the InvalidArgument through instead of degrading it to Unknown. Two tests cover it and both fail without the guard.

The CANCELLING suggestion is declined, with the reasoning in the thread. Dropping CANCELLING from workspaceIsUsable takes the workspace out of scope, which leaves the metastore that routed through it out of the sync, and ConductorOne reads that as a deletion and removes its grants. The status set is deliberate; the comments that described it as dropped were the wrong half and are corrected in #90.

The openapi spec note is tracked as a follow-up.

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

Pass on f8cd1917. CI is green and this looks close: the errMetastoreGone / %w fixes, the GetCatalog guard (I traced ?, #, %2F and ..; all rejected), the system/samples skip and the session-store routes all check out. There's one low inline, and I bumped the CATALOG_DOES_NOT_EXIST thread.

Comment thread pkg/connector/metastore.go Resolved
mateoHernandez123 and others added 3 commits November 5, 2026 10:29
CXH-2721. Catalogs hang from the metastore, keyed {metastore_id}::{name},
with one entitlement per catalog privilege plus a read-only owner. The
connector reads them through every running in-scope workspace attached to
the metastore, caches the routes in the sync session store, and grants and
revokes privileges with a live read that bypasses the response cache.

The tree is unchanged from 60501e2, which is the state reviewed on #71.
The branch is rebuilt on top of the staging-to-main landing so the PR shows
only the catalog layer instead of the 42 staging commits it used to carry.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
GetCatalog joined the raw catalog name into the path and skipped the
addressesSecurable guard that permissionsUrl applies. prepareRequest
unescapes the URL again before sending it, so a name holding "?", "#" or
"%" addressed a different catalog: GetCatalog("sales?x") read "sales" and
returned it.

That answer reached a write. catalogThrough checked only MetastoreID, and
routedEntitlement rebuilds the resource from the returned catalog.Name, so
Grant and Revoke sent their PATCH to the catalog Databricks answered with
rather than the one the entitlement named.

GetCatalog now runs the same guard permissionsUrl runs, and rejects an
answer whose name is not the name it asked for. catalogThrough passes
InvalidArgument through instead of folding it into catalogListingError,
which would have degraded it to Unknown.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The profile workspace was reused whenever it was still attached, but it
was picked under the owner the last sync saw, and the owner decides which
workspaces read every privilege: with the connector owning the metastore
any of them does, otherwise only the ones it is a direct Admin of.

After a transfer the recorded workspace can be one the connector no
longer reads, while another attached workspace still satisfies the
documented rule. Grant and Revoke refused the write with PermissionDenied
and told the operator to grant Admin, on a metastore that was reachable.

The route is now kept only when it still reads under the live owner, so
the saved account round trip survives a transfer that does not move what
the connector can read, and otherwise pickReadableWorkspace runs again.

Also corrects the GetUncached comment: Cache-Control is part of the cache
key, so the no-cache read does not refresh the entry normal reads look up.
The behaviour is right and the comment described the opposite.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@mateoHernandez123
mateoHernandez123 force-pushed the mateoHernandez123/unity-catalog-catalog-sync branch from f8cd191 to 5cc43e3 Compare November 5, 2026 13:36
@mateoHernandez123
mateoHernandez123 changed the base branch from mateoHernandez123/land-staging-on-main to staging November 5, 2026 13:36
…s used

entitlementOnLiveRoute only re-checked that the workspace on the profile
still reads every privilege when the owner had changed since the sync that
recorded it. The owner is not the only thing that decides this: a connector
that does not own the metastore reads through a workspace it is a direct
Admin of, and that assignment can be withdrawn with the owner untouched.
The route was then kept, and resolveChange answered PermissionDenied, which
ConductorOne reports as a failed grant even though another attached
workspace could still serve it.

Dropping the owner condition re-checks the route on every provisioning call
that has one. It costs nothing when the connector owns the metastore, since
ownsPrincipal short-circuits before isWorkspaceAdmin, and one
ListWorkspaceMembers otherwise.

Not reproduced against a tenant: ours has one workspace and its service
principal owns the metastore, so the branch never nils the route there. The
test covers it instead, and fails on the old condition with
workspace = "wsa", want wsb. Verified live that the change is inert where it
does run: same route, same owner, no extra call.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

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

Re-checked all the old threads against HEAD. Nice work, almost everything landed. Two of mine (T27 partial list, T36 non-RUNNING bindings) only got docs answers; I left a note in those threads. New stuff inline. One pre-existing thing outside the diff, following the bot's earlier note about GetUncached (Cache-Control is part of the cache key, client.go:111): the bot called it comment-only, but unity_catalog.go:311-316 actually relies on that refresh. So after a Grant/Revoke, a sync within the hour can still read the pre-change page, and TestASyncReadAfterAGrantSeesThePostChangeState passes without the refresh because it never seeds the cache. Fix here or ticket? Also heads up: after #90 lands this conflicts in 5 files (connector/metastore/metastore_helpers/metastore_test/docs).

Comment thread pkg/config/config.go Resolved
Comment thread pkg/connector/securable_helpers.go Resolved
mateoHernandez123 and others added 2 commits November 12, 2026 13:58
Rebuilding this branch by squash onto the new base silently reverted #88
(03655ad), which had landed on staging in the meantime and touches the same
four files. The reverted text contradicts the code: ListWorkspaces applies
--databricks-exclude-workspaces before the audit feed picks a warehouse
(audit_event_feed.go:351-353), a statement gets statementWaitTimeout of 30s
plus statementPollMaxWait of 5 minutes rather than 5 minutes in total
(sql.go:22,31), incremental sync detects removed memberships but not deleted
principals, and access-control rule-set changes are not read at all.

config_schema.json matches the output of ./connector config.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…s trust

The shared Grants path decided by securable type which levels had already been
refused by List, so the branch named metastore and catalog in a file that knows
about neither. Both levels now carry listProvesTrust, and the branch reads the
flag.

No behaviour change: the two levels that exist both set it to true, so the
check is skipped exactly where it was skipped before. Dropping the branch
instead would not have been safe, since the schema, table and volume levels do
not prove trust in their own List and rely on Grants running the check; false
is the default that keeps that working.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Comment thread pkg/connector/securable_helpers.go Resolved
Comment thread pkg/connector/securable_helpers.go Resolved
Comment thread pkg/connector/securable_helpers.go Resolved
Comment thread pkg/connector/securable_helpers.go Resolved
Comment thread pkg/connector/catalog.go Resolved
Comment thread pkg/connector/catalog.go Resolved
Comment thread docs/connector.mdx Resolved
Comment thread docs/connector.mdx Resolved
mateoHernandez123 and others added 2 commits November 16, 2026 09:43
…on note

The securableLevel paragraph sat on securableOps, which left securableLevel
undocumented, and three doc comments still named the pre-refactor functions
syncSecurableGrants, grantSecurable and revokeSecurable.

profileKeyMetastoreOwner claimed List writes the owner so Grants does not
resolve it again. With listProvesTrust: true the catalog Grants path skips
ensureGrantsAreTrustworthy entirely, so the only reader left is the
provisioning trust check, which reads it off the resource routedEntitlement
rebuilds from the route it just resolved. catalogThrough kept the comparison
against the listing it replaced, which is history rather than behavior.

In connector.mdx, workspace Admin reads as if any Admin qualifies, while the
code accepts only an Admin assigned directly to the service principal, and
three new lines said ConductorOne where the rest of the page says C1.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…ready has

Three behaviors the code has and the docs did not state. A workspace that
refuses the catalog listing fails the sync naming the metastore and that
workspace, rather than removing the catalogs it could not list
(catalogListingError). Catalogs sync as children of a metastore, so a selection
that enables Catalogs without Metastores syncs nothing and still exits 0,
measured against the tenant with --sync-resource-types. The metastore standing
warning the section restructure dropped is back, because pickReadableWorkspace
still fails that sync.

Ownership is matched against the service principal itself, so the docs no
longer read as if a catalog owned by a group it belongs to counted. Databricks
documents neither that nor whether the permissions endpoint answers a partial
list instead of an error, so both now describe the connector, or the visibility
rule Databricks does document, rather than asserting vendor behavior. The
customer page drops the raw SYSTEM_CATALOG enum and the unmeasured samples
claim; the precise rule stays in docs-info, which also records that a catalog is
keyed by name because CatalogInfo exposes no immutable id.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@mateoHernandez123
mateoHernandez123 marked this pull request as draft November 16, 2026 13:34
mateoHernandez123 added a commit that referenced this pull request Nov 16, 2026
#71 moved on after this branch was cut: the trust check each securable
level runs now travels with the level through listProvesTrust, the
metastore route is re-checked on every use, and the README and the
connector doc gained the catalog failure modes. Schema sync keeps its own
trust read, because a schema listing proves nothing about the privileges
on it.

Conflicts resolved by keeping both sides: the renamed doc comments and
the level flag from #71, the trust-read classification and the
schema-aware wording from this branch.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
mateoHernandez123 added a commit that referenced this pull request Nov 16, 2026
#71 kept moving after this branch was cut, and its review rounds left the
schema layer behind on four counts.

**Writes were decided from sync-time owners.** Grant and Revoke read the
metastore owner, the catalog owner and the schema owner off the profile the
last sync wrote, and those three are exactly what the trust check
short-circuits on. An ownership transfer away from the connector therefore
left a write being decided from a privilege list Databricks had already
started truncating, and Revoke could report a grant removed that is still
held. Both now rebuild the entitlement's schema the way the catalog does: the
metastore owner from a live listing, the catalog from the recorded workspace
when this sync still admits it and otherwise from the first running in-scope
workspace that serves it, and the schema itself from a new
GET /schemas/{full_name}. Both paths bypass the HTTP cache, because a
remembered page would decide the write with the access of an earlier one. A
catalog no workspace serves is still not proof of deletion, so that case
refuses with FailedPrecondition; only a vendor code naming the schema or its
catalog is an absence, answering NotFound on Grant and GrantAlreadyRevoked on
Revoke.

**The recorded workspace was reused without asking whether this sync still
admits it.** The write now goes through profileRoute, which answers the
allowlist and the exclude set off the profile, as the catalog does.

**A live sighting did not supersede an earlier gone answer.** The walk in
pushRoute could empty a catalog that a later workspace had just listed. The
reads run in order and a catalog cannot be absent before it is present, so a
workspace that serves it now clears the flag. A metastore proved gone also
stops returning its bare sentinel, which reaches C1 as Unknown and is retried;
the metastore syncer removes the parent in the same sync.

**The sync session never reached the shared path.** Schema List and Grants now
carry it, so the workspace-Admin check behind the trust rule is read once per
workspace per sync instead of once per schema. The listing also gained the
repeated-page-token guard the catalog listing has.

Measured on the Baton account: grant, repeat, revoke, repeat on
test_workspace.default leaves 7 grants then 6 with the annotations in that
order, and the privilege is visible to Grants in between. A full sync of
account, user, group, service principal, metastore, catalog and schema exits 0
with no errors, twice, emitting the same 29 catalog and 10 schema grants.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
mateoHernandez123 added a commit that referenced this pull request Nov 16, 2026
connector.mdx prose uses C1 for the product, which luisina asked for on #71,
and the Go comments on staging follow the same convention. The schema layer
was written against the older wording and tipped the balance back: it added
eight "ConductorOne" to code comments. The lines #71 owns are left as they
are.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

10 participants