Skip to content

feat: Catalog returns full Namespace Hierarchy for nested Namespaces - #1472

Merged
c-thiel merged 1 commit into
mainfrom
ct/namespace-hierarchy
Oct 30, 2025
Merged

c-thiel merged 1 commit into
mainfrom
ct/namespace-hierarchy

Conversation

@c-thiel

@c-thiel c-thiel commented Oct 29, 2025 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Refactor

    • Restructured namespace data model to support hierarchical relationships with parent namespace tracking.
    • Added namespace metadata fields for creation time and version tracking.
    • Updated namespace access patterns throughout the system to use method-based retrieval instead of direct field access.
  • Tests

    • Updated test utilities and data structures to align with the new hierarchical namespace model.

@coderabbitai

coderabbitai Bot commented Oct 29, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

This PR introduces NamespaceHierarchy as a new public type to represent namespaces within their hierarchical context, replacing direct Namespace usage across authorization and catalog layers. Field accesses are systematically converted to accessor methods, and return types are updated throughout to use NamespaceHierarchy instead of Namespace.

Changes

Cohort / File(s) Summary
Namespace hierarchy type definition
crates/lakekeeper/src/service/catalog_store/namespace.rs
Introduces NamespaceVersion newtype, expands Namespace struct with created_at and version fields, removes Arc wrapper from properties. Adds new NamespaceHierarchy struct with namespace: Arc<Namespace> and parents: Vec<Arc<Namespace>>, including accessor methods (parent(), root(), is_root(), depth(), namespace_ident(), namespace_id(), etc.).
Public trait and API signatures
crates/lakekeeper/src/service/catalog_store.rs, crates/lakekeeper/src/service/authz/mod.rs, crates/lakekeeper/src/service/authz/namespace.rs
Updates CatalogStore trait methods to return NamespaceHierarchy instead of Namespace. Changes authorization trait signatures (is_allowed_namespace_action_impl, are_allowed_namespace_actions_impl) to accept NamespaceHierarchy parameters. Adds define_version_newtype macro for version type definitions.
PostgreSQL namespace implementation
crates/lakekeeper/src/implementations/postgres/namespace.rs, crates/lakekeeper/src/implementations/postgres/catalog.rs
Refactors get_namespace* and list_namespaces methods to return NamespaceHierarchy instead of Namespace. Introduces internal NamespaceRow and ListNamespaceRow types with conversion logic to construct hierarchical namespace structures from database rows. Updates method signatures and return types throughout.
Authorization implementation updates
crates/authz-openfga/src/authorizer.rs, crates/authz-openfga/src/check.rs, crates/lakekeeper/src/service/authz/implementations/allow_all.rs
Updates method parameters from &Namespace to &NamespaceHierarchy. Replaces field access (namespace_id, namespace_ident) with method calls (namespace_id(), namespace_ident()). Updates iteration logic in batched checks.
Server endpoint and call site updates
crates/lakekeeper/src/server/namespace.rs, crates/lakekeeper/src/server/tables.rs, crates/lakekeeper/src/server/tables/create_table.rs, crates/lakekeeper/src/server/views/create.rs, crates/lakekeeper/src/server/tabular.rs, crates/lakekeeper/src/server/mod.rs
Replaces direct field accesses (namespace_id, namespace_ident, protected) with method calls (namespace_id(), namespace_ident(), is_protected()). Updates property access from Arc::unwrap_or_clone to direct clone patterns. Adjusts tabular location resolution to use nested namespace.namespace field.
View loading and tabular operations
crates/lakekeeper/src/implementations/postgres/tabular/view/load.rs
Replaces field access with method call for namespace identifier extraction, cloning the result.
Authorization and test utilities
crates/authz-openfga/src/api.rs
Updates random_namespace test helper to return NamespaceHierarchy wrapping Namespace in Arc, adding created_at and version fields. Adjusts imports and test data construction.
Macro and warehouse version refactoring
crates/lakekeeper/src/service/catalog_store/warehouse.rs
Replaces explicit WarehouseVersion struct definition with define_version_newtype!(WarehouseVersion) macro call.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Server
    participant Authz as Authorization<br/>(AuthzNamespaceOps)
    participant Catalog as Catalog Store<br/>(CatalogNamespaceOps)
    participant DB as PostgreSQL<br/>Namespace Impl

    Client->>Server: Request (get namespace, list namespaces, etc.)
    Server->>Authz: Check namespace action
    Authz->>Catalog: get_namespace(id/name)
    Catalog->>DB: Query namespace + parents
    DB-->>Catalog: NamespaceRow(s)
    Catalog->>Catalog: Convert rows to NamespaceHierarchy<br/>(build hierarchy with parents)
    Catalog-->>Authz: Option<NamespaceHierarchy>
    Note over Authz: Access via methods:<br/>namespace_id(), namespace_ident(),<br/>is_protected(), etc.
    Authz-->>Server: Authorization result
    Server-->>Client: Response (includes NamespaceHierarchy data)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Areas requiring extra attention:

  • Authorization trait changes (crates/lakekeeper/src/service/authz/mod.rs, crates/lakekeeper/src/service/authz/namespace.rs): Multiple public API signature changes affecting batched operations and namespace action checks; verify all call sites use correct accessor methods.
  • PostgreSQL namespace hierarchy construction (crates/lakekeeper/src/implementations/postgres/namespace.rs): Complex logic converting database rows to hierarchical structures; validate parent/root/depth calculations and pagination semantics.
  • Call site migration completeness (crates/lakekeeper/src/server/*): Widespread field-to-method access conversions across multiple server modules; confirm all accesses are properly updated to use accessor methods.
  • Backward compatibility and test coverage: Verify test scenarios cover root/child/grandchild relationships, pagination with hierarchies, and hierarchical accessor correctness.

Possibly related PRs

Suggested reviewers

  • mooori

🐰 A hierarchy blooms where flatness dwelt before,
Each namespace now knows its kin and more—
Accessors dance where fields once stood alone,
The namespace tree grows roots we've never known! 🌳✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 72.31% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The pull request title "feat: Catalog returns full Namespace Hierarchy for nested Namespaces" directly and accurately describes the primary change in the changeset. The modifications introduce a new NamespaceHierarchy type that wraps a Namespace with parent namespace references, and update the catalog's core methods (get_namespace, list_namespaces) to return this hierarchical structure instead of flat Namespace objects. The title clearly conveys this is about returning hierarchical information for nested namespaces, and the subsequent changes throughout the codebase (authorization, API handlers, database implementations) all stem from and support this central change.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ct/namespace-hierarchy

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7363410 and 50377d8.

⛔ Files ignored due to path filters (11)
  • .sqlx/query-3f643ff9780aa015a3af64573c1aecbaedd79cd699e1a47b11cf73b5d850c3f4.json is excluded by !.sqlx/**
  • .sqlx/query-7422f356b888c1c6a99ebc842c4b0312fb46ceb11b4ddc1304ed52c8d1f83493.json is excluded by !.sqlx/**
  • .sqlx/query-82f85183199b729e53a58c95d59ff69a14eb0d550725d74818d367c64c0f604c.json is excluded by !.sqlx/**
  • .sqlx/query-84691d8a93f1cb05683c022a8f99e34e69a90fa78d7e56fd91d89313fb8de363.json is excluded by !.sqlx/**
  • .sqlx/query-9273e2f8dcbe95cea43881df45f01b8978b790599b3305ab23962b4da98d0e83.json is excluded by !.sqlx/**
  • .sqlx/query-b112ca3312e5cc2afd8f88a711167812adb9864e1dfeec54eee7a1ef3f911840.json is excluded by !.sqlx/**
  • .sqlx/query-b66d81a80cd1cad8eee213f207d9f6cc06bfb9f05afe692467f9bc2fdeeebf2f.json is excluded by !.sqlx/**
  • .sqlx/query-c4cf266a651d75b87cfe60d918feb743a8497e8fbfb91d229f5b5ca6892ae7bc.json is excluded by !.sqlx/**
  • .sqlx/query-df8f3a61ce9d07c3bb1805b6a322f29e25cee0e18762d3329a941f1f1b33a9ad.json is excluded by !.sqlx/**
  • .sqlx/query-e22ac1524b88fcc70f0b00d267d5a91ce843508621b3f32b2465aaa2b1b260cc.json is excluded by !.sqlx/**
  • .sqlx/query-f4d4ce83f8353ff1f619b61078bddbfbc7a918c2ea85eda9df9d8921177afbe5.json is excluded by !.sqlx/**
📒 Files selected for processing (19)
  • crates/authz-openfga/src/api.rs (2 hunks)
  • crates/authz-openfga/src/authorizer.rs (3 hunks)
  • crates/authz-openfga/src/check.rs (1 hunks)
  • crates/lakekeeper/src/api/management/v1/namespace.rs (1 hunks)
  • crates/lakekeeper/src/implementations/postgres/catalog.rs (3 hunks)
  • crates/lakekeeper/src/implementations/postgres/namespace.rs (26 hunks)
  • crates/lakekeeper/src/implementations/postgres/tabular/view/load.rs (1 hunks)
  • crates/lakekeeper/src/server/mod.rs (2 hunks)
  • crates/lakekeeper/src/server/namespace.rs (9 hunks)
  • crates/lakekeeper/src/server/tables.rs (1 hunks)
  • crates/lakekeeper/src/server/tables/create_table.rs (3 hunks)
  • crates/lakekeeper/src/server/tabular.rs (2 hunks)
  • crates/lakekeeper/src/server/views/create.rs (3 hunks)
  • crates/lakekeeper/src/service/authz/implementations/allow_all.rs (2 hunks)
  • crates/lakekeeper/src/service/authz/mod.rs (7 hunks)
  • crates/lakekeeper/src/service/authz/namespace.rs (7 hunks)
  • crates/lakekeeper/src/service/catalog_store.rs (3 hunks)
  • crates/lakekeeper/src/service/catalog_store/namespace.rs (2 hunks)
  • crates/lakekeeper/src/service/catalog_store/warehouse.rs (2 hunks)
👮 Files not reviewed due to content moderation or server errors (5)
  • crates/lakekeeper/src/service/catalog_store/warehouse.rs
  • crates/lakekeeper/src/server/tables.rs
  • crates/lakekeeper/src/service/authz/implementations/allow_all.rs
  • crates/lakekeeper/src/service/catalog_store.rs
  • crates/authz-openfga/src/authorizer.rs
🧰 Additional context used
🧠 Learnings (11)
📓 Common learnings
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1444
File: crates/lakekeeper/src/service/catalog_store.rs:196-201
Timestamp: 2025-10-14T10:12:32.991Z
Learning: In the lakekeeper codebase, `GetNamespaceResponse` is the API response type used for REST API contracts and must be maintained. The internal catalog operations use a separate `Namespace` type. These are distinct types serving different purposes—one for external API contracts, the other for internal catalog store operations.
📚 Learning: 2025-09-08T09:10:07.658Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1328
File: crates/lakekeeper/src/service/authz/implementations/openfga/mod.rs:103-112
Timestamp: 2025-09-08T09:10:07.658Z
Learning: The OpenFGAAuthorizer constructor in crates/lakekeeper/src/service/authz/implementations/openfga/mod.rs should maintain backward compatibility during the transition away from nil UUIDs. Hard assertions that would panic on nil UUID input should be avoided to prevent breaking existing deployments.

Applied to files:

  • crates/lakekeeper/src/server/mod.rs
  • crates/lakekeeper/src/service/authz/implementations/allow_all.rs
  • crates/authz-openfga/src/check.rs
  • crates/lakekeeper/src/server/tabular.rs
  • crates/authz-openfga/src/authorizer.rs
  • crates/lakekeeper/src/server/tables.rs
  • crates/lakekeeper/src/service/authz/namespace.rs
  • crates/authz-openfga/src/api.rs
  • crates/lakekeeper/src/service/catalog_store/warehouse.rs
  • crates/lakekeeper/src/server/namespace.rs
  • crates/lakekeeper/src/service/authz/mod.rs
📚 Learning: 2025-10-14T10:12:32.991Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1444
File: crates/lakekeeper/src/service/catalog_store.rs:196-201
Timestamp: 2025-10-14T10:12:32.991Z
Learning: In the lakekeeper codebase, `GetNamespaceResponse` is the API response type used for REST API contracts and must be maintained. The internal catalog operations use a separate `Namespace` type. These are distinct types serving different purposes—one for external API contracts, the other for internal catalog store operations.

Applied to files:

  • crates/lakekeeper/src/service/catalog_store.rs
  • crates/lakekeeper/src/api/management/v1/namespace.rs
  • crates/lakekeeper/src/service/authz/namespace.rs
  • crates/lakekeeper/src/server/namespace.rs
  • crates/lakekeeper/src/implementations/postgres/namespace.rs
  • crates/lakekeeper/src/service/catalog_store/namespace.rs
  • crates/lakekeeper/src/implementations/postgres/catalog.rs
📚 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/authz-openfga/src/check.rs
  • crates/lakekeeper/src/server/tabular.rs
  • crates/lakekeeper/src/server/tables.rs
  • crates/lakekeeper/src/server/tables/create_table.rs
  • crates/lakekeeper/src/server/views/create.rs
  • crates/lakekeeper/src/server/namespace.rs
  • crates/lakekeeper/src/implementations/postgres/namespace.rs
  • crates/lakekeeper/src/implementations/postgres/tabular/view/load.rs
📚 Learning: 2025-09-21T09:54:54.868Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1348
File: .sqlx/query-1c1a32de33e3f54464a1107f7d4d4b8cbd99dd69aae1c740561c3cbbea2eaa19.json:9-10
Timestamp: 2025-09-21T09:54:54.868Z
Learning: In the lakekeeper codebase, ServerId newtype uses manual conversion between uuid::Uuid and ServerId at query call sites rather than sqlx transparent annotations like #[sqlx(transparent)]. The manual conversion approach is the preferred pattern in this codebase.

Applied to files:

  • crates/lakekeeper/src/server/tabular.rs
  • crates/lakekeeper/src/server/tables.rs
  • crates/authz-openfga/src/api.rs
  • crates/lakekeeper/src/server/namespace.rs
📚 Learning: 2025-09-05T08:33:41.777Z
Learnt from: mooori
PR: lakekeeper/lakekeeper#1254
File: .sqlx/query-929ebebbe40a3208fd249ca77b6875165f0b7b88e5ce60c37c3eca0331469302.json:0-0
Timestamp: 2025-09-05T08:33:41.777Z
Learning: Namespace IDs in the lakekeeper system are globally unique across all warehouses and cannot be reused. Therefore, joins on namespace_id alone do not risk cross-warehouse data leakage.

Applied to files:

  • crates/lakekeeper/src/server/tabular.rs
  • crates/lakekeeper/src/implementations/postgres/namespace.rs
📚 Learning: 2025-08-26T12:59:36.239Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1307
File: Cargo.toml:94-94
Timestamp: 2025-08-26T12:59:36.239Z
Learning: The derive_more::Debug derive macro is used in crates/lakekeeper/src/serve.rs on line 92 in the syntax `#[derive(derive_more::Debug, typed_builder::TypedBuilder)]` on the ServeConfiguration struct. When searching for derive_more::Debug usage, need to use broader patterns that catch multi-trait derive macros, not just exact module path matches.

Applied to files:

  • crates/authz-openfga/src/api.rs
📚 Learning: 2025-09-18T20:08:00.663Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1254
File: .sqlx/query-552ddb89100de8fb3c374e95c885dfd2da32c9d51d30acf2d60811edbd545dbc.json:3-3
Timestamp: 2025-09-18T20:08:00.663Z
Learning: In the lakekeeper codebase, table_id and view_id are scoped by warehouse_id through composite primary keys (warehouse_id, table_id) and (warehouse_id, view_id). This design allows ID reuse across warehouses while preventing cross-warehouse joins through proper foreign key constraints. When reviewing SQL queries, JOIN conditions like `t.warehouse_id = $1 AND t.table_id = ti.tabular_id` are correct because they ensure warehouse scoping without needing additional `ti.warehouse_id = $1` constraints.

Applied to files:

  • crates/lakekeeper/src/server/views/create.rs
📚 Learning: 2025-09-18T16:16:50.743Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1254
File: .sqlx/query-cc971caec9f8981502e9ea21682482378d65cee50c8017bf251256fa7085053a.json:3-3
Timestamp: 2025-09-18T16:16:50.743Z
Learning: In the lakekeeper database schema, the namespace.namespace_name column is defined as `Text [] collate "case_insensitive"` (a PostgreSQL text array) that stores namespace name segments. Queries comparing `n.namespace_name = $1` where $1 is TextArray are valid array-to-array equality checks, not type mismatches.

Applied to files:

  • crates/lakekeeper/src/implementations/postgres/namespace.rs
📚 Learning: 2025-09-18T16:16:50.743Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1254
File: .sqlx/query-cc971caec9f8981502e9ea21682482378d65cee50c8017bf251256fa7085053a.json:3-3
Timestamp: 2025-09-18T16:16:50.743Z
Learning: In the lakekeeper database schema, the namespace.namespace_name column is an array type (text[]) that stores namespace name segments, not a single text value. This means comparisons like `n.namespace_name = $1` where $1 is TextArray are valid array-to-array equality checks in PostgreSQL.

Applied to files:

  • crates/lakekeeper/src/implementations/postgres/namespace.rs
📚 Learning: 2025-08-27T11:12:53.020Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1310
File: crates/lakekeeper/src/service/task_queue/mod.rs:512-559
Timestamp: 2025-08-27T11:12:53.020Z
Learning: In the Lakekeeper codebase, `&mut trx.transaction()` in the context of `report_deserialization_failure` method does not create a borrowing issue across `.await` - the code compiles successfully despite initially appearing to borrow a temporary across an async boundary.

Applied to files:

  • crates/lakekeeper/src/implementations/postgres/namespace.rs
🧬 Code graph analysis (9)
crates/lakekeeper/src/server/tabular.rs (4)
crates/lakekeeper/src/server/tables/create_table.rs (1)
  • warehouse_id (69-71)
crates/lakekeeper/src/service/catalog_store/namespace.rs (2)
  • warehouse_id (85-87)
  • namespace_id (80-82)
crates/lakekeeper/src/api/management/v1/warehouse/mod.rs (1)
  • warehouse_id (154-156)
crates/lakekeeper/src/service/catalog_store/tasks.rs (1)
  • warehouse_id (49-51)
crates/authz-openfga/src/authorizer.rs (1)
crates/lakekeeper/src/service/authz/namespace.rs (2)
  • actions (258-261)
  • actions (283-286)
crates/lakekeeper/src/server/tables.rs (1)
crates/lakekeeper/src/service/catalog_store/namespace.rs (1)
  • namespace_id (80-82)
crates/lakekeeper/src/service/authz/namespace.rs (1)
crates/lakekeeper/src/service/catalog_store/namespace.rs (2)
  • namespace_id (80-82)
  • namespace_ident (75-77)
crates/authz-openfga/src/api.rs (1)
crates/lakekeeper/src/service/catalog_store/namespace.rs (1)
  • namespace_id (80-82)
crates/lakekeeper/src/server/namespace.rs (2)
crates/lakekeeper/src/service/catalog_store/namespace.rs (3)
  • namespace_id (80-82)
  • properties (95-97)
  • update_namespace_properties (501-509)
crates/lakekeeper/src/implementations/postgres/namespace.rs (1)
  • update_namespace_properties (760-804)
crates/lakekeeper/src/implementations/postgres/namespace.rs (3)
crates/lakekeeper/src/service/catalog_store/namespace.rs (14)
  • warehouse_id (85-87)
  • new (163-174)
  • new (202-209)
  • new (311-317)
  • namespace_id (80-82)
  • parent (47-49)
  • properties (95-97)
  • get_namespace (464-470)
  • root (55-57)
  • depth (70-72)
  • namespace_ident (75-77)
  • is_protected (90-92)
  • is_root (61-63)
  • list_namespaces (472-481)
crates/lakekeeper/src/api/iceberg/mod.rs (4)
  • namespace (59-59)
  • with_capacity (112-118)
  • len (137-139)
  • next_token (180-182)
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/namespace.rs (4)
crates/lakekeeper/src/implementations/postgres/catalog.rs (1)
  • get_namespace_impl (136-142)
crates/lakekeeper/src/service/catalog_store.rs (2)
  • get_namespace_impl (266-270)
  • transaction (105-105)
crates/lakekeeper/src/implementations/postgres/namespace.rs (1)
  • list_namespaces (286-429)
crates/lakekeeper/src/server/namespace.rs (1)
  • list_namespaces (52-201)
crates/lakekeeper/src/service/authz/mod.rs (2)
crates/lakekeeper/src/service/authz/namespace.rs (2)
  • new (33-38)
  • new (76-88)
crates/lakekeeper/src/service/catalog_store/namespace.rs (6)
  • namespace_id (80-82)
  • new (163-174)
  • new (202-209)
  • new (311-317)
  • namespace_ident (75-77)
  • warehouse_id (85-87)
⏰ 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). (8)
  • GitHub Check: docker / docker
  • GitHub Check: docker / docker
  • GitHub Check: docker / docker
  • GitHub Check: docker / docker
  • GitHub Check: check-generated-openapi-matches
  • GitHub Check: clippy
  • GitHub Check: sqlx-check
  • GitHub Check: test
🔇 Additional comments (9)
crates/lakekeeper/src/api/management/v1/namespace.rs (1)

82-85: LGTM! Clean conversion to accessor methods.

The refactoring from direct field access to accessor methods (is_protected() and updated_at()) is consistent with the PR's objective of introducing NamespaceHierarchy with proper encapsulation. The logic remains unchanged and the accessor pattern is idiomatic Rust.

crates/lakekeeper/src/implementations/postgres/tabular/view/load.rs (1)

379-379: LGTM! Accessor method usage is consistent with the NamespaceHierarchy refactor.

The change from direct field access to namespace_ident() method call aligns with the broader pattern throughout this PR.

crates/authz-openfga/src/check.rs (1)

230-230: LGTM! Method-based ID access is correct.

The change from namespace.namespace_id to namespace.namespace_id() is consistent with the NamespaceHierarchy refactor across the codebase.

crates/lakekeeper/src/implementations/postgres/catalog.rs (1)

77-80: LGTM! Return type updates align with NamespaceHierarchy introduction.

The public API augmentation to return NamespaceHierarchy instead of Namespace in list_namespaces_impl and get_namespace_impl is consistent with the PR's goal to represent namespaces within their hierarchical context. Based on learnings, this affects internal catalog store operations while maintaining the separate GetNamespaceResponse type for REST API contracts.

Also applies to: 120-123, 140-140

crates/lakekeeper/src/server/views/create.rs (1)

85-86: LGTM! Namespace handling is correct.

The changes properly handle the NamespaceHierarchy structure:

  • Line 85: Passes the inner namespace.namespace field to determine_tabular_location, which expects a raw Namespace
  • Lines 126, 176: Consistently use namespace_id() accessor method

All changes align with the hierarchical namespace refactor.

Also applies to: 126-126, 176-176

crates/lakekeeper/src/server/mod.rs (1)

281-281: LGTM! Test setup correctly handles NamespaceHierarchy.

The test scaffolding updates properly work with the new Arc-wrapped namespace structure:

  • Line 450: Uses namespace_ident() accessor method consistently
  • Line 452: Appropriately unwraps the Arc-wrapped inner Namespace from the hierarchy

Also applies to: 450-452

crates/lakekeeper/src/server/tabular.rs (1)

24-24: LGTM! Property and ID access patterns are correct.

  • Line 24: Direct namespace.properties access is appropriate here since the parameter is the inner Namespace type
  • Lines 56-57: Correct use of warehouse_id() and namespace_id() accessor methods on the NamespaceHierarchy

The distinction between accessing the inner Namespace directly and accessing NamespaceHierarchy via methods is properly maintained.

Also applies to: 56-57

crates/lakekeeper/src/server/tables/create_table.rs (1)

178-178: LGTM! Namespace handling follows the correct pattern.

The changes mirror those in views/create.rs:

  • Line 178: Passes the inner namespace.namespace to determine_tabular_location (expects raw Namespace)
  • Lines 207, 282: Uses namespace_id() accessor method consistently

All changes properly handle the NamespaceHierarchy structure.

Also applies to: 207-207, 282-282

crates/authz-openfga/src/api.rs (1)

1673-1702: LGTM! Test helper properly constructs NamespaceHierarchy.

The random_namespace helper function is correctly updated to:

  • Return NamespaceHierarchy instead of Namespace
  • Wrap the inner Namespace in an Arc
  • Initialize all required fields including created_at, version, and empty parents vector

This aligns with the production usage of NamespaceHierarchy across the codebase.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown
Contributor

✅ PR Title Formatted Correctly

The title of this PR match the correct format. Thank you!

@c-thiel
c-thiel merged commit 2fe38bf into main Oct 30, 2025
@c-thiel
c-thiel deleted the ct/namespace-hierarchy branch October 30, 2025 07:06
mrjoe7 added a commit to mrjoe7/lakekeeper that referenced this pull request Oct 30, 2025
* 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]>
@coderabbitai coderabbitai Bot mentioned this pull request Nov 3, 2025
@c-thiel c-thiel added this to the Release 0.11.0 milestone Nov 4, 2025
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.

1 participant