Repository navigation
feat: Introduce CatalogWarehouseOps & CatalogNamespaceOps abstractions - #1440
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughRefactors authorization and namespace handling across authz, server, and catalog layers; introduces new error types; shifts many interfaces to use GetNamespaceResponse and Authorizer-associated action types; reworks Postgres implementations with explicit error enums; converts Azure ADLS IO and consumers to async; updates OpenAPI schema to include warehouse_id in namespace identifiers; adjusts tests accordingly. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Client
participant ApiServer
participant Authorizer
participant CatalogStore
participant OpenFGA as OpenFGA Backend
participant DB
Client->>ApiServer: Request (namespace-scoped op)
ApiServer->>CatalogStore: require_namespace(warehouse_id, ident)
CatalogStore->>DB: Lookup by id or name
DB-->>CatalogStore: GetNamespaceResponse
CatalogStore-->>ApiServer: GetNamespaceResponse
ApiServer->>Authorizer: require_namespace_action(metadata, &namespace, Action)
Authorizer->>OpenFGA: batch/check(namespace.namespace_id, action)
OpenFGA-->>Authorizer: Result<bool> | BackendUnavailable
Authorizer-->>ApiServer: Allowed | AuthZ error
alt Allowed
ApiServer->>CatalogStore: Perform business op (uses namespace.namespace_id)
CatalogStore->>DB: Execute
DB-->>CatalogStore: Result
CatalogStore-->>ApiServer: Result
ApiServer-->>Client: Response
else Denied / Backend down
ApiServer-->>Client: ErrorModel (forbidden/unavailable)
end
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 9
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (8)
crates/lakekeeper/src/service/storage/az.rs (1)
502-515: Bug: removing wrong SAS token key from TablePropertiesYou populate
adls.sas-tokenbut callconfig.remove(sas_token_prefix), which won’t remove the actual prefixed key (e.g.,adls.sas-token.account.endpoint). This likely leaves the old key in-place.Fix by tracking and removing the exact matched key:
- let mut sas_token = None; + let mut sas_token = None; + let mut sas_token_key: Option<String> = None; for (key, value) in &config { if key.starts_with(sas_token_prefix) { - sas_token = Some(value.to_string()); + sas_token = Some(value.to_string()); + sas_token_key = Some(key.clone()); break; } } if let Some(sas_token) = sas_token { - config.remove(sas_token_prefix); + if let Some(key_to_remove) = sas_token_key { + config.remove(&key_to_remove); + } config.insert("adls.sas-token".to_string(), sas_token); }crates/lakekeeper/src/server/s3_signer/sign.rs (1)
233-253: Clone the catalog state before passing it into the cache closure.
stateis moved into the async closure supplied totry_get_with, butmokamay invoke that closure more than once. BecauseApiContext<State<…>>(and in turnState) isn’tCopy, the second invocation will attempt to re-use an already-moved value and the code will not compile. Clone the state before the closure (or clone inside it) and move the clone instead.crates/lakekeeper/src/server/views/create.rs (1)
140-149: Reconsider side-effect ordering around DB commit.You write the metadata file and update OpenFGA (authorizer.create_view) before committing the DB transaction. If the commit fails, you may leave:
- A stale metadata file in storage.
- Stale authz tuples referencing a non-existent view.
Prefer:
- Commit DB transaction first, then perform idempotent external writes; or
- Add compensating cleanup/rollback for failures after external side effects; or
- Wrap authorizer updates in a best-effort compensating delete on commit failure paths.
At minimum, document the invariant and add tracing around these steps.
Also applies to: 169-179
crates/lakekeeper/src/server/views/commit.rs (1)
355-361: Fix error type label for SetProperties pathThe error type says "AddSchemaError" in SetProperties branch; use a matching label.
- ViewUpdate::SetProperties { updates } => m.set_properties(updates).map_err(|e| { - ErrorModel::bad_request( - format!("Error setting properties: {e}"), - "AddSchemaError", - Some(Box::new(e)), - ) - })?, + ViewUpdate::SetProperties { updates } => m.set_properties(updates).map_err(|e| { + ErrorModel::bad_request( + format!("Error setting properties: {e}"), + "SetPropertiesError", + Some(Box::new(e)), + ) + })?,crates/lakekeeper/src/api/management/v1/tasks.rs (1)
317-318: Clonev1_state.authzbefore use
Replace alllet authorizer = context.v1_state.authz;withlet authorizer = context.v1_state.authz.clone();to avoid moving the field and prevent compile errors.crates/lakekeeper/src/api/management/v1/warehouse/mod.rs (2)
318-350: TOCTOU: overlap check happens outside the write transaction.A concurrent create can slip in between the check and create_warehouse(), leading to overlapping warehouses.
Consider one of:
- Re-run the overlap check inside the write transaction just before creation (needs a txn-aware list or a dedicated “has_overlap” query).
- Take a project-scoped advisory lock during creation.
- Persist a normalized storage root fingerprint and enforce uniqueness at DB level (unique index on (project_id, fingerprint)).
Pick the least invasive option now and plan the stronger invariant later.
675-714: Possible secret leak on failure (new secret created before DB commit).If update_storage_profile or commit fails, the newly created secret remains.
Suggested pattern:
- Track the newly created secret_id.
- On any error after creation but before commit, best-effort delete it.
- C::update_storage_profile( + let created_secret = secret_id.clone(); + if let Err(e) = C::update_storage_profile( warehouse_id, storage_profile, secret_id, transaction.transaction(), - ) - .await?; + ) + .await + { + if let Some(id) = created_secret { + let _ = context.v1_state.secrets.delete_secret(&id).await; + } + return Err(e); + }Apply similarly in update_storage_credential.
crates/lakekeeper/src/implementations/postgres/warehouse.rs (1)
370-386: get_warehouse_by_id should return only active warehouses.Trait contract says “Return only active warehouses.” Query misses status filter, returning inactive rows as Some(...).
Apply this diff:
FROM warehouse - WHERE warehouse_id = $1 + WHERE warehouse_id = $1 + AND status = 'active'Add/adjust tests if needed to assert None for inactive warehouses.
🧹 Nitpick comments (25)
crates/lakekeeper/src/tests/soft_deletion.rs (1)
89-89: Consider removing redundant clone for consistency.Since
api_contextis already cloned on line 81 for the spawned task and is not used after being passed tocreate_table, the additional.clone()on line 89 appears unnecessary. The deletion pattern (lines 110, 125) clones once and passes directly, which is more straightforward.Apply this diff if you'd like to align with the deletion pattern:
crate::tests::create_table( - api_context.clone(), + api_context, &warehouse_id, &ns_name, &table_name, false, )docs/docs/api/management-open-api.yaml (1)
3774-3786: Breaking change: namespace-id variant now requires warehouse-idThe schema now mandates
warehouse-idalongsidenamespace-id. Consider adding a short deprecation/migration note in the component/description to aid client upgrades (e.g., “since vX.Y, warehouse-id is required for namespace-id variants”).crates/io/tests/integration_tests.rs (1)
107-112: ADLS async init: LGTMAwait + error mapping fits the new async client. Consider
map_err(anyhow::Error::from)for brevity, but current code is fine.crates/lakekeeper/src/service/authz/namespace.rs (1)
18-25: NamespaceAction bound may be too strictRequiring Copy can limit extensibility of action types. Consider Clone instead and adjust call sites (you already collect into Vecs), to allow non-Copy action enums/structs.
crates/lakekeeper/src/service/authz/error.rs (1)
11-29: Unified authz error surface: LGTMClean enum, helpful logging, and consistent ErrorModel/Iceberg conversions. Optional: implement
From<E>forAuthorizationBackendUnavailableto enable?ergonomics at call sites.Also applies to: 31-76, 78-150
crates/lakekeeper/src/service/catalog_store/namespace.rs (1)
22-23: Minor consistency: use imported HashMapYou already
use std::collections::HashMap; preferOption<Arc<HashMap<String, String>>>for consistency.crates/authz-openfga/src/api.rs (3)
1571-1588: Avoid cross-entity coupling on relation string for managed_accessBoth get_managed_access and set_managed_access hardcode NamespaceRelations::ManagedAccess for all OpenFGA entities (including warehouses). This relies on string equality with WarehouseRelation::_ManagedAccess (asserted in tests), which is brittle.
Prefer an explicit per-entity relation source (trait or helper) to avoid relying on string identity across enums.
Example direction:
- Introduce a trait like ManagedAccessRel { fn managed_access_rel() -> &'static str; } implemented for namespace/warehouse.
- Use T::managed_access_rel() instead of a specific enum here.
Also applies to: 1590-1632
1466-1483: Gate “allowed actions” with a consistent READ_ASSIGNMENTS relation constantUsing RoleAction::ReadAssignments as the gate across all entities is fine, but it depends on enum parity elsewhere. Consider centralizing this relation string (e.g., a const READ_ASSIGNMENTS_REL) to prevent accidental divergence if one enum changes.
1517-1569: checked_write: authz checks and writes look correct; consider early exit on no-opsLogic is sound: fail-fast on anonymous, check distinct grant relations, then write/delete tuples. Minor: if both writes/deletes are empty, you can return early to skip roundtrips.
+ if writes.is_empty() && deletes.is_empty() { + return Ok(()); + }crates/lakekeeper/src/server/views/drop.rs (1)
48-51: Split read-only lookup from authz; minor error-ordering nitPattern of: begin_read → view_to_id → commit → require_view_action is good to bound transaction scope and let authz map not-found to 404. Minor nit: if view_to_id errors and commit also errors, the commit error would overshadow the original cause. Low probability on read-only tx; acceptable, but consider preserving the original error in that edge case.
Also applies to: 52-61
crates/lakekeeper/src/service/catalog_store/warehouse.rs (1)
515-523: Parameter name does not match semantics; rename for clarity.The parameter
include_inactive: Option<Vec<WarehouseStatus>>is used as a general status filter (not just “inactive”). Please rename tostatus_filter(orinclude_status) to align withlist_warehouses_impland Postgres impls.Suggested change:
- include_inactive: Option<Vec<WarehouseStatus>>, + status_filter: Option<Vec<WarehouseStatus>>, ... - Self::list_warehouses_impl(project_id, include_inactive, state).await + Self::list_warehouses_impl(project_id, status_filter, state).awaitcrates/authz-openfga/src/check.rs (1)
259-278: Avoid silently ignoring commit errors on read transactions.
t.commit().await.ok();swallows commit errors. Even for read-only transactions, prefer handling the result explicitly to aid debugging:- t.commit().await.ok(); + if let Err(e) = t.commit().await { + tracing::debug!("Read transaction commit failed: {}", e); + }Also applies to: 309-323
crates/lakekeeper/src/server/views/rename.rs (1)
42-50: Drop unused bindingThe
_destination_namespacebinding is unused. Just await the check.- let _destination_namespace = authorizer - .require_namespace_action( + authorizer + .require_namespace_action( &request_metadata, warehouse_id, &destination.namespace, destination_namespace, CatalogNamespaceAction::CanCreateView, ) .await?;crates/lakekeeper/src/service/mod.rs (1)
13-13: Wildcard re-export expands public API surface
pub use catalog_store::*;may unintentionally expose unstable/internal items and increase semver surface. Consider curating explicit re-exports if you need a stable facade.Would you like a follow-up PR to generate an explicit export list from current
catalog_storeand guard it with a lint to prevent accidental expansion?crates/lakekeeper/src/server/tabular.rs (1)
32-37: Simplify props extraction (clearer, zero-copy until clone).Use as_deref().cloned() for readability.
- let namespace_props = NamespaceProperties::from_props_unchecked( - namespace - .properties - .as_ref() - .map(|arc| (**arc).clone()) - .unwrap_or_default(), - ); + let props = namespace.properties.as_deref().cloned().unwrap_or_default(); + let namespace_props = NamespaceProperties::from_props_unchecked(props);crates/lakekeeper/src/api/management/v1/warehouse/mod.rs (1)
447-449: Nit: variable naming.Rename warehouses to warehouse for clarity.
- let warehouses = C::require_warehouse_by_id(warehouse_id, context.v1_state.catalog).await?; - Ok(warehouses.into()) + let warehouse = C::require_warehouse_by_id(warehouse_id, context.v1_state.catalog).await?; + Ok(warehouse.into())crates/lakekeeper/src/service/catalog_store/error.rs (1)
10-33: API: error stack helpers look good; consider more flexible inputs (optional)If desired, allow
Into<String>for iter items to reduce pre‑allocation calls by callers:IntoIterator<Item = impl Into<String>>.crates/lakekeeper/src/implementations/postgres/tabular/table/mod.rs (1)
1781-1852: Tests validate new API well; add one “all namespaces” case (optional)You only test
Some(namespace_id). Consider a case withNoneto cover listing across all namespaces.Also applies to: 1890-1903, 1911-1949
crates/lakekeeper/src/service/authz/mod.rs (1)
395-410: Avoid cloning namespaces in batch (minor)Cloning
GetNamespaceResponseper item is unnecessary. You can pass&GetNamespaceResponseby capturingnsby reference using an outer iterator with indices or build futures withoutasync move. Low priority.crates/authz-openfga/src/error.rs (3)
130-144: Make tuple-error parsing more robust (avoid strict prefix match).Tonic/OpenFGA messages can vary by prefixes. Use contains (case-insensitive) to reduce brittleness.
Apply this diff:
- if let Some(tonic_msg) = tonic_msg { - if tonic_msg.starts_with("cannot write a tuple which already exists") { + if let Some(tonic_msg) = tonic_msg { + let msg = tonic_msg.to_lowercase(); + if msg.contains("cannot write a tuple which already exists") { CannotWriteTupleAlreadyExists::new(err).into() - } else if tonic_msg.starts_with("cannot delete a tuple which does not exist") { + } else if msg.contains("cannot delete a tuple which does not exist") { CannotDeleteTupleNotFound::new(err).into() } else { OpenFGAError::InternalClientError(Box::new(err)) } } else {
148-183: Return client-friendly statuses for known not-found conditions.ActiveAuthModelNotFound and StoreNotFound currently fall through to 500 Internal. Consider mapping to 404/BadRequest for clearer API semantics.
Example:
e @ OpenFGAError::UnexpectedEntity { .. } => { ErrorModel::internal(err_msg, "UnexpectedEntity", Some(Box::new(e))) } + e @ OpenFGAError::ActiveAuthModelNotFound(_) => { + ErrorModel::not_found(err_msg, "ActiveAuthModelNotFound", Some(Box::new(e))) + } + e @ OpenFGAError::StoreNotFound(_) => { + ErrorModel::not_found(err_msg, "OpenFGAStoreNotFound", Some(Box::new(e))) + }Ensure this aligns with how callers expect to handle these cases across the API.
102-103: Fix typo in error message.- #[error("Project ID could not be inferred from request. Please the x-project-id header.")] + #[error("Project ID could not be inferred from request. Please provide the x-project-id header.")]crates/lakekeeper/src/implementations/postgres/namespace.rs (2)
110-113: Simplify deref for namespace parameter.&**namespace is needlessly verbose. Use &*namespace for consistency with the rest of the file.
- &**namespace + &*namespace
60-63: Prefer joining on column equality (readability and planner hints).JOIN warehouse w ON w.warehouse_id = n.warehouse_id is clearer than joining on a constant plus WHERE n.warehouse_id = $1. Behavior is equivalent.
- INNER JOIN warehouse w ON w.warehouse_id = $1 - WHERE n.warehouse_id = $1 AND n.namespace_id = $2 + INNER JOIN warehouse w ON w.warehouse_id = n.warehouse_id + WHERE n.warehouse_id = $1 AND n.namespace_id = $2Repeat similarly in get_namespace_by_name.
crates/lakekeeper/src/service/authz/warehouse.rs (1)
63-71: Use StatusCode constant instead of magic number.403 literal → StatusCode::FORBIDDEN for consistency.
+use http::StatusCode; ... - .code(403) + .code(StatusCode::FORBIDDEN.as_u16())
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (13)
.sqlx/query-1d0cb1d056e3548367921b0e7025e35e980a3552bbcbd43854526a0d929c400e.jsonis excluded by!.sqlx/**.sqlx/query-3825f4716e00a71fb46aaa18e953c11b7a299121bc0e973e5a576739b9c7268d.jsonis excluded by!.sqlx/**.sqlx/query-81df0fa9748d146d001fbca533e66283a0b300f2a40d333cbd60e6106519cdbf.jsonis excluded by!.sqlx/**.sqlx/query-9273e2f8dcbe95cea43881df45f01b8978b790599b3305ab23962b4da98d0e83.jsonis excluded by!.sqlx/**.sqlx/query-9bc04467160500d3a3264752358940111c4a6d6c1166e5149e6904d5e6a97818.jsonis excluded by!.sqlx/**.sqlx/query-b112ca3312e5cc2afd8f88a711167812adb9864e1dfeec54eee7a1ef3f911840.jsonis excluded by!.sqlx/**.sqlx/query-b66d81a80cd1cad8eee213f207d9f6cc06bfb9f05afe692467f9bc2fdeeebf2f.jsonis excluded by!.sqlx/**.sqlx/query-c4cf266a651d75b87cfe60d918feb743a8497e8fbfb91d229f5b5ca6892ae7bc.jsonis excluded by!.sqlx/**.sqlx/query-ccbea715ba7c06e557278d6f27f0a46758a993b17a9edf9de436ff5b4c1e206a.jsonis excluded by!.sqlx/**.sqlx/query-d40e3c7d861bae5fed1b1d305279452251efee6a91bd1b8407cb1e30ecc159b7.jsonis excluded by!.sqlx/**.sqlx/query-d7b34e6105d171cd1b8657ab93cb59daf79dd50c9ed4490876f99af1ec6edf6c.jsonis excluded by!.sqlx/**.sqlx/query-ee04ca38143ff8486fef248896cecab290a62d9459fdc744f69156eb4301dc10.jsonis excluded by!.sqlx/**.sqlx/query-f03f99482c51e3ca3c4df6bd7e7d62d7f033833bbcc0907e3be294f870342329.jsonis excluded by!.sqlx/**
📒 Files selected for processing (50)
Cargo.toml(2 hunks)crates/authz-openfga/src/api.rs(4 hunks)crates/authz-openfga/src/authorizer.rs(12 hunks)crates/authz-openfga/src/check.rs(6 hunks)crates/authz-openfga/src/config.rs(1 hunks)crates/authz-openfga/src/error.rs(4 hunks)crates/authz-openfga/src/relations.rs(5 hunks)crates/io/src/adls.rs(6 hunks)crates/io/tests/integration_tests.rs(1 hunks)crates/lakekeeper/src/api/iceberg/v1/namespace.rs(0 hunks)crates/lakekeeper/src/api/management/v1/namespace.rs(3 hunks)crates/lakekeeper/src/api/management/v1/tabular.rs(2 hunks)crates/lakekeeper/src/api/management/v1/tasks.rs(5 hunks)crates/lakekeeper/src/api/management/v1/warehouse/mod.rs(6 hunks)crates/lakekeeper/src/implementations/postgres/catalog.rs(11 hunks)crates/lakekeeper/src/implementations/postgres/dbutils.rs(4 hunks)crates/lakekeeper/src/implementations/postgres/namespace.rs(15 hunks)crates/lakekeeper/src/implementations/postgres/tabular/mod.rs(2 hunks)crates/lakekeeper/src/implementations/postgres/tabular/table/mod.rs(12 hunks)crates/lakekeeper/src/implementations/postgres/tabular/view/mod.rs(4 hunks)crates/lakekeeper/src/implementations/postgres/warehouse.rs(19 hunks)crates/lakekeeper/src/server/config.rs(3 hunks)crates/lakekeeper/src/server/mod.rs(5 hunks)crates/lakekeeper/src/server/namespace.rs(18 hunks)crates/lakekeeper/src/server/s3_signer/sign.rs(2 hunks)crates/lakekeeper/src/server/tables.rs(22 hunks)crates/lakekeeper/src/server/tables/create_table.rs(6 hunks)crates/lakekeeper/src/server/tabular.rs(4 hunks)crates/lakekeeper/src/server/views.rs(15 hunks)crates/lakekeeper/src/server/views/commit.rs(3 hunks)crates/lakekeeper/src/server/views/create.rs(5 hunks)crates/lakekeeper/src/server/views/drop.rs(4 hunks)crates/lakekeeper/src/server/views/list.rs(2 hunks)crates/lakekeeper/src/server/views/load.rs(3 hunks)crates/lakekeeper/src/server/views/rename.rs(3 hunks)crates/lakekeeper/src/service/authz/error.rs(1 hunks)crates/lakekeeper/src/service/authz/implementations/allow_all.rs(3 hunks)crates/lakekeeper/src/service/authz/mod.rs(9 hunks)crates/lakekeeper/src/service/authz/namespace.rs(1 hunks)crates/lakekeeper/src/service/authz/warehouse.rs(1 hunks)crates/lakekeeper/src/service/catalog_store.rs(7 hunks)crates/lakekeeper/src/service/catalog_store/error.rs(1 hunks)crates/lakekeeper/src/service/catalog_store/namespace.rs(2 hunks)crates/lakekeeper/src/service/catalog_store/warehouse.rs(2 hunks)crates/lakekeeper/src/service/mod.rs(1 hunks)crates/lakekeeper/src/service/storage/az.rs(4 hunks)crates/lakekeeper/src/service/storage/mod.rs(1 hunks)crates/lakekeeper/src/service/tasks/tabular_purge_queue.rs(2 hunks)crates/lakekeeper/src/tests/soft_deletion.rs(1 hunks)docs/docs/api/management-open-api.yaml(1 hunks)
💤 Files with no reviewable changes (1)
- crates/lakekeeper/src/api/iceberg/v1/namespace.rs
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-25T06:54:15.179Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1378
File: crates/lakekeeper/src/api/management/v1/warehouse/undrop.rs:51-53
Timestamp: 2025-09-25T06:54:15.179Z
Learning: In the lakekeeper codebase, when iterating over &[TabularId] and pattern matching TabularId::View(id), the id variable has type &ViewId. Using *id correctly dereferences to get ViewId, which can be passed directly to authorization methods that expect ViewId parameters.
Applied to files:
crates/lakekeeper/src/implementations/postgres/tabular/view/mod.rs
🧬 Code graph analysis (33)
crates/lakekeeper/src/server/views/list.rs (5)
crates/lakekeeper/src/server/mod.rs (2)
require_warehouse_id(54-68)fetch_until_full_page(177-239)crates/lakekeeper/src/service/catalog_store/namespace.rs (1)
require_namespace(175-182)crates/lakekeeper/src/service/catalog_store.rs (2)
begin_read(74-74)list_views(450-455)crates/lakekeeper/src/implementations/postgres/catalog.rs (1)
list_views(561-575)crates/lakekeeper/src/implementations/postgres/tabular/view/mod.rs (1)
list_views(477-513)
crates/lakekeeper/src/implementations/postgres/dbutils.rs (1)
crates/lakekeeper/src/service/catalog_store/error.rs (3)
new(99-108)new(158-163)new_unexpected(110-119)
crates/lakekeeper/src/server/views/load.rs (3)
crates/lakekeeper/src/service/catalog_store.rs (1)
begin_read(74-74)crates/lakekeeper/src/implementations/postgres/mod.rs (1)
begin_read(79-93)crates/lakekeeper/src/service/catalog_store/warehouse.rs (1)
require_warehouse_by_id(536-543)
crates/lakekeeper/src/server/views/drop.rs (4)
crates/lakekeeper/src/service/catalog_store.rs (3)
begin_read(74-74)view_to_id(427-431)begin_write(72-72)crates/lakekeeper/src/implementations/postgres/mod.rs (2)
begin_read(79-93)begin_write(69-77)crates/lakekeeper/src/implementations/postgres/catalog.rs (1)
view_to_id(523-529)crates/lakekeeper/src/service/catalog_store/warehouse.rs (1)
require_warehouse_by_id(536-543)
crates/lakekeeper/src/service/storage/az.rs (2)
crates/lakekeeper/src/service/storage/s3.rs (2)
try_from(1069-1093)lakekeeper_io(274-283)crates/lakekeeper/src/service/storage/gcs/mod.rs (2)
try_from(434-450)lakekeeper_io(174-184)
crates/lakekeeper/src/server/views/commit.rs (4)
crates/lakekeeper/src/service/catalog_store.rs (2)
begin_read(74-74)view_to_id(427-431)crates/lakekeeper/src/implementations/postgres/mod.rs (1)
begin_read(79-93)crates/lakekeeper/src/service/catalog_store/warehouse.rs (1)
require_warehouse_by_id(536-543)crates/lakekeeper/src/service/catalog_store/namespace.rs (1)
require_namespace(175-182)
crates/lakekeeper/src/server/s3_signer/sign.rs (1)
crates/lakekeeper/src/service/catalog_store/warehouse.rs (1)
require_warehouse_by_id(536-543)
crates/lakekeeper/src/server/tables/create_table.rs (3)
crates/lakekeeper/src/server/io.rs (1)
write_file(12-25)crates/lakekeeper/src/service/catalog_store/namespace.rs (2)
new(69-75)require_namespace(175-182)crates/lakekeeper/src/service/catalog_store/warehouse.rs (5)
new(81-86)new(115-120)new(171-177)new(206-211)require_warehouse_by_id(536-543)
crates/lakekeeper/src/server/views/rename.rs (2)
crates/lakekeeper/src/service/catalog_store/namespace.rs (1)
require_namespace(175-182)crates/lakekeeper/src/service/catalog_store.rs (3)
begin_read(74-74)view_to_id(427-431)begin_write(72-72)
crates/lakekeeper/src/server/mod.rs (3)
crates/lakekeeper/src/implementations/postgres/mod.rs (2)
from_pools(143-154)from_pools(195-199)crates/lakekeeper/src/tests/internal_helper.rs (1)
create_ns(54-70)crates/lakekeeper/src/service/catalog_store/namespace.rs (2)
require_namespace(175-182)new(69-75)
crates/lakekeeper/src/service/authz/error.rs (1)
crates/lakekeeper/src/service/catalog_store/error.rs (7)
fmt(129-146)fmt(169-179)error_chain_fmt(182-193)from(196-216)from(220-230)eq(91-95)source(123-125)
crates/lakekeeper/src/service/authz/implementations/allow_all.rs (2)
crates/lakekeeper/src/service/authz/mod.rs (2)
is_allowed_namespace_action_impl(365-370)is_allowed_namespace_action_impl(1117-1128)crates/authz-openfga/src/authorizer.rs (1)
is_allowed_namespace_action_impl(318-331)
crates/lakekeeper/src/server/tables.rs (5)
crates/lakekeeper/src/server/namespace.rs (2)
validate_namespace_ident(649-680)server(122-122)crates/lakekeeper/src/server/mod.rs (4)
fetch_until_full_page(177-239)new(103-122)maybe_get_secret(70-79)create_ns(310-326)crates/lakekeeper/src/service/catalog_store/namespace.rs (2)
require_namespace(175-182)new(69-75)crates/lakekeeper/src/service/catalog_store.rs (3)
begin_read(74-74)list_tables(302-307)begin_write(72-72)crates/lakekeeper/src/service/catalog_store/warehouse.rs (5)
new(81-86)new(115-120)new(171-177)new(206-211)require_warehouse_by_id(536-543)
crates/io/src/adls.rs (4)
crates/io/src/gcs.rs (1)
get_storage_client(59-65)crates/io/src/s3.rs (1)
get_storage_client(110-121)crates/io/src/adls/adls_storage.rs (1)
client(96-98)crates/lakekeeper/src/service/storage/az.rs (1)
cloud_location(183-194)
crates/lakekeeper/src/service/authz/namespace.rs (5)
crates/lakekeeper/src/service/catalog_store/error.rs (6)
fmt(129-146)fmt(169-179)new(99-108)new(158-163)from(196-216)from(220-230)crates/lakekeeper/src/service/catalog_store/namespace.rs (6)
fmt(47-52)new(69-75)from(55-57)from(80-88)from(139-145)from(148-150)crates/lakekeeper/src/service/authz/error.rs (3)
fmt(111-128)new(40-50)new(93-101)crates/lakekeeper/src/request_metadata.rs (1)
actor(165-170)crates/iceberg-ext/src/catalog/rest/error.rs (1)
forbidden(211-217)
crates/authz-openfga/src/error.rs (3)
crates/authz-openfga/src/authorizer.rs (2)
new(56-66)new_authorizer_in_empty_store(1116-1130)crates/lakekeeper/src/service/authz/error.rs (3)
new(40-50)new(93-101)source(105-107)crates/iceberg-ext/src/catalog/rest/error.rs (3)
conflict(174-180)internal(161-172)bad_request(127-133)
crates/lakekeeper/src/server/namespace.rs (5)
crates/lakekeeper/src/service/tasks/mod.rs (5)
tasks(456-473)warehouse_id(97-103)id(316-318)id(378-380)schedule_task(417-441)crates/lakekeeper/src/service/catalog_store/namespace.rs (2)
new(69-75)require_namespace(175-182)crates/lakekeeper/src/service/catalog_store/warehouse.rs (20)
new(81-86)new(115-120)new(171-177)new(206-211)require_warehouse_by_id(536-543)from(91-99)from(102-104)from(125-133)from(136-138)from(189-194)from(215-240)from(244-246)from(287-313)from(316-318)from(334-339)from(342-344)from(362-367)from(370-372)from(408-414)from(417-419)crates/lakekeeper/src/implementations/postgres/catalog.rs (2)
create_namespace(120-127)drop_namespace(137-144)crates/lakekeeper/src/implementations/postgres/namespace.rs (3)
create_namespace(301-384)drop_namespace(387-564)get_namespace_by_name(88-130)
crates/lakekeeper/src/service/tasks/tabular_purge_queue.rs (1)
crates/lakekeeper/src/service/catalog_store/warehouse.rs (1)
require_warehouse_by_id(536-543)
crates/lakekeeper/src/implementations/postgres/namespace.rs (2)
crates/lakekeeper/src/service/catalog_store/namespace.rs (4)
get_namespace(159-171)database_integrity(125-127)new(69-75)require_namespace(175-182)crates/lakekeeper/src/api/iceberg/mod.rs (2)
namespace(59-59)with_capacity(111-117)
crates/lakekeeper/src/service/catalog_store/error.rs (3)
crates/lakekeeper/src/service/catalog_store/namespace.rs (7)
fmt(47-52)append_detail(104-117)from(55-57)from(80-88)from(139-145)from(148-150)new(69-75)crates/lakekeeper/src/service/authz/error.rs (4)
fmt(111-128)new(40-50)new(93-101)source(105-107)crates/lakekeeper/src/service/catalog_store/warehouse.rs (8)
append_detail(387-400)append_detail(433-446)from(91-99)from(102-104)new(81-86)new(115-120)new(171-177)new(206-211)
crates/lakekeeper/src/service/catalog_store.rs (2)
crates/lakekeeper/src/implementations/postgres/catalog.rs (9)
create_warehouse_impl(377-394)delete_warehouse_impl(468-474)rename_warehouse_impl(476-482)list_warehouses_impl(445-451)get_warehouse_by_id_impl(453-458)get_warehouse_by_name_impl(104-110)get_warehouse_stats(460-466)set_warehouse_deletion_profile(484-490)get_namespace_impl(129-135)crates/lakekeeper/src/implementations/postgres/warehouse.rs (2)
get_warehouse_stats(643-719)set_warehouse_deletion_profile(30-65)
crates/lakekeeper/src/api/management/v1/warehouse/mod.rs (2)
crates/lakekeeper/src/service/catalog_store/warehouse.rs (2)
list_warehouses(515-523)require_warehouse_by_id(536-543)crates/lakekeeper/src/implementations/postgres/warehouse.rs (1)
list_warehouses(244-309)
crates/lakekeeper/src/service/catalog_store/namespace.rs (5)
crates/lakekeeper/src/service/catalog_store/error.rs (6)
fmt(129-146)fmt(169-179)from(196-216)from(220-230)new(99-108)new(158-163)crates/lakekeeper/src/service/authz/namespace.rs (1)
new(33-38)crates/lakekeeper/src/implementations/postgres/namespace.rs (1)
get_namespace(29-40)crates/lakekeeper/src/implementations/postgres/catalog.rs (1)
get_namespace_impl(129-135)crates/lakekeeper/src/service/catalog_store.rs (1)
get_namespace_impl(238-242)
crates/lakekeeper/src/api/management/v1/namespace.rs (3)
crates/lakekeeper/src/service/catalog_store/namespace.rs (1)
require_namespace(175-182)crates/lakekeeper/src/service/catalog_store.rs (1)
begin_write(72-72)crates/lakekeeper/src/implementations/postgres/mod.rs (1)
begin_write(69-77)
crates/lakekeeper/src/service/authz/warehouse.rs (2)
crates/lakekeeper/src/service/authz/error.rs (3)
fmt(111-128)new(40-50)new(93-101)crates/lakekeeper/src/service/catalog_store/warehouse.rs (2)
new(81-86)new(115-120)
crates/authz-openfga/src/authorizer.rs (3)
crates/lakekeeper/src/service/authz/implementations/allow_all.rs (1)
is_allowed_namespace_action_impl(140-147)crates/lakekeeper/src/service/authz/mod.rs (5)
are_allowed_warehouse_actions_impl(372-393)is_allowed_namespace_action_impl(365-370)is_allowed_namespace_action_impl(1117-1128)are_allowed_namespace_actions_impl(395-411)new(967-973)crates/authz-openfga/src/error.rs (12)
new(201-203)new(258-262)new(272-276)from(27-29)from(33-40)from(44-59)from(63-65)from(69-71)from(129-145)from(149-184)from(188-191)from(217-240)
crates/lakekeeper/src/service/catalog_store/warehouse.rs (4)
crates/lakekeeper/src/service/catalog_store/error.rs (5)
new(99-108)new(158-163)from(196-216)from(220-230)source(123-125)crates/lakekeeper/src/api/management/v1/warehouse/mod.rs (5)
from(1105-1115)create_warehouse(284-380)delete_warehouse(476-501)rename_warehouse(529-554)list_warehouses(382-429)crates/lakekeeper/src/implementations/postgres/warehouse.rs (7)
from(617-622)create_warehouse(67-124)delete_warehouse(436-489)rename_warehouse(491-514)list_warehouses(244-309)get_warehouse_by_id(360-407)get_warehouse_by_name(311-358)crates/lakekeeper/src/service/catalog_store.rs (7)
transaction(80-80)create_warehouse_impl(140-147)delete_warehouse_impl(150-154)rename_warehouse_impl(157-161)list_warehouses_impl(164-170)get_warehouse_by_id_impl(175-178)get_warehouse_by_name_impl(183-187)
crates/lakekeeper/src/implementations/postgres/warehouse.rs (3)
crates/lakekeeper/src/service/catalog_store/warehouse.rs (7)
new(81-86)new(115-120)new(171-177)new(206-211)get_warehouse_by_name(545-551)get_warehouse_by_id(528-533)list_warehouses(515-523)crates/lakekeeper/src/implementations/postgres/dbutils.rs (2)
into_catalog_backend_error(14-14)into_catalog_backend_error(45-65)crates/lakekeeper/src/service/catalog_store.rs (1)
transaction(80-80)
crates/lakekeeper/src/implementations/postgres/catalog.rs (7)
crates/lakekeeper/src/service/catalog_store.rs (10)
list_namespaces(224-228)list_tabulars(269-275)get_warehouse_by_name_impl(183-187)transaction(80-80)get_namespace_impl(238-242)list_tables(302-307)create_warehouse_impl(140-147)list_warehouses_impl(164-170)get_warehouse_by_id_impl(175-178)list_views(450-455)crates/lakekeeper/src/implementations/postgres/namespace.rs (2)
get_namespace(29-40)list_namespaces(133-299)crates/lakekeeper/src/service/catalog_store/namespace.rs (1)
get_namespace(159-171)crates/lakekeeper/src/implementations/postgres/warehouse.rs (6)
create_warehouse(67-124)delete_warehouse(436-489)get_warehouse_by_id(360-407)get_warehouse_by_name(311-358)list_warehouses(244-309)rename_warehouse(491-514)crates/lakekeeper/src/service/catalog_store/warehouse.rs (6)
create_warehouse(474-492)delete_warehouse(495-503)get_warehouse_by_id(528-533)get_warehouse_by_name(545-551)list_warehouses(515-523)rename_warehouse(506-512)crates/lakekeeper/src/implementations/postgres/tabular/table/mod.rs (1)
list_tables(209-244)crates/lakekeeper/src/implementations/postgres/tabular/view/mod.rs (1)
list_views(477-513)
crates/lakekeeper/src/server/views/create.rs (5)
crates/lakekeeper/src/server/mod.rs (2)
require_warehouse_id(54-68)new(103-122)crates/lakekeeper/src/service/catalog_store/namespace.rs (2)
new(69-75)require_namespace(175-182)crates/lakekeeper/src/service/catalog_store/warehouse.rs (5)
new(81-86)new(115-120)new(171-177)new(206-211)require_warehouse_by_id(536-543)crates/lakekeeper/src/service/catalog_store.rs (1)
begin_write(72-72)crates/lakekeeper/src/implementations/postgres/mod.rs (1)
begin_write(69-77)
crates/authz-openfga/src/check.rs (3)
crates/lakekeeper/src/server/tables.rs (4)
server(121-121)authorized_table_ident_to_id(635-635)authorized_table_ident_to_id(699-699)authorized_table_ident_to_id(1246-1263)crates/lakekeeper/src/server/views/exists.rs (2)
authorized_view_ident_to_id(27-27)authorized_view_ident_to_id(42-58)crates/lakekeeper/src/service/catalog_store/namespace.rs (1)
require_namespace(175-182)
crates/lakekeeper/src/service/authz/mod.rs (2)
crates/authz-openfga/src/authorizer.rs (4)
is_allowed_namespace_action_impl(318-331)are_allowed_warehouse_actions_impl(302-316)are_allowed_namespace_actions_impl(333-347)new(56-66)crates/lakekeeper/src/service/authz/namespace.rs (3)
actions(236-239)actions(261-264)is_allowed_namespace_action(212-225)
crates/lakekeeper/src/implementations/postgres/tabular/table/mod.rs (2)
crates/lakekeeper/src/implementations/postgres/namespace.rs (1)
initialize_namespace(695-722)crates/lakekeeper/src/implementations/postgres/catalog.rs (1)
list_tables(162-176)
⏰ 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). (6)
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: docker / docker
- GitHub Check: security_audit
- GitHub Check: Analyze (actions)
🔇 Additional comments (61)
crates/lakekeeper/src/service/storage/mod.rs (1)
162-171: Correct to await ADLS lakekeeper_ioAdding
.awaitfor the ADLS branch matches the async signature change. LGTM.crates/lakekeeper/src/service/storage/az.rs (1)
203-213: ADLS init path migrated to async correctlyAsync-ifying
blob_service_client/lakekeeper_ioand awaiting ingenerate_table_configaligns with the IO layer. Looks consistent with S3/GCS patterns.Also applies to: 220-229, 251-254, 264-274
crates/io/src/adls.rs (1)
48-55: Async client/credential path + future cache: solid migration
- Switched to
moka::future::Cachewith asynctry_get_withand TTL: good.- Made client/credential getters async and awaited appropriately: consistent with other backends.
- Transport/retry options and shared HTTP client wiring look fine.
LGTM.
Also applies to: 92-99, 104-136, 142-155, 160-172, 174-201
Cargo.toml (1)
92-92: Async moka + sqlx upgrade: no remaining sync cache usages foundcrates/lakekeeper/src/service/authz/implementations/allow_all.rs (1)
52-56: Associated types and updated auth checks: LGTMAligned with new Authorizer trait surface; returns now wrap backend unavailability correctly.
Also applies to: 131-138, 140-147
crates/lakekeeper/src/service/authz/namespace.rs (1)
165-210: Authorization flow and error shaping: LGTMDual-check (CanGetMetadata + requested action) correctly prevents namespace existence leaks; error conversions are coherent.
crates/lakekeeper/src/service/catalog_store/namespace.rs (1)
173-175: Doc comment may be inaccurateThe implementation does not check warehouse “active” state. Either add that check or adjust the comment.
crates/authz-openfga/src/api.rs (3)
497-529: Warehouse auth properties endpoint is correct; parity with namespaceLooks good: CanGetMetadata check, then compute managed_access via shared helper. Aligns with the new warehouse/namespace ops split.
1746-1809: Batch namespace checks in tests: good coverageRandomized multi-namespace permission checks validate batch_check assembly/disassembly. The switch to are_allowed_namespace_actions_impl with GetNamespaceResponse inputs aligns with the new API.
Also applies to: 1817-1869
1305-1334: CheckRequest’s schema already requireswarehouse_idfor namespace checks.crates/lakekeeper/src/server/views/list.rs (3)
26-41: Namespace resolve + authz flow is clear; good separation before DB transactionResolving the namespace via C::require_namespace and then enforcing CanListViews with authorizer.require_namespace_action before opening a DB transaction reduces transactional scope and contention. Nice.
Also applies to: 42-51
53-61: list_entities call updated to accept resolved namespacePassing the resolved namespace (not just ids) into list_entities!(View, list_views, …) matches the new CatalogNamespaceOps signature. Looks correct.
72-78: Efficient response constructionUsing then_some for optional fields and avoiding extra allocations looks good.
crates/lakekeeper/src/service/tasks/tabular_purge_queue.rs (2)
136-143: Direct warehouse lookup without transaction simplifies the workerSwitching from a read transaction to C::require_warehouse_by_id removes unnecessary transactional overhead for a read-only task. Error mapping is preserved and clearer.
160-169: IO initialization error mappingConverting errors to IcebergErrorResponse with contextual detail is appropriate for operational diagnostics.
crates/lakekeeper/src/api/management/v1/tabular.rs (2)
36-46: Combine warehouse checks into a single batched callUsing are_allowed_warehouse_actions_arr to fetch CanUse and CanListEverything together reduces roundtrips and simplifies control flow. Immediate failure on !CanUse with AuthZCannotUseWarehouseId is correct.
Also applies to: 47-49
78-93: Per-item authz fallback is correct when not list-allPartitioning tables/views, batching are_allowed_* calls, and zipping results back to filter authorized items is clean and efficient for small result sets from search_tabular.
Also applies to: 95-110
crates/lakekeeper/src/server/views/drop.rs (1)
64-76: Business logic flow and task scheduling look soundFetching warehouse via require_warehouse_by_id, enforcing delete profile (hard vs soft), scheduling purge/expiration tasks within the write txn, then committing and cleaning authz with best-effort delete is solid and consistent with other tabular flows.
Also applies to: 76-110, 110-142
crates/lakekeeper/src/service/catalog_store/warehouse.rs (1)
141-159: Error modeling looks solid and consistent.Clear error enums, simple error helpers, and proper conversions to ErrorModel/IcebergErrorResponse. Good use of stack detail via macros.
Also applies to: 214-247, 286-319, 333-345, 349-373, 376-406, 422-466
crates/authz-openfga/src/check.rs (1)
205-231: Namespace check now requires warehouse_id — good change.The new flow correctly scopes namespace resolution and authorization by warehouse. Serialization tests cover the new shape.
crates/lakekeeper/src/implementations/postgres/tabular/view/mod.rs (1)
477-513: Switch to NamespaceId is correct and consistent.Accepting
Option<NamespaceId>and forwarding tolist_tabularsmatches the new catalog interface and simplifies lookups. Mapping to ViewId remains correct.crates/lakekeeper/src/server/views/create.rs (1)
62-74: Namespace-centric authz flow is correct.Resolving namespace via Catalog and then enforcing
CanCreateViewis aligned with the new API surface. Passingnamespace.namespace_iddownstream is appropriate.Also applies to: 125-135
crates/lakekeeper/src/server/mod.rs (1)
372-412: Test scaffolding updated to GetNamespaceResponse — looks good.Using
require_namespaceand returning(WarehouseId, GetNamespaceResponse, NamespaceParameters)matches the new namespace model and simplifies callers.crates/lakekeeper/src/server/views/commit.rs (1)
72-83: AuthZ and read-commit barrier: LGTMGood pattern: check warehouse/use, resolve view_id under read txn, authorize, then commit read before proceeding.
crates/lakekeeper/src/api/management/v1/namespace.rs (1)
31-45: Resolve-then-authorize flow and write-after-auth: LGTMNamespace is resolved first, authorization performed on resolved data, and write begins only after auth. Matches the new patterns across the codebase.
Also applies to: 63-80
crates/lakekeeper/src/api/management/v1/tasks.rs (2)
345-355: Consolidated warehouse checks: LGTMSingle call to
are_allowed_warehouse_actions_arrwith early CanUse guard simplifies and speeds up authz.
422-435: Control-path authz split is correctWarehouse-wide control is short-circuited; otherwise entity-scoped checks are enforced (with Undrop actions for expiration tasks). Looks good.
Please ensure OpenAPI/SDKs reflect the new NotAuthorized error when CanUse is denied (AuthZCannotUseWarehouseId).
Also applies to: 462-496
crates/lakekeeper/src/server/views/rename.rs (1)
33-34: Keep direct move ofauthz; no clone required. Movingauthzout of the ownedApiContextis valid and Rust’s partial-move semantics allow using the otherv1_statefields afterward.Likely an incorrect or invalid review comment.
crates/lakekeeper/src/server/tabular.rs (1)
59-136: Macro changes look correct; aligns with GetNamespaceResponse-based APIs.Deriving warehouse_id from namespace_response and passing response to C::list_* and authz is correct. Ensure call sites import CatalogNamespaceAction.
crates/lakekeeper/src/api/management/v1/warehouse/mod.rs (1)
399-427: Efficient authz filtering over pre-fetched warehouses.Good switch to are_allowed_warehouse_actions_vec and zip/filter. Clear and performant.
crates/lakekeeper/src/server/tables.rs (3)
96-116: Namespace-first authZ flow + macro usage look good.Validates provided_ns, resolves namespace, checks CanListTables, then lists via list_entities!(Table,…). Solid.
Also applies to: 119-126
363-378: Txn boundaries for credentials load look safe.Resolve/auth under read txn, then fetch warehouse and generate config. Clear separation of concerns.
Also applies to: 384-391
673-709: Rename: correct to authorize destination namespace create before source rename.Good sequence and error mapping.
crates/lakekeeper/src/server/views.rs (1)
160-166: Tests updated to GetNamespaceResponse: consistent and correct.Switching helpers and calls (list_views/create_view) to namespace objects aligns with new APIs.
Also applies to: 221-236, 247-271, 286-306, 351-364, 372-395, 412-444, 466-499
crates/lakekeeper/src/service/authz/mod.rs (4)
213-215: Associated types for actions: good abstractionMoving to
type WarehouseAction/NamespaceActionimproves flexibility and decouples implementations.
372-393: Default batch impl for warehouses: OKParallelizes single checks; includes length assert. Fine for back-compat.
1019-1128: HidingAuthorizer updates align with new APIAssociated types and new
is_allowed_namespace_action_implsignature are correctly handled.
1335-1392: Namespace test macro adapts to new signatureSupplying a
GetNamespaceResponseinstance is appropriate; macro name is unique in this file.crates/lakekeeper/src/server/namespace.rs (7)
73-91: Early warehouse gating is correctChecking
CanUseandCanListNamespacesupfront prevents leakage. Good separation from business logic.
92-118: Parent-namespace gating + “list everything” short-circuitThe combined warehouse/namespace “can_list_everything” logic is sound and avoids unnecessary per‑item checks.
120-147: Pagination masking is coherent
- Uses catalog page tokens and then applies auth mask; consistent.
- Minor: You derive IDs from
responses(namespace.namespace_id) instead of theidsvector—ensure both remain aligned (they should, viamultiunzip).Also applies to: 152-171, 178-185
242-299: Create namespace: authz flow + managed props look good
- Parent path requires
CanCreateNamespace; root path requires warehouseCanCreateNamespace.- Location/property sanitation is correct; injecting
namespace_idinto response is helpful.
316-339: Get properties: authz and property augmentation OKReturns stored props plus
namespace_idwhen requested; aligns with API expectations.
393-434: Drop namespace: strong authz + warehouse fetchCorrectly requires
CanDeleteand loads warehouse prior to drop.
495-603: Recursive drop: transaction semantics + cleanup
- Drops in a single transaction; schedules purge tasks inside the same transaction, then commits—good atomicity.
- Post‑commit best‑effort authorizer cleanup for namespace, child tables/views, and child namespaces is robust.
crates/authz-openfga/src/authorizer.rs (3)
72-74: Associated actions + OpenFGA checks: correct wiring
type WarehouseAction = WarehouseRelation/NamespaceAction = NamespaceRelation.- New impls return
AuthorizationBackendUnavailablevia conversions—good boundary separation.Also applies to: 287-316, 318-347
835-901: batch_check error handling hardened
- Correlation id parsing surfaces
UnexpectedCorrelationId.- Batch errors map to
BatchCheckErrorand missing results toMissingItemInBatchCheck.
Solid diagnostics.
368-386: Table/view batch checks leveragebatch_checkConsistent with warehouse/namespace batching; reduces round‑trips.
Also applies to: 407-425
crates/lakekeeper/src/implementations/postgres/tabular/table/mod.rs (1)
209-227: Switch to Option fully propagated Verified alllist_tablescalls acceptOption<NamespaceId>; no stragglers remain.crates/lakekeeper/src/implementations/postgres/warehouse.rs (1)
311-357: OK: get_warehouse_by_name enforces active-only.Status filter and full mapping look good.
crates/lakekeeper/src/service/catalog_store.rs (3)
138-147: *API surface rename to _impl looks consistent.Clearer separation of trait wrapper vs impl. Signatures and error types look aligned.
237-243: Namespace retrieval contract clarified.Returning GetNamespaceResponse (not Option) from get_namespace_impl matches “require” semantics elsewhere. Good.
302-308: Adjusting list_tables/list_views to take GetNamespaceResponse is a good move.Removes repeated lookups and avoids TOCTOU on namespace state.
Also applies to: 450-456
crates/lakekeeper/src/implementations/postgres/catalog.rs (8)
112-118: list_namespaces return type change LGTM; confirm downstream updates.Now returns PaginatedMapping<NamespaceId, GetNamespaceResponse>. Ensure callers expecting NamespaceInfo are migrated.
129-135: get_namespace_impl: correct typed error plumbing.Returns GetNamespaceResponse with CatalogGetNamespaceError via read_pool executor. Looks correct.
162-176: list_tables now accepts &GetNamespaceResponse; verify callsites and avoid extra lookups.Passing (namespace.warehouse_id, Some(namespace.namespace_id)) is correct. Confirm all callers provide GetNamespaceResponse (not just ids) to avoid extra DB round-trips.
377-385: create_warehouse_impl: typed error forwarder LGTM.Signature and delegation match postgres impl and new error enum.
445-451: list_warehouses_impl: status_filter + Executor usage LGTM.Uses read_pool as Executor and typed error enum; good.
453-458: get_warehouse_by_id_impl: typed error forwarder LGTM.Consistent with other *_impl methods.
476-482: rename_warehouse_impl: typed error result LGTM.Matches pattern and delegates correctly.
561-575: list_views updated to &GetNamespaceResponse; confirm callsites.Passing (warehouse_id, Some(namespace_id)) matches tabular/view API. Ensure upstream code now supplies GetNamespaceResponse to prevent extra queries.
|
@CodeRabbit review and resolve comments if fixed |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 21966 If you found this review helpful, would you consider giving us a shout-out on X? Thank you for using CodeRabbit! |
✅ PR Title Formatted CorrectlyThe title of this PR match the correct format. Thank you! |
|
@CodeRabbit review, approve if ok |
🧩 Analysis chain🏁 Script executed: Length of output: 3096 🏁 Script executed: Length of output: 1672 🏁 Script executed: Length of output: 811 @c-thiel, I've completed a comprehensive review of PR #1440. Everything looks excellent! 🎉 ✅ Review SummaryArchitecture & Design
Code Quality
Key Changes Verified✅ Error type consistency (std::result::Result) The refactoring is substantial but well-executed. The code maintains consistency, proper error handling, and follows Rust best practices throughout. Approving this PR! 🚀 ✅ Actions performedComments resolved and changes approved. |
commit e2da40f Author: Christian <[email protected]> Date: Tue Oct 21 08:34:40 2025 +0200 feat: Introduce CatalogWarehouseOps & CatalogNamespaceOps abstractions (#1440) commit b8fcf54 Author: Christian <[email protected]> Date: Wed Oct 15 13:11:06 2025 +0200 chore(main): release 0.10.3 (#1446) commit dfdbdcf Author: Christian Thiel <[email protected]> Date: Wed Oct 15 09:29:31 2025 +0200 fix(ci): Revert 0.10.3 release commit f5dae12 Author: Christian Thiel <[email protected]> Date: Wed Oct 15 08:57:36 2025 +0200 fix: Release Please CI outputs commit 8722399 Author: Christian <[email protected]> Date: Tue Oct 14 13:32:39 2025 +0200 chore(main): release 0.10.3 (#1427) commit af4a629 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Tue Oct 14 12:08:04 2025 +0200 chore(deps): update all non-major dependencies (#1442) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> commit 556b760 Author: Christian <[email protected]> Date: Mon Oct 13 14:55:58 2025 +0200 fix: Better normalization for ARNs in S3 Profile (#1441) commit be514cf Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Mon Oct 13 13:06:03 2025 +0200 chore(deps): update all non-major dependencies (#1436) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> commit cfd6f56 Author: Paul Roman <[email protected]> Date: Mon Oct 13 07:05:30 2025 -0400 docs: Update developer-guide.md (#1439) commit 2b2f14d Author: Paul Roman <[email protected]> Date: Mon Oct 13 07:04:48 2025 -0400 docs: Add info about installing sqlx to developer-guide.md (#1438) commit 36e1074 Author: Christian Thiel <[email protected]> Date: Fri Oct 10 10:28:50 2025 +0200 chore(ci): Fix release please commit 6e1d3f9 Author: Christian <[email protected]> Date: Thu Oct 9 19:29:51 2025 +0200 feat: Validate Downscoping works on Warehouse creation (#1437)
* feat: Publish images to Dockerhub (lakekeeper#1274) * feat: Update UI to 0.9.0 with multi-project support (lakekeeper#1275) * chore: release 0.9.4 Release-As: 0.9.4 * chore: release main (lakekeeper#1262) * chore(ci): Fix Dockerhub login * chore(docs): Improve developer guide (lakekeeper#1265) * chore(docs): add info regarding `view_version`'s internal representation (lakekeeper#1261) * chore(docs): Architecture clarify Secret Store (lakekeeper#1284) * fix: Update Limes to 0.2.2 - Fixes compilation issue due to breaking `jwks_client_rs` change (lakekeeper#1282) * fix: Update Limes to 0.2.2 * increase min rust version * chore: release 0.9.5 Release-As: 0.9.5 * chore: release main (lakekeeper#1286) * chore: enable changelog sections for release-please (lakekeeper#1264) k * fix(deps): update rust crate rand to v0.9.2 (lakekeeper#1252) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update rust crate async-channel to v2.5.0 (lakekeeper#1225) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency mkdocs-material to v9.6.17 (lakekeeper#1289) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update rust crate anyhow to v1.0.99 (lakekeeper#1290) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore: Remove bitnami images (lakekeeper#1288) * feat!: Move to Lakekeeper IO based on hyperscaler SDKs (lakekeeper#1285) * chore(deps): update rust crate reqwest to v0.12.23 (lakekeeper#1294) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(docs): Improve Cloud storage test docs * fix: accept "disable" as PG sslmode as documented (lakekeeper#1303) * feat: Simplify task interface, re-exports, enable delete-after-commit (lakekeeper#1302) * feat: Introduce `RequestMetadata` for Internal Principals which bypass AuthZ (lakekeeper#1306) * chore(deps): update azure/setup-helm action to v4.3.1 (lakekeeper#1299) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(test): use nextest filterset instead of needs_env_var (lakekeeper#1304) * chore(deps): update rust crate openssl-src to v300.5.2 (lakekeeper#1292) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update rust crate async-compression to v0.4.28 (lakekeeper#1311) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update rust crate thiserror to v2.0.16 (lakekeeper#1296) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat: Provide `ApiContext` to externally registered tasks (lakekeeper#1307) * feat!: Simplify Task interface, extend SpecializedTask interface (lakekeeper#1310) * feat: Improve authorizer `are_allowed_*` batch check signature (lakekeeper#1315) * chore(authz): Enforce use of AuthZ decisions with #[must_use] (lakekeeper#1317) * feat: Task Management APIs (lakekeeper#1316) * chore(deps): update rust crate tracing-subscriber to v0.3.20 [security] (lakekeeper#1318) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat: Add `RunNow` and `RunAt` to Controls for Tasks (lakekeeper#1322) * chore(deps): update rust crate tokio-util to v0.7.16 (lakekeeper#1313) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(docs): Improve Entra ID docs (lakekeeper#1325) * chore(docs): Improve Upgrades & Migration docs (lakekeeper#1326) * feat: Add tasks heartbeat with Catalog state (lakekeeper#1324) * ci: add configuration for CodeRabbit reviews (lakekeeper#1327) * feat: Add optional STS session-tags in S3 STS requests for ABAC authorization (lakekeeper#1230) * feat: Random Server IDs (lakekeeper#1328) * chore(deps): update rust crate percent-encoding to v2.3.2 (lakekeeper#1312) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat(authz): Deprecate Permission Endpoints for Tables without WarehouseIDs (lakekeeper#1334) * fix: Tasks endpoints in router (lakekeeper#1335) * feat(ci): add nextest profile ci_no_secrets for external PRs (lakekeeper#1333) * chore(deps): update rust crate chrono to v0.4.42 (lakekeeper#1331) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore: Pin examples duckdb version to 1.3 (lakekeeper#1343) * feat!: Require warehouse_id when checking permissions on views or tables via ID (lakekeeper#1340) * fix: migrate away from bitnami in unittest.yml (lakekeeper#1344) * chore: Remove coderabitt config * fix(docs): Fix inconsistent URL format in README (lakekeeper#1345) Co-authored-by: Christian <[email protected]> * feat: Remove serde_yaml & serde_yml (lakekeeper#1341) * feat!: add `warehouse_id` to PKs of all `table_*` and `view_*` tables (lakekeeper#1254) * feat: Minor namespace join performance improvements * fix: Warehouse permissions are directly used for task retrieval & control (lakekeeper#1347) * fix: Potential Race Condition when undropping Tabulars (lakekeeper#1342) * fix: table rename authz and error handling (lakekeeper#1346) Co-authored-by: Andre Luis Anastacio <[email protected]> * chore(deps): update rust crate google-cloud-auth to v1.1.2 (lakekeeper#1337) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Christian <[email protected]> * chore(deps): update rust crate time to v0.3.44 (lakekeeper#1349) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency mkdocs-material to v9.6.20 (lakekeeper#1309) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Christian <[email protected]> * feat: Set ServerID during migration (lakekeeper#1348) * chore(deps): Remove utoipa fork (lakekeeper#1352) * chore(deps): update rust crate serde_with to v3.14.1 (lakekeeper#1351) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update rust crate url to v2.5.7 (lakekeeper#1354) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update rust crate async-compression to v0.4.30 (lakekeeper#1323) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Christian <[email protected]> * chore(deps): update rust crate serde_json to v1.0.145 (lakekeeper#1250) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Christian <[email protected]> * chore(deps): update strum monorepo to v0.27.2 (lakekeeper#1251) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Christian <[email protected]> * chore(deps): update serde monorepo to v1.0.226 (lakekeeper#1355) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update rust crate clap to v4.5.48 (lakekeeper#1356) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat: Add Entity Names to Tasks (lakekeeper#1353) * fix: case insensitivity of catalog endpoints (lakekeeper#1338) * fix: Improve delete_warehouse error message for active tasks * chore(deps): update rust crate tempfile to v3.22.0 (lakekeeper#1359) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Christian <[email protected]> * chore(deps): update rust crate axum-prometheus to 0.9.0 (lakekeeper#1358) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix: PgSslMode not supported error string * feat(authz)!: add OpenFGA schema v4 and v3->v4 migration (lakekeeper#1314) Co-authored-by: Christian <[email protected]> Co-authored-by: Christian Thiel <[email protected]> * chore(deps): update rust crate uuid to v1.18.1 (lakekeeper#1362) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update dependency markdown-grid-tables to v0.6.0 (lakekeeper#1357) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update rust crate anyhow to v1.0.100 (lakekeeper#1350) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix: clippy * chore(deps): update rust crate moka to v0.12.11 (lakekeeper#1365) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update rust crate tempfile to v3.23.0 (lakekeeper#1367) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update rust crate async-nats to 0.43.0 (lakekeeper#1366) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update actions/setup-node action to v5 (lakekeeper#1371) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update actions/checkout action to v5 (lakekeeper#1369) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update actions/setup-python action to v6 (lakekeeper#1372) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat: V3 support (lakekeeper#1364) * chore: Set Get Task Permission to "CanGetMetadata" (lakekeeper#1376) * chore(deps): update dependency node to v22 (lakekeeper#1373) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat(authz)!: extend OpenFGA tabular entities with WarehouseId (lakekeeper#1329) --------- Co-authored-by: Christian <[email protected]> Co-authored-by: Christian Thiel <[email protected]> * feat: Add support for tasks affecting views (lakekeeper#1378) * feat(authz): Add specific Task Actions (lakekeeper#1379) * chore(tests): Test with Iceberg 1.9.2 & 1.10.0 (lakekeeper#1267) * feat: Enrich task metadata with concrete tabular type (lakekeeper#1383) * feat: Add loadTable Snapshots filter (lakekeeper#1385) * feat: add endpoint for fuzzy search of tabulars (lakekeeper#1387) * feat: Update UI to 0.10.0 (lakekeeper#1390) * feat(ui): Update UI to 0.10.1 * chore: Use lakekeeper re-exports in bin (lakekeeper#1391) * fix(tabular-search): distance and docs for `searchterm is uuid` (lakekeeper#1393) * chore(examples): Idempotent bucket creation in minimal example (lakekeeper#1386) In the case where you already have a bucket created, like the "examples" bucket, I ran into an issue where the createbuckets service fails, and this prevents lakekeeper from starting back up. This fix adds a simple minio flag to ignore buckets that already exist, making things even more user friendly * feat: Make number of workers spawned for Expiration & Purge configurable (lakekeeper#1395) * chore: release main (lakekeeper#1295) * chore: added gif to readme (lakekeeper#1396) * chore: remove unneded `#[allow(dead_code)]` (lakekeeper#1399) * fix: Use FnOnce for queue & service registration * Revert "fix: Use FnOnce for queue & service registration" This reverts commit 47b03a0. * chore(docs): Add 0.10 docs * perf(db): remove `join namespace` from `active_tabulars` view (lakekeeper#1401) * doc(db): how to connect to db and inspect schema (lakekeeper#1402) * feat: implement `OpenFgaEntity` for `ServerId` (lakekeeper#1394) * impl OpenFgaEntity * Use the implementation * fix: Use FnOnce for queue & service registration (lakekeeper#1404) * chore(deps): update dependency mkdocs-material to v9.6.21 (lakekeeper#1406) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat: Expose client-managed X-Iceberg-Access-Delegation (lakekeeper#1407) * fix: Use higher consistency for some OpenFGA queries (lakekeeper#1408) * feat: Improve Kubernetes Auth docs (lakekeeper#1415) * chore: release 0.10.1 Release-As: 0.10.1 * fix: Endpoint stats for Project Endpoints (lakekeeper#1412) * feat: Add create table guard to cleanup location on Failure (lakekeeper#1418) * chore: Generate ID types with Macro (lakekeeper#1419) * chore: Re-Export Tokio from lakekeeper-io create (lakekeeper#1420) * fix: Add support for `write.metadata.metrics.` Table Properties (lakekeeper#1422) * fix: Update UI to 0.10.2 (lakekeeper#1423) * chore: release main (lakekeeper#1403) * fix: Parse empty ProjectID headers as None (lakekeeper#1424) * chore: release 0.10.2 Release-As: 0.10.2 * chore: release main (lakekeeper#1425) * feat: Add `debug_migrate_before_serve` env var (lakekeeper#1426) * feat: Move OpenFGA Authorizer to separate crate (lakekeeper#1421) * chore(renovate): Group dependencies * chore(renovate): ignore additional deps * chore: Rename src/service -> src/server, trait Catalog -> CatalogStore (lakekeeper#1428) * feat(examples): add k8s iceberg sink connector (avro) (lakekeeper#1336) --------- Co-authored-by: Christian <[email protected]> * chore(ci): Fix release please (lakekeeper#1433) * feat: Expose License Information via API (lakekeeper#1432) * fix(deps): update all non-major dependencies (lakekeeper#1429) * chore(ci): Remove mgmt API version update via release-please * chore: Restructure catalog_store into multiple modules (lakekeeper#1434) * feat: Validate Downscoping works on Warehouse creation (lakekeeper#1437) * chore(ci): Fix release please * docs: Add info about installing sqlx to developer-guide.md (lakekeeper#1438) * docs: Update developer-guide.md (lakekeeper#1439) * chore(deps): update all non-major dependencies (lakekeeper#1436) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix: Better normalization for ARNs in S3 Profile (lakekeeper#1441) * chore(deps): update all non-major dependencies (lakekeeper#1442) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(main): release 0.10.3 (lakekeeper#1427) * fix: Release Please CI outputs * fix(ci): Revert 0.10.3 release * chore(main): release 0.10.3 (lakekeeper#1446) * feat: Introduce CatalogWarehouseOps & CatalogNamespaceOps abstractions (lakekeeper#1440) * feat: Allow x-user-agent header (lakekeeper#1453) * feat: Table & View Ops Abstractions, Improved Error Handling (lakekeeper#1454) * fix: CORS allow access delegation & etag headers (lakekeeper#1455) * fix: Headers should be lowercase (lakekeeper#1457) * chore(tests): Add trino information_schema.tables test (lakekeeper#1456) * chore: Introduce open-api feature to gate utoipa and swagger (lakekeeper#1458) * chore: Release As 0.11 * fix: Debug assertion table identifier mismatch for signer (lakekeeper#1460) * feat: Caching Short-Term-Credentials (STC) (lakekeeper#1459) * feat: Warehouse Cache (lakekeeper#1462) * chore(deps): update actions/setup-node action to v6 (lakekeeper#1443) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * feat: Version based Warehouse Cache (lakekeeper#1465) * feat: AuthZ Server and Project Ops (lakekeeper#1471) * chore(deps): update github artifact actions (lakekeeper#1461) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore: Rename release branch pattern to rel-* * feat: Catalog returns full Namespace Hierarchy for nested Namespaces (lakekeeper#1472) --------- Co-authored-by: Christian <[email protected]> Co-authored-by: Christian Thiel <[email protected]> Co-authored-by: Dao Thanh Tung <[email protected]> Co-authored-by: Moritz Zielke <[email protected]> Co-authored-by: Baptiste Gouhoury <[email protected]> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Dolan Antenucci <[email protected]> Co-authored-by: Anatoly Popov <[email protected]> Co-authored-by: Andre Luis Anastacio <[email protected]> Co-authored-by: Scott Haines <[email protected]> Co-authored-by: Viktor Kessler <[email protected]> Co-authored-by: Yohan Valencia <[email protected]> Co-authored-by: Paul Roman <[email protected]>
BEGIN_COMMIT_OVERRIDE
feat: Introduce CatalogWarehouseOps & CatalogNamespaceOps abstractions
feat: Introduce AuthzWarehouseOps and AuthzNamespaceOps abstractions
feat!: Require warehouse-id in the permissions/check API also for namespace-ids
END_COMMIT_OVERRIDE
Summary by CodeRabbit
New Features
Refactor
Documentation
Chores