Skip to content

[CXH-2723] - Add Unity Catalog table and volume sync - Databricks Connector - #73

Draft
mateoHernandez123 wants to merge 9 commits into
mateoHernandez123/unity-catalog-schema-syncfrom
mateoHernandez123/unity-catalog-table-and-volume-sync
Draft

mateoHernandez123 wants to merge 9 commits into
mateoHernandez123/unity-catalog-schema-syncfrom
mateoHernandez123/unity-catalog-table-and-volume-sync

Conversation

@mateoHernandez123

@mateoHernandez123 mateoHernandez123 commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Description

  • Bug fix
  • New feature

Last of four stacked PRs for Unity Catalog (CXH-2723). Adds the table and volume resources: sync, entitlements, grants, and Grant/Revoke of their privileges. No new config field, no credential change.

Merge #71 and #72 first. This PR branches from #72, so GitHub moves the base down the stack as each parent lands.

What this adds

schema was a leaf. Tables and volumes now hang from it, each opt-in, keyed {metastore_id}::{catalog}.{schema}.{name}, with a read-only owner entitlement. These are the data assets an access review is about; every level before this one is a container that leads to them.

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

A principal can hold USE_SCHEMA and hold nothing on the tables under it, which is why each one is its own resource.

One table securable, several kinds of table

Unity Catalog uses one table securable for tables, views, materialized views, metric views and streaming tables. The grants API accepts a different set for each, so entitlements are built per instance from table_type rather than declared once. A privilege the API refuses is still reported when a principal already holds it; it is just not requestable, and Grant rejects it before any PATCH.

flowchart TD
  table[table_type] --> managed["MANAGED, EXTERNAL,<br/>shallow clones"]
  table --> view["VIEW, METRIC_VIEW"]
  table --> mv[MATERIALIZED_VIEW]
  table --> st[STREAMING_TABLE]
  table --> foreign[FOREIGN]
  table --> empty[missing or unrecognised]
  managed --> tpriv["the table set"]
  view --> vpriv["the view set;<br/>ALL_PRIVILEGES is report-only"]
  mv --> mvpriv["the view set + REFRESH,<br/>requestable"]
  st --> stpriv["SELECT, READ_METADATA, APPLY_TAG,<br/>MANAGE, ALL_PRIVILEGES, REFRESH;<br/>MODIFY is report-only"]
  foreign --> fpriv["read-only: no DELETE,<br/>INSERT, UPDATE or MODIFY"]
  empty --> anypriv["the union, so a held REFRESH<br/>is not dropped; it is report-only"]
Loading

A volume's set is static — ALL_PRIVILEGES, APPLY_TAG, MANAGE, READ_METADATA, READ_VOLUME, WRITE_VOLUME — so volume skips per-instance entitlements and table does not.

Who may list them, and who may read their privileges

Two different rights again, and this time they do not line up with the schema's. USE_SCHEMA and ALL_PRIVILEGES on the catalog each make the schema listing complete; only ALL_PRIVILEGES makes the table and volume listing complete. Databricks answers a caller that may not see everything with HTTP 200 and a short list, so each needs its own proof.

flowchart TD
  q["What may the service principal do on this schema?"] --> own{"owns the metastore,<br/>the catalog or the schema?"}
  own -->|yes| both["lists every table and volume<br/>and reads every privilege"]
  own -->|no| grp{"catalog owner is _workspace_admins_&lt;ws&gt;_&lt;id&gt;<br/>and a <b>direct</b> Admin there?"}
  grp -->|yes| both
  grp -->|no| all{"holds ALL_PRIVILEGES<br/>on the catalog?"}
  all -->|yes| listonly["lists every table and volume;<br/>Grants still needs MANAGE"]
  all -->|no| man{"holds MANAGE or USE_SCHEMA<br/>on the schema or the catalog?"}
  man -->|yes| schemaonly["the schemas sync;<br/>their children refuse with PermissionDenied"]
  man -->|no| deny["PermissionDenied naming the schema<br/>and the remedy — C1 removes nothing"]
  style both fill:#238636,color:#fff,stroke:#238636
  style listonly fill:#9e6a03,color:#fff,stroke:#9e6a03
  style schemaonly fill:#9e6a03,color:#fff,stroke:#9e6a03
  style deny fill:#da3633,color:#fff,stroke:#da3633
Loading

The amber branches are real setups, not corner cases: ALL_PRIVILEGES leaves MANAGE out, and USE_SCHEMA is the privilege an operator reaches for first. The setup docs now say what each level needs.

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
A workspace serves the catalog and the schema and proves the listing complete emits the tables and volumes synced
The first workspace refuses the catalog or the schema read (401, 403, 404) walks on to the next one in scope synced through the one that can
No workspace can prove it PermissionDenied naming the schema nothing removed
Every workspace answers the catalog is gone, none refusing emits nothing removed with the parent
A workspace serves the catalog after an earlier one called it gone the later sighting wins synced
A bare 404 on the children listing FailedPrecondition nothing removed
A privilege list that is not provably complete PermissionDenied nothing removed
A 404 naming the table itself emits no grants removed
A 404 naming a parent, or the generic one, with the parent served emits no grants removed
The same 404 where the parent does not answer refuses the read nothing removed
information_schema always skipped never synced

Provisioning

PATCH .../permissions/{table|volume}/{catalog}.{schema}.{name}, with an uncached pre-read deciding GrantAlreadyExists / GrantAlreadyRevoked and the echo confirming the write. owner is read-only and answers InvalidArgument, and so does a privilege the grants API refuses for that table_type — before any PATCH goes out.

Every write first rebuilds the securable from live reads, because the four owners the trust check short-circuits on — metastore, catalog, schema and the object itself — ride on the profile the last sync wrote, where they can be hours old. A table also re-reads table_type there, so a view replaced by a table is not checked against the recorded variant.

flowchart TD
  start[Grant or Revoke] --> live["live reads: metastore owner,<br/>catalog, schema, the table or volume"]
  live -->|recorded workspace still in scope and serving| trust[trust check on the securable]
  live -->|otherwise| walk[first running in-scope workspace that serves the catalog]
  walk --> trust
  live -->|names the object or a parent gone| gone{Grant or Revoke?}
  walk -->|no workspace serves the catalog| unproven[FailedPrecondition: deletion cannot be proved]
  gone -->|Grant| nf[NotFound]
  gone -->|Revoke| already[GrantAlreadyRevoked]
  trust --> read[uncached permissions pre-read]
  read --> patch[PATCH permissions, echo confirms]
Loading

Which 404 proves a deletion. On the sync path the read goes through the workspace the last sync wrote on the profile, so a 404 there can be a deletion or a workspace that no longer serves the catalog. Only a code naming the securable itself tells them apart, and that is TABLE_DOES_NOT_EXIST and nothing at all on a volume: measured on this tenant, the permissions endpoint answers RESOURCE_DOES_NOT_EXIST for a missing volume, a missing schema and a missing catalog alike, and never returns VOLUME_DOES_NOT_EXIST.

Every other code is confirmed before it is believed. The parent schema is read first through that same workspace; only a 200 there makes the securable's own 404 proof, which GET /tables/{full_name} or GET /volumes/{full_name} then settles. Any other answer from either read leaves the absence unproven and the caller refuses instead of reporting an empty list — the schema and catalog syncers walk every workspace, so a parent that is really gone is removed there, with its children. The confirmation costs two reads on a 404 and none on the happy path.

On the write path the same discipline is already in the route: the chosen workspace has just served the catalog and answered 200 for the schema, so a parent code at the leaf read is a deletion between two reads.

GET permissions/volume/<catalog>.<schema>.<missing>   404 RESOURCE_DOES_NOT_EXIST
GET permissions/volume/<catalog>.<missing schema>.x   404 RESOURCE_DOES_NOT_EXIST
GET volumes/<catalog>.<schema>.<missing>              404 RESOURCE_DOES_NOT_EXIST
GET volumes/<catalog>.<missing schema>.x              404 SCHEMA_DOES_NOT_EXIST
GET volumes/<catalog>.<schema>.<a volume that exists> 200

Measured on the Baton account

  • A sync of account, user, group, service principal, metastore, catalog, schema, table and volume exits 0 and emits the same counts three times: 325 resources, of which 1 catalog, 1 schema, 1 table and 1 volume, and 871 grants, 7 of them on the table and 6 on the volume. information_schema is not emitted.
  • The vendor answers in the volume block above were measured on this tenant.
  • The Grant, Grant, Revoke, Revoke cycle on a table and a volume privilege has not been re-run since the branch was rebased on [CXH-2722] - Add Unity Catalog schema sync - Databricks Connector #72. That is the measurement to repeat before this leaves draft.

Links

@linear-code

linear-code Bot commented Oct 9, 2026

Copy link
Copy Markdown

CXH-2723

@mateoHernandez123
mateoHernandez123 force-pushed the mateoHernandez123/unity-catalog-schema-sync branch from 920df46 to f9142b4 Compare October 9, 2026 13:20
@mateoHernandez123
mateoHernandez123 force-pushed the mateoHernandez123/unity-catalog-table-and-volume-sync branch from 0ee9040 to 38e403e Compare October 9, 2026 13:20
@mateoHernandez123
mateoHernandez123 force-pushed the mateoHernandez123/unity-catalog-schema-sync branch from f9142b4 to 29274ee Compare October 9, 2026 14:27
@mateoHernandez123
mateoHernandez123 force-pushed the mateoHernandez123/unity-catalog-table-and-volume-sync branch from 38e403e to 7c8e7a3 Compare October 9, 2026 14:27
@mateoHernandez123
mateoHernandez123 force-pushed the mateoHernandez123/unity-catalog-schema-sync branch from 29274ee to e74210e Compare October 9, 2026 16:46
@mateoHernandez123
mateoHernandez123 force-pushed the mateoHernandez123/unity-catalog-table-and-volume-sync branch from 7c8e7a3 to a3bd512 Compare October 9, 2026 16:46
@mateoHernandez123
mateoHernandez123 force-pushed the mateoHernandez123/unity-catalog-schema-sync branch from e74210e to 7deff05 Compare October 9, 2026 16:54
@mateoHernandez123
mateoHernandez123 force-pushed the mateoHernandez123/unity-catalog-table-and-volume-sync branch from a3bd512 to 5dce9b1 Compare October 9, 2026 16:54
@mateoHernandez123
mateoHernandez123 force-pushed the mateoHernandez123/unity-catalog-schema-sync branch from 7deff05 to 1253d7e Compare October 9, 2026 18:17
@mateoHernandez123
mateoHernandez123 force-pushed the mateoHernandez123/unity-catalog-table-and-volume-sync branch from 5dce9b1 to 5effb3f Compare October 9, 2026 18:17

@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 things: the per-table perf (the stack-wide one actually bites here), the List/Revoke 404 handling copied from #72, and the table_type mapping dropping REFRESH / ALL_PRIVILEGES grants from the sync. The rest are nits.

Comments tagged (out of scope) are inherited or stack-wide, so treat them as FYI, not blocking for this PR. Build/vet/tests pass locally.

Comment thread pkg/connector/table.go Resolved
Comment thread pkg/connector/table.go Resolved
Comment thread pkg/connector/volume.go Resolved
Comment thread pkg/connector/table.go Resolved
Comment thread pkg/connector/privileges.go Resolved
Comment thread pkg/connector/table.go Resolved
Comment thread pkg/connector/table.go Resolved
Comment thread pkg/connector/table.go Resolved
Comment thread docs/docs-info.md Resolved
Comment thread README.md 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 Image Image Image

mateoHernandez123 added a commit that referenced this pull request Nov 3, 2026
CXH-2723. Tables and volumes hang from the schema, each with its own
privilege set and a read-only owner.

The tree is unchanged from d10a7e9, the state reviewed and approved on #73.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@mateoHernandez123
mateoHernandez123 force-pushed the mateoHernandez123/unity-catalog-table-and-volume-sync branch from d10a7e9 to a03b5a6 Compare November 3, 2026 18:27
@mateoHernandez123
mateoHernandez123 force-pushed the mateoHernandez123/unity-catalog-schema-sync branch from b704b02 to f63db64 Compare November 3, 2026 20:10
mateoHernandez123 added a commit that referenced this pull request Nov 3, 2026
CXH-2723. Tables and volumes hang from the schema, each with its own
privilege set and a read-only owner.

The tree is unchanged from d10a7e9, the state reviewed and approved on #73.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@mateoHernandez123
mateoHernandez123 force-pushed the mateoHernandez123/unity-catalog-table-and-volume-sync branch from a03b5a6 to 47a3e98 Compare November 3, 2026 20:12
@mateoHernandez123
mateoHernandez123 force-pushed the mateoHernandez123/unity-catalog-schema-sync branch from f63db64 to 068e05d Compare November 3, 2026 20:46
mateoHernandez123 added a commit that referenced this pull request Nov 3, 2026
CXH-2723. Tables and volumes hang from the schema, each with its own
privilege set and a read-only owner.

The tree is unchanged from d10a7e9, the state reviewed and approved on #73.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@mateoHernandez123
mateoHernandez123 force-pushed the mateoHernandez123/unity-catalog-table-and-volume-sync branch from 47a3e98 to acfcba8 Compare November 3, 2026 20:49
Comment thread pkg/connector/connector.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.

Round 7. Nice: the single-schema GET fixes the O(schemas²), the walks now continue (with two-workspace tests), and volumes confirm the generic 404. CI green. One thing I'd still want before merge: the gone codes trusted from a single workspace (inline on volume.go:61/81).

(out of scope, #71) the catalog is still emitted once per bound workspace (catalog.go:225-238, no dedupe), so its whole subtree gets listed W times, Sergio's perf point. FYI on the trait split: per c1 (uplift_app.go), only TRAIT_APP resources become child apps, so not having it on 100k tables is actually a plus. Dropping it from all five like you asked ggreer sounds good to me.

Comment thread pkg/connector/volume.go Resolved
Comment thread pkg/connector/volume.go Resolved
Comment thread baton_capabilities.json Resolved
Comment thread pkg/connector/schema_child.go Resolved
mateoHernandez123 added a commit that referenced this pull request Nov 5, 2026
CXH-2723. Tables and volumes hang from the schema, each with its own
privilege set and a read-only owner.

The tree is unchanged from d10a7e9, the state reviewed and approved on #73.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@mateoHernandez123
mateoHernandez123 force-pushed the mateoHernandez123/unity-catalog-schema-sync branch from 068e05d to fbc1394 Compare November 5, 2026 13:36
@mateoHernandez123
mateoHernandez123 force-pushed the mateoHernandez123/unity-catalog-table-and-volume-sync branch from 101ce0f to d5596f4 Compare November 5, 2026 13:36
@mateoHernandez123
mateoHernandez123 marked this pull request as draft November 5, 2026 13:41
mateoHernandez123 added a commit that referenced this pull request Nov 17, 2026
CXH-2723. Tables and volumes hang from the schema, each with its own
privilege set and a read-only owner.

The tree is unchanged from d10a7e9, the state reviewed and approved on #73.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@mateoHernandez123
mateoHernandez123 force-pushed the mateoHernandez123/unity-catalog-table-and-volume-sync branch from 34cecee to 9b8a7aa Compare November 17, 2026 13:18
mateoHernandez123 and others added 9 commits November 18, 2026 13:08
CXH-2723. Tables and volumes hang from the schema, each with its own
privilege set and a read-only owner.

The tree is unchanged from d10a7e9, the state reviewed and approved on #73.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Listing a schema's tables or volumes resolved its route on the first page,
once per child type, and schemaThrough found the schema by paging the whole
catalog's schema listing. That is one full listing walk per schema per child
type: a catalog with 1,000 schemas spends about 21,000 listing requests, and
43,000 requests in all, before the first table is listed. The uhttp GET cache
hid it while a catalog's listing fit in the 5 MB it holds by default, which a
catalog of 30 KB schema rows does not.

schemaThrough now reads the one schema it needs. The same catalog costs 2,000
schema reads instead, and the cost is linear in the schema count rather than
quadratic.

Error classification is unchanged. A 404 naming SCHEMA_DOES_NOT_EXIST is read
exactly like a schema absent from the listing was: proof of deletion only for
a caller that sees the whole catalog, since Databricks answers the same way
for a schema the caller merely cannot see. Every other refusal, including a
404 carrying no code, still leaves the schema unknown rather than absent --
read as an empty result the SDK would skip the children and ConductorOne
would delete every table and volume under the schema.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Listing a schema's tables or volumes returned the catalog read's error for
every refusal, where the schema syncer walks on to the next workspace. A
catalog bound to one workspace of several is answered by the others with a
404, and which of the two answers Databricks gives decides which way this
breaks.

A 404 carrying no error code reached the SDK as codes.NotFound, which it
reads as a warning: the listing finished green with no resources and
ConductorOne deleted every table and volume under the schema. A 404 naming
CATALOG_DOES_NOT_EXIST raised errCatalogGone, which failed the whole sync.

Both now continue the walk, matching the schema syncer. A catalog every
workspace names as gone, with none refusing the read, empties the listing:
the catalog syncer drops it in the same sync. A refusal still fails the
sync and keeps what ConductorOne already has.

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

schemaThrough classified every refusal of the single-schema read with
schemaListingError, which maps CATALOG_DOES_NOT_EXIST to codes.NotFound.
The SDK reads NotFound from a List as a warning, not a failure: isWarning
(sync/syncer.go) returns true for it and syncOneAction
(sync/parallel_syncer.go) logs "skipping sync action" and carries on. The
listing then completes having emitted nothing and ConductorOne deletes
every table and volume under that schema.

A parent-catalog 404 is a real answer there: measured on the tenant,
GET /schemas/{full} returns CATALOG_DOES_NOT_EXIST once the catalog is
dropped. So the read now refuses as unreadable, which reaches C1 as
FailedPrecondition and keeps what it already has. Only a code naming the
schema itself still reports errSchemaGone, and the caller decides what
that absence means.

The message drops the privilege remedy: it is the answer to a partial
listing, not to an arbitrary refusal, and on a 403 it contradicted the
remedy the client layer already appends. schemaReadError is inlined into
the branch that uses it, since it classified nothing.

Side effect worth naming: a 403 now reaches C1 as PermissionDenied and a
401 as Unauthenticated, where both were FailedPrecondition. Neither is a
warning, so neither changes what C1 keeps.

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

and volume layer behind on the same counts, one level deeper.

**Writes were decided from sync-time owners.** Grant and Revoke read the
metastore owner, the catalog owner, the schema owner and the securable's own
owner off the profile the last sync wrote, and those four 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 table or volume the way the
schema 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, the schema from GET
/schemas/{full_name}, and the securable itself from a new GET
/tables/{full_name} or from GET /volumes/{full_name}. The whole path bypasses
the HTTP cache, because a remembered page would decide the write with the
access of an earlier one. A table also reads table_type live, so the write is
no longer checked against the variant the last sync happened to record.

**A live sighting did not supersede an earlier gone answer.** The walk in
pushSchemaChildRoute could empty a schema's children on a gone answer a later
workspace had already contradicted. 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 the account no longer lists also stops returning its bare
sentinel; the metastore syncer removes the parent in the same sync.

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

**A refused schema read stopped the walk.** Only the catalog read continued to
the next workspace, so a 401, 403 or 404 on the schema failed the sync even
where another in-scope workspace serves it. Both reads now walk on, and a
refusal left standing is still an error rather than an empty listing: emptying
one is reserved for a parent every workspace named as gone with none refusing.

GetTable and GetVolume check the name Databricks answers with, as GetCatalog and
GetSchema do, because the owner they report decides whether a privilege list is
complete. GetSchema now refuses an answer naming no schema at all for that same
reason, which is what the client test on this branch already asserted.

Not re-measured against the tenant yet.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The file was 293 lines built on the fake Databricks account the schema tests
carried, and #72 dropped that fake with them. What it proved was that the code
does what it was written to do. The tenant run is what answers whether the layer
works, and QA runs the connector against a tenant before production.

Nothing tracked references the fake or its helpers any more, so the package
builds and tests clean without this file, which is the view CI gets. It stays
excluded per clone, next to the schema tests, for local iteration.

The client tests in pkg/databricks/unity_catalog_test.go stay: they assert the
query set a listing sends and the name a single read is allowed to answer with,
which is a contract rather than a restatement of the caller.

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

resource_types.go dropped TRAIT_APP from table and volume, because neither has
app semantics and a profile rides on any resource now. The committed
capabilities file still carried the trait, and its workflow only regenerates on
a push to main, so CI would not have caught it before the file reached the
customer-facing docs.

Regenerated with the same command the workflow runs. The trait is gone from both
types, and the volume's SkipEntitlements annotation moved with it; the volume
keeps a static entitlement set and the table does not, because its privileges
follow table_type.

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

The setup sections stopped at the catalog and the schema, so an operator who
grants USE_SCHEMA follows them, sees the schemas synced, and then fails on the
tables and volumes under them: listing those needs ownership of the metastore,
the catalog or the schema, direct workspace Admin where the admins group owns
the catalog, or ALL_PRIVILEGES on the catalog, and reading one's privileges
needs ownership or MANAGE on it, its schema or its catalog. USE_SCHEMA and
MANAGE answer neither. The README, the connector doc and the limitations now
state both requirements, as the catalog and schema sections do.

The limitations also gain the table and volume keys, the one table securable
that covers views, materialized views, metric views and streaming tables, and
the privileges that are reported when already held but cannot be requested.

Two corrections ride along. The ownership limitation said a workspace admins
group is never shown; the principal resolver looks an owner name up against the
account groups, and a workspace admins group is one, so it is shown when it
resolves there. The limitation now says so, which is what the connector doc on
this branch already said. And the opt-in is a C1 setting, so it does not gate
the CLI: a local run with no selection syncs every type and fails on a service
principal that cannot list every table and volume. The README now says to pass
--sync-resource-types there.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…e is gone

A 404 on the permissions endpoint decided whether Grants reports no grants and
Revoke answers GrantAlreadyRevoked. The table level took SCHEMA_DOES_NOT_EXIST
and CATALOG_DOES_NOT_EXIST as proof, and the volume level took those plus the
generic RESOURCE_DOES_NOT_EXIST after reading the volume through the same
workspace. Every one of those codes also comes back from a workspace that
cannot serve the catalog, and the sync path reads through the workspace the
last sync wrote on the profile, so a binding that changed since then made a
revoke report success while the privilege was still held, and emptied the
securable's grants in C1.

The parent is now read first through that same workspace. Only a schema it
answers 200 for makes the securable's own 404 proof; the securable is then read
with GET /tables/{full_name} or GET /volumes/{full_name}, and a 404 there is a
deletion. Any other answer, from either read, leaves the absence unproven, so
the caller refuses rather than reporting an empty list. The parent syncer walks
every workspace and removes the parent with its children when it is really gone.

Only a code naming the securable itself stays unambiguous, which is
TABLE_DOES_NOT_EXIST and nothing on a volume: Databricks never returns
VOLUME_DOES_NOT_EXIST. The confirmation costs two reads on a 404 and none on
the happy path.

The write path already had this discipline after the live-route change:
liveChildRoute has the chosen workspace serve the catalog and answer 200 for
the schema before the leaf is read, so a parent code there is a deletion
between two reads. The comments now say so.

schema_child_gone_test.go pins the contract in five cases for both levels:
parent served plus a leaf 404 is gone, parent served plus a leaf 200 is not,
and a parent that answers 404, answers 403, or a leaf read that fails leaves it
unproven with no leaf read attempted when the parent did not answer.

A full tenant sync still exits 0 with the same counts as before the change:
871 grants, 7 on the table and 6 on the volume.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@mateoHernandez123
mateoHernandez123 force-pushed the mateoHernandez123/unity-catalog-table-and-volume-sync branch from f16c40a to 4c26675 Compare November 18, 2026 16:27
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.

7 participants