Skip to content

feat: Random Server IDs - #1328

Merged
c-thiel merged 5 commits into
mainfrom
ct/feat-remove-server-id
Sep 10, 2025
Merged

c-thiel merged 5 commits into
mainfrom
ct/feat-remove-server-id

Conversation

@c-thiel

@c-thiel c-thiel commented Sep 7, 2025 •

Copy link
Copy Markdown
Member

Closes #1300

Summary by CodeRabbit

  • New Features
    • Server ID is now per-instance (generated/stable on first startup) and threaded into authorization; OpenFGA and built-in authorizers use this per-instance server scope.
    • ServerInfo exposes open_for_bootstrap and returns server_id only when bootstrapped; stronger bootstrap validation and clearer concurrency/mismatch errors.
  • Documentation
    • Concepts and OpenAPI updated: server-id is optional/nullable and docs describe automatic server ID generation and re-bootstrap flag.

@coderabbitai

coderabbitai Bot commented Sep 7, 2025 •

Copy link
Copy Markdown
Contributor

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Introduces a per-instance server_id generated or derived at startup and threaded through Catalog.bootstrap, Authorizer (AllowAll/OpenFGA), and startup wiring. ServerInfo gains open_for_bootstrap and helper methods. SQL bootstrap update is constrained by server_id. Config.server_id removed; OpenAPI/docs updated to reflect optional server_id. Tests adjusted for new constructors.

Changes

Cohort / File(s) Summary
Bootstrap API & Catalog
crates/lakekeeper/src/service/catalog.rs, crates/lakekeeper/src/api/management/v1/bootstrap.rs, crates/lakekeeper/src/implementations/postgres/catalog.rs, crates/lakekeeper/src/implementations/postgres/bootstrap.rs, .sqlx/query-65ea0d....json
Adds server_id plumbing and generation/determination; Catalog::bootstrap now accepts server_id; ServerInfo::Bootstrapped gains open_for_bootstrap; SQL INSERT/ON CONFLICT DO UPDATE constrained to matching server_id.
Serve wiring (binary & service)
crates/lakekeeper-bin/src/serve.rs, crates/lakekeeper/src/serve.rs, crates/lakekeeper/src/service/mod.rs
Startup now determines server_id from Catalog and passes it to get_default_authorizer_from_config(server_id); State exposes server_id(). Serve flow uses server_id for bootstrap/validation and logging.
Authz trait & default authorizer wiring
crates/lakekeeper/src/service/authz/mod.rs, crates/lakekeeper/src/service/authz/implementations/mod.rs
Authorizer trait adds server_id(); get_default_authorizer_from_config(server_id) signature updated; default authorizer factories now accept server_id.
AllowAll authorizer & tests
crates/lakekeeper/src/service/authz/implementations/allow_all.rs, various test files under crates/lakekeeper/src/*
AllowAllAuthorizer becomes a struct containing server_id; server_id() implemented; many tests updated to construct AllowAllAuthorizer via Default or pass server_id.
OpenFGA authorizer (per-instance server)
crates/lakekeeper/src/service/authz/implementations/openfga/mod.rs, .../client.rs, .../api.rs, .../check.rs, .../health.rs, .../migration.rs
Removes global OPENFGA_SERVER; OpenFGAAuthorizer gains server_id and per-instance server string; constructors accept server_id; all OpenFGA calls use per-instance server context; tests updated.
Config & docs
crates/lakekeeper/src/config.rs, docs/docs/api/management-open-api.yaml, docs/docs/concepts.md
Removes DynAppConfig.server_id; OpenAPI ServerInfo.server-id made optional/nullable and removed from required; documentation updated to state server_id is generated on first startup and stored.
Test scaffolding updates
crates/lakekeeper/src/catalog/*, crates/lakekeeper/src/implementations/postgres/*, crates/lakekeeper/src/service/task_queue/*, crates/lakekeeper/src/tests/*
Tests adjusted to new authorizer constructors: many places use AllowAllAuthorizer::default() or pass explicit server_id; no behavioral test logic changes beyond construction.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant SVC as Service Startup
  participant Cat as Catalog
  participant AuthZ as Authorizer Factory
  participant AZ as Authorizer
  participant State as State

  SVC->>Cat: get_server_info()
  Cat-->>SVC: ServerInfo (maybe bootstrapped)
  SVC->>Cat: determine_server_id(state)
  Cat-->>SVC: server_id (existing or new)
  SVC->>AuthZ: get_default_authorizer_from_config(server_id)
  AuthZ-->>SVC: Authorizer instance (AZ)
  SVC->>State: build with AZ + Catalog
  State-->>SVC: ready
Loading
sequenceDiagram
  autonumber
  participant API as Bootstrap API
  participant Cat as Catalog
  participant DB as Postgres

  API->>Cat: bootstrap(accept_terms, server_id, tx)
  Cat->>DB: INSERT ... ON CONFLICT(server_id)\nDO UPDATE SET terms_accepted=$2, open_for_bootstrap=false\nWHERE server.open_for_bootstrap = true AND server.server_id = $1
  DB-->>Cat: Result (inserted/updated/no-op)
  Cat-->>API: Ok(bool)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Assessment against linked issues

Objective (issue) Addressed Explanation
Generate random server IDs on startup and avoid nil UUID fallback (#1300) ✅
Thread server_id through authorizer/catalog/bootstrap so authorizers are per-instance (#1300) ✅
Remove reliance on CONFIG.server_id and store/generate server_id in DB (#1300) ✅

Out-of-scope changes

No out-of-scope functional code changes detected relative to the objectives in the linked issue; edits are focused on server_id plumbing, authorizer constructors, catalog bootstrap, SQL behavior, tests, and docs.

Possibly related PRs

Poem

I hopped and found a UUID bright,
Planted it in the catalog’s night.
No more one-global carrot to share,
Each burrow now knows which ID’s there.
OpenFGA sings per-server tunes—hooray! 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ct/feat-remove-server-id

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.

@c-thiel
c-thiel requested a review from Copilot September 7, 2025 15:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements random server ID generation for Lakekeeper, replacing the previous static server ID configuration approach. The server ID is now randomly generated on first startup and stored in the database.

  • Removes the static server ID configuration from environment variables
  • Implements dynamic server ID generation using UUID v7 on catalog bootstrap
  • Updates all authorizer implementations to receive and store the server ID

Reviewed Changes

Copilot reviewed 31 out of 32 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
docs/docs/concepts.md Updates documentation to describe new random server ID behavior
docs/docs/api/management-open-api.yaml Makes server-id field nullable in API response
crates/lakekeeper/src/config.rs Removes server_id field from configuration
crates/lakekeeper/src/service/catalog.rs Adds server ID determination logic and bootstrap parameter
crates/lakekeeper/src/service/authz/mod.rs Adds server_id method to Authorizer trait
crates/lakekeeper/src/service/authz/implementations/allow_all.rs Updates AllowAllAuthorizer to store server ID
crates/lakekeeper/src/service/authz/implementations/openfga/*.rs Updates OpenFGA authorizer to use instance-based server ID
Multiple test files Updates test instantiation to use default() for AllowAllAuthorizer
Files not reviewed (1)
  • .sqlx/query-65ea0db4aef662e0423eb85da840d20f62bf6b468a8c30de14bf980257d07b9f.json: Language not supported

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
crates/lakekeeper/src/service/authz/implementations/openfga/migration.rs (1)

47-51: Bug: configured model_version is ignored in get_active_auth_model_id

You compute model_version but still pass *ACTIVE_MODEL_VERSION to the manager. This breaks the override path.

-    manager
-        .get_authorization_model_id(*ACTIVE_MODEL_VERSION)
+    manager
+        .get_authorization_model_id(model_version)
         .await
🧹 Nitpick comments (26)
docs/docs/concepts.md (1)

40-40: Server ID text LGTM; add a short note on clustering and restore.

Consider one sentence clarifying that all pods sharing the same DB backend share the same server ID and that DB restores/migrations preserve it.

crates/lakekeeper/src/service/catalog.rs (3)

222-225: Adding open_for_bootstrap to the Bootstrapped variant may break exhaustive matches.

Because ServerInfo is public, downstream pattern matches on Bootstrapped { .. } can break when fields change.

Options:

  • Mark the enum #[non_exhaustive] to future-proof.
  • Or provide constructor/accessors only and discourage direct matching in external crates.

306-316: determine_server_id: verify ErrorModel → anyhow conversion and race behavior.

  • Using ? on Self::get_server_info(...)->Result<ServerInfo, ErrorModel> requires ErrorModel to convert into anyhow::Error. If not guaranteed, wrap with map_err(|e| anyhow::anyhow!(e)) or Context.
  • Concurrency-wise, two instances may both see NotBootstrapped and generate different v7 IDs; relying on bootstrap(server_id) idempotency/compare-and-set is fine—just confirm impls enforce it.

If needed, be explicit:

-        let server_info = Self::get_server_info(state.clone()).await?;
+        let server_info = Self::get_server_info(state.clone())
+            .await
+            .map_err(|e| anyhow::anyhow!(e))?;

323-331: bootstrap signature update looks good; fix the stale doc.

The comment still refers to CONFIG.server_id; it should reference the server_id parameter.

-    /// Use this hook to store the current `CONFIG.server_id`.
+    /// Use this hook to persist the provided `server_id`.
+    /// Must be idempotent and only set during initial bootstrap.

Confirm all Catalog impls (e.g., Postgres) and call sites pass the same server_id that was determined for this process.

crates/lakekeeper/src/tests/drop_recursive.rs (1)

603-603: Avoid Uuid::nil() for server_id in tests

AllowAllAuthorizer::default() yields a nil UUID; prefer an explicit/random server_id to better reflect per-instance behavior and avoid accidental cross-test coupling.

-        AllowAllAuthorizer::default(),
+        AllowAllAuthorizer { server_id: uuid::Uuid::now_v7() },
crates/lakekeeper/src/tests/drop_warehouse.rs (1)

29-31: Use a non-nil server_id for test authorizer

Default derives a nil UUID. Generate a random server_id to mirror production semantics.

-    let authorizer = AllowAllAuthorizer::default();
+    let authorizer = AllowAllAuthorizer { server_id: uuid::Uuid::now_v7() };
crates/lakekeeper/src/service/authz/implementations/openfga/check.rs (1)

186-198: Micro: avoid duplicate openfga_server() allocations

Cache once to avoid repeated String creation.

 async fn check_server(
@@
 ) -> Result<(String, String)> {
     if for_principal.is_some() {
-        authorizer
+        let server = authorizer.openfga_server();
+        authorizer
             .require_action(
                 metadata,
                 AllServerAction::CanReadAssignments,
-                &authorizer.openfga_server(),
+                &server,
             )
             .await?;
     } else {
         authorizer.check_actor(metadata.actor()).await?;
     }
-    Ok((action.to_openfga().to_string(), authorizer.openfga_server()))
+    Ok((action.to_openfga().to_string(), authorizer.openfga_server()))
 }
crates/lakekeeper/src/implementations/postgres/tasks.rs (1)

990-994: Prefer explicit/random server_id over Default in tests

Ensure tests don’t rely on a nil UUID.

-            AllowAllAuthorizer::default(),
+            AllowAllAuthorizer { server_id: uuid::Uuid::now_v7() },

Also applies to: 1005-1010

crates/lakekeeper/src/service/authz/implementations/allow_all.rs (1)

21-24: Default should generate a random server_id

Deriving Default yields Uuid::nil(). For per-instance IDs, implement Default manually to return a random v7.

-#[derive(Clone, Debug, Default)]
+#[derive(Clone, Debug)]
 pub struct AllowAllAuthorizer {
     pub server_id: uuid::Uuid,
 }
+
+impl Default for AllowAllAuthorizer {
+    fn default() -> Self {
+        Self { server_id: uuid::Uuid::now_v7() }
+    }
+}

Also applies to: 42-44

crates/lakekeeper/src/service/authz/mod.rs (1)

199-201: Clarify stability of server_id in docs

Small doc nudge: emphasize stability across process lifetime.

-    /// The server ID that was passed to the authorizer during initialization.
+    /// The server ID that was passed to the authorizer during initialization.
+    /// Must remain stable for the lifetime of the running process (typically generated at startup).
     fn server_id(&self) -> uuid::Uuid;
crates/lakekeeper-bin/src/serve.rs (1)

24-25: Threading server_id into authz is right; add error context and prefer UFCS + clearer name.

  • Add anyhow::Context so failures are self-explanatory.
  • Prefer UFCS to make it explicit this is a Catalog default method.
  • Rename sid → server_id for readability.
+use anyhow::Context;
@@
-    let sid = PostgresCatalog::determine_server_id(catalog.clone()).await?;
-    let authorizer = get_default_authorizer_from_config(sid).await?;
+    let server_id = <PostgresCatalog as Catalog>::determine_server_id(catalog.clone())
+        .await
+        .context("Failed to determine server_id")?;
+    let authorizer = get_default_authorizer_from_config(server_id).await?;
crates/lakekeeper/src/serve.rs (2)

501-507: Bootstrap warnings look good; make logs more actionable.

Include a concrete hint to resolve and structured fields for easier filtering.

-            if *open_for_bootstrap {
-                tracing::warn!("The catalog is bootstrapped but still open for bootstrap. Please bootstrap the catalog again to set a new administrator and close the bootstrap.");
-            }
+            if *open_for_bootstrap {
+                tracing::warn!(
+                    open_for_bootstrap = true,
+                    "The catalog is bootstrapped but still open for bootstrap. Re-run the bootstrap to set a new administrator and close the window (management v1 bootstrap endpoint)."
+                );
+            }
@@
-            if *terms_accepted {
-                tracing::info!("The catalog is bootstrapped. Server ID: {server_id}");
+            if *terms_accepted {
+                tracing::info!(%server_id, "The catalog is bootstrapped.");
                 Ok(())
             } else {
                 Err(anyhow!(
                     "The terms of service have not been accepted on bootstrap."
                 ))
             }

Also applies to: 508-511


154-156: Docstring is outdated; remove server ID mismatch error bullet.

Validation against CONFIG.server_id was removed; keep docs accurate.

 /// # Errors
 /// - If the service cannot bind to the specified address.
-/// - If the server is bootstrapped but the server ID does not match the configuration.
 /// - If the terms of service have not been accepted during bootstrap.
crates/lakekeeper/src/service/authz/implementations/openfga/migration.rs (1)

81-82: Nit: log message grammar

“explicitly is configured” → “is explicitly configured”.

-        tracing::info!("Skipping OpenFGA Migration because a model version is explicitly is configured. Version: {configured_model}");
+        tracing::info!("Skipping OpenFGA Migration because a model version is explicitly configured. Version: {configured_model}");
crates/lakekeeper/src/service/authz/implementations/openfga/api.rs (3)

368-373: Use per-authorizer server object instead of constant

Good swap to authorizer.openfga_server() and passing as_str().

Consider using a consistent style across the file: either always as_str() or always &string.


1691-1717: Tests: OPENFGA_SERVER replaced with authorizer.openfga_server()

The test changes correctly derive the server object from the authorizer and pass it to helpers. Style nit: unify as_str() vs &openfga_server for readability.

Example:

- let relations: Vec<ServerAssignment> = get_relations(authorizer.clone(), None, openfga_server.as_str()).await?;
+ let relations: Vec<ServerAssignment> = get_relations(authorizer.clone(), None, &openfga_server).await?;
# or adopt as_str() consistently everywhere

Also applies to: 1835-1857, 1866-1894, 1904-1950, 1965-1992


1-1: Optional: avoid per-request allocation for server object

openfga_server() builds a new String each call (see mod.rs: fn openfga_server). Consider caching the formatted "server:{uuid}" inside OpenFGAAuthorizer and returning &str or Cow<'_, str> to remove repeated allocs on hot paths.

crates/lakekeeper/src/service/authz/implementations/openfga/client.rs (2)

84-90: Defensive check: reject nil UUIDs at construction

Prevent accidental Uuid::nil() from being accepted as a valid server identity.

Apply:

 pub(crate) async fn new_authorizer(
     mut service_client: BasicOpenFgaServiceClient,
     store_name: Option<String>,
     consistency: ConsistencyPreference,
     server_id: uuid::Uuid,
 ) -> OpenFGAResult<OpenFGAAuthorizer> {
+    debug_assert_ne!(
+        server_id,
+        uuid::Uuid::nil(),
+        "server_id must not be Uuid::nil()"
+    );

Also applies to: 88-89, 101-105


33-40: Avoid logging client identifiers at info level

Client ID is often treated as sensitive. Consider omitting it (or log at debug with redaction).

-            tracing::info!("Building OpenFGA Client with Client Credential Authorization. Token Endpoint: {token_endpoint}, Client ID: {client_id}, Scopes: {scopes:?}");
+            tracing::info!("Building OpenFGA Client with Client Credential Authorization. Token Endpoint: {token_endpoint}, Scopes: {scopes:?}");
crates/lakekeeper/src/implementations/postgres/bootstrap.rs (1)

89-116: Add a test for mismatched server_id path

We cover same-ID double bootstrap; also assert that a different server_id cannot bootstrap after the first.

     #[sqlx::test]
     async fn test_bootstrap(pool: PgPool) {
         let state = CatalogState::from_pools(pool.clone(), pool.clone());
         let server_id = uuid::Uuid::new_v4();
@@
         assert!(!success);
+
+        // Different server_id must also fail
+        let other_id = uuid::Uuid::new_v4();
+        let success = bootstrap(true, other_id, &state.read_write.write_pool)
+            .await
+            .unwrap();
+        assert!(!success);
     }

Also applies to: 111-115

crates/lakekeeper/src/api/management/v1/bootstrap.rs (2)

115-123: Bootstrap guards read well; consider error semantics

Pre-checks for open_for_bootstrap and different server IDs are clear. Optionally, consider returning HTTP 409 Conflict instead of 400 for AlreadyBootstrapped/DifferentServerID to better reflect state conflicts.

Also applies to: 125-133, 134-141


144-145: Use the destructured variable for consistency

You already bound accept_terms_of_use; use it instead of request.accept_terms_of_use.

-        let success = C::bootstrap(request.accept_terms_of_use, server_id, t.transaction()).await?;
+        let success = C::bootstrap(accept_terms_of_use, server_id, t.transaction()).await?;
crates/lakekeeper/src/service/authz/implementations/openfga/mod.rs (4)

94-99: Cache the "server:" string to avoid repeated formatting

openfga_server() is hot and currently formats a new String each call. Precompute once and clone; same allocation count but removes formatting work.

Apply:

 #[derive(Clone, Debug)]
 pub struct OpenFGAAuthorizer {
     client: BasicOpenFgaClient,
     health: Arc<RwLock<Vec<Health>>>,
-    server_id: uuid::Uuid,
+    server_id: uuid::Uuid,
+    // Pre-formatted "server:<uuid>" for OpenFGA object ids
+    server: String,
 }

 impl OpenFGAAuthorizer {
-    #[inline]
-    #[must_use]
-    fn openfga_server(&self) -> String {
-        format!("server:{}", self.server_id)
-    }
+    #[inline]
+    #[must_use]
+    fn openfga_server(&self) -> String {
+        // Cloning the cached string avoids repeated formatting cost.
+        self.server.clone()
+    }
 }

Also initialize the new field in the constructor (in client.rs):

 // crates/lakekeeper/src/service/authz/implementations/openfga/client.rs
 Ok(OpenFGAAuthorizer {
     client,
     health: Arc::new(RwLock::new(vec![])),
-    server_id,
+    server_id,
+    server: format!("server:{server_id}"),
 })

Also applies to: 709-714


251-271: Rename local variable to avoid confusion with struct field

server_id holds the formatted "server:" string, not the Uuid. Rename to server for clarity.

-        let server_id = self.openfga_server();
+        let server = self.openfga_server();
         match action {
             // Currently, given a user-id, all information about a user can be retrieved.
             // For multi-tenant setups, we need to restrict this to a tenant.
             CatalogUserAction::CanRead => Ok(true),
             CatalogUserAction::CanUpdate => {
                 self.check(CheckRequestTupleKey {
                     user: actor.to_openfga(),
                     relation: CatalogServerAction::CanUpdateUsers.to_string(),
-                    object: server_id,
+                    object: server,
                 })
                 .await
             }
             CatalogUserAction::CanDelete => {
                 self.check(CheckRequestTupleKey {
                     user: actor.to_openfga(),
                     relation: CatalogServerAction::CanDeleteUsers.to_string(),
-                    object: server_id,
+                    object: server,
                 })
                 .await
             }
         }

187-196: Per-instance “server:” use looks right; confirm persistence/rotation semantics

All server-object checks/writes now bind to the instance’s server_id. Please confirm:

  • server_id lifecycle: persisted across restarts or intentionally ephemeral?
  • migration/ops: what happens to tuples written under previous server ids (e.g., Admin/Operator, Project↔Server links)? Any cleanup or docs needed?
  • bootstrap flows in multi-instance deployments: are concurrent instances guaranteed to use their own ids without cross-talk?

If ephemeral-by-design, consider documenting that server-scoped privileges are per-instance and won’t carry across restarts.

Also applies to: 276-288, 471-506, 715-741


1077-1084: Add an isolation test for different server_ids in the same store

Validate that privileges bound to authorizer A’s server don’t grant list-all on authorizer B.

Example (within the existing tests module):

#[tokio::test]
async fn test_server_id_isolation() {
    // Arrange: same store, two different server_ids
    let client = new_client_from_config().await.expect("client");
    let store_name = format!("test_store_isolation_{}", uuid::Uuid::now_v7());
    migrate(&client, Some(store_name.clone())).await.unwrap();

    let a = new_authorizer(client.clone(), Some(store_name.clone()), TEST_CONSISTENCY, uuid::Uuid::now_v7()).await.unwrap();
    let b = new_authorizer(client.clone(), Some(store_name), TEST_CONSISTENCY, uuid::Uuid::now_v7()).await.unwrap();

    let user = UserId::new_unchecked("oidc", "alice");
    let actor = Actor::Principal(user.clone());
    let md = RequestMetadata::new(actor.clone(), None, None);

    // Grant server-level rights on A only
    a.bootstrap(&md, true).await.unwrap();

    // Act + Assert
    // A can list all projects
    assert!(a.is_allowed_server_action_impl(&md, CatalogServerAction::CanListAllProjects).await.unwrap());

    // B cannot list all projects because its server differs
    assert!(!b.is_allowed_server_action_impl(&md, CatalogServerAction::CanListAllProjects).await.unwrap());
}
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f13bd8a and b4ff425.

📒 Files selected for processing (32)
  • .sqlx/query-65ea0db4aef662e0423eb85da840d20f62bf6b468a8c30de14bf980257d07b9f.json (2 hunks)
  • crates/lakekeeper-bin/src/serve.rs (1 hunks)
  • crates/lakekeeper/src/api/management/v1/bootstrap.rs (3 hunks)
  • crates/lakekeeper/src/catalog/mod.rs (1 hunks)
  • crates/lakekeeper/src/catalog/namespace.rs (1 hunks)
  • crates/lakekeeper/src/catalog/tables.rs (1 hunks)
  • crates/lakekeeper/src/catalog/views.rs (1 hunks)
  • crates/lakekeeper/src/config.rs (0 hunks)
  • crates/lakekeeper/src/implementations/postgres/bootstrap.rs (3 hunks)
  • crates/lakekeeper/src/implementations/postgres/catalog.rs (1 hunks)
  • crates/lakekeeper/src/implementations/postgres/endpoint_statistics/mod.rs (2 hunks)
  • crates/lakekeeper/src/implementations/postgres/tasks.rs (2 hunks)
  • crates/lakekeeper/src/serve.rs (1 hunks)
  • crates/lakekeeper/src/service/authz/implementations/allow_all.rs (2 hunks)
  • crates/lakekeeper/src/service/authz/implementations/mod.rs (1 hunks)
  • crates/lakekeeper/src/service/authz/implementations/openfga/api.rs (19 hunks)
  • crates/lakekeeper/src/service/authz/implementations/openfga/check.rs (2 hunks)
  • crates/lakekeeper/src/service/authz/implementations/openfga/client.rs (3 hunks)
  • crates/lakekeeper/src/service/authz/implementations/openfga/health.rs (3 hunks)
  • crates/lakekeeper/src/service/authz/implementations/openfga/migration.rs (1 hunks)
  • crates/lakekeeper/src/service/authz/implementations/openfga/mod.rs (7 hunks)
  • crates/lakekeeper/src/service/authz/mod.rs (2 hunks)
  • crates/lakekeeper/src/service/catalog.rs (3 hunks)
  • crates/lakekeeper/src/service/mod.rs (1 hunks)
  • crates/lakekeeper/src/service/task_queue/tabular_expiration_queue.rs (1 hunks)
  • crates/lakekeeper/src/tests/drop_recursive.rs (1 hunks)
  • crates/lakekeeper/src/tests/drop_warehouse.rs (1 hunks)
  • crates/lakekeeper/src/tests/endpoint_stats.rs (1 hunks)
  • crates/lakekeeper/src/tests/stats.rs (1 hunks)
  • crates/lakekeeper/src/tests/tasks.rs (1 hunks)
  • docs/docs/api/management-open-api.yaml (1 hunks)
  • docs/docs/concepts.md (1 hunks)
💤 Files with no reviewable changes (1)
  • crates/lakekeeper/src/config.rs
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-08-30T10:01:08.498Z
Learnt from: c-thiel
PR: lakekeeper/lakekeeper#1316
File: .sqlx/query-a055d45b5749e7c6e1fd1c90f8660f26c6436f4f5525ec3059303f925f945c64.json:3-3
Timestamp: 2025-08-30T10:01:08.498Z
Learning: When using `ON CONFLICT ... DO NOTHING` in PostgreSQL INSERT statements, the RETURNING clause does not return rows for entries that conflicted and were not inserted. This means you cannot rely on RETURNING to identify all rows that matched the initial conditions when using DO NOTHING.

Applied to files:

  • .sqlx/query-65ea0db4aef662e0423eb85da840d20f62bf6b468a8c30de14bf980257d07b9f.json
🧬 Code graph analysis (14)
crates/lakekeeper/src/service/mod.rs (3)
crates/lakekeeper/src/service/authz/implementations/allow_all.rs (1)
  • server_id (42-44)
crates/lakekeeper/src/service/authz/implementations/openfga/mod.rs (1)
  • server_id (104-106)
crates/lakekeeper/src/service/authz/mod.rs (2)
  • server_id (200-200)
  • server_id (1051-1053)
crates/lakekeeper-bin/src/serve.rs (2)
crates/lakekeeper/src/service/catalog.rs (1)
  • determine_server_id (306-315)
crates/lakekeeper/src/service/authz/implementations/mod.rs (1)
  • get_default_authorizer_from_config (14-22)
crates/lakekeeper/src/catalog/views.rs (1)
crates/lakekeeper/src/tests/mod.rs (1)
  • get_api_context (268-295)
crates/lakekeeper/src/service/authz/implementations/openfga/api.rs (4)
crates/lakekeeper/src/service/authz/implementations/allow_all.rs (1)
  • server_id (42-44)
crates/lakekeeper/src/service/authz/implementations/openfga/mod.rs (2)
  • server_id (104-106)
  • openfga_server (711-713)
crates/lakekeeper/src/service/authz/mod.rs (2)
  • server_id (200-200)
  • server_id (1051-1053)
crates/lakekeeper/src/service/mod.rs (1)
  • server_id (57-59)
crates/lakekeeper/src/service/authz/implementations/openfga/check.rs (1)
crates/lakekeeper/src/service/authz/implementations/openfga/api.rs (1)
  • authorizer (1430-1441)
crates/lakekeeper/src/service/authz/implementations/allow_all.rs (4)
crates/lakekeeper/src/service/authz/implementations/openfga/mod.rs (1)
  • server_id (104-106)
crates/lakekeeper/src/service/authz/mod.rs (2)
  • server_id (200-200)
  • server_id (1051-1053)
crates/lakekeeper/src/service/catalog.rs (1)
  • server_id (231-236)
crates/lakekeeper/src/service/mod.rs (1)
  • server_id (57-59)
crates/lakekeeper/src/service/authz/mod.rs (3)
crates/lakekeeper/src/service/authz/implementations/allow_all.rs (1)
  • server_id (42-44)
crates/lakekeeper/src/service/authz/implementations/openfga/mod.rs (1)
  • server_id (104-106)
crates/lakekeeper/src/service/mod.rs (1)
  • server_id (57-59)
crates/lakekeeper/src/service/authz/implementations/mod.rs (6)
crates/lakekeeper/src/service/authz/implementations/allow_all.rs (1)
  • server_id (42-44)
crates/lakekeeper/src/service/authz/implementations/openfga/mod.rs (1)
  • server_id (104-106)
crates/lakekeeper/src/service/authz/mod.rs (2)
  • server_id (200-200)
  • server_id (1051-1053)
crates/lakekeeper/src/service/catalog.rs (1)
  • server_id (231-236)
crates/lakekeeper/src/service/mod.rs (1)
  • server_id (57-59)
crates/lakekeeper/src/service/authz/implementations/openfga/client.rs (1)
  • new_authorizer_from_config (63-74)
crates/lakekeeper/src/service/authz/implementations/openfga/client.rs (5)
crates/lakekeeper/src/service/authz/implementations/allow_all.rs (1)
  • server_id (42-44)
crates/lakekeeper/src/service/authz/implementations/openfga/mod.rs (1)
  • server_id (104-106)
crates/lakekeeper/src/service/authz/mod.rs (2)
  • server_id (200-200)
  • server_id (1051-1053)
crates/lakekeeper/src/service/catalog.rs (1)
  • server_id (231-236)
crates/lakekeeper/src/service/mod.rs (1)
  • server_id (57-59)
crates/lakekeeper/src/service/catalog.rs (6)
crates/lakekeeper/src/service/authz/implementations/allow_all.rs (1)
  • server_id (42-44)
crates/lakekeeper/src/service/authz/implementations/openfga/mod.rs (1)
  • server_id (104-106)
crates/lakekeeper/src/service/authz/mod.rs (2)
  • server_id (200-200)
  • server_id (1051-1053)
crates/lakekeeper/src/service/mod.rs (1)
  • server_id (57-59)
crates/lakekeeper/src/api/management/v1/bootstrap.rs (1)
  • server_info (201-242)
crates/lakekeeper/src/implementations/postgres/catalog.rs (1)
  • get_server_info (85-89)
crates/lakekeeper/src/implementations/postgres/catalog.rs (4)
crates/lakekeeper/src/service/catalog.rs (3)
  • server_id (231-236)
  • transaction (84-84)
  • bootstrap (327-331)
crates/lakekeeper/src/service/mod.rs (1)
  • server_id (57-59)
crates/lakekeeper/src/api/management/v1/bootstrap.rs (1)
  • bootstrap (84-199)
crates/lakekeeper/src/implementations/postgres/bootstrap.rs (1)
  • bootstrap (47-80)
crates/lakekeeper/src/implementations/postgres/bootstrap.rs (3)
crates/lakekeeper/src/service/catalog.rs (2)
  • server_id (231-236)
  • bootstrap (327-331)
crates/lakekeeper/src/api/management/v1/bootstrap.rs (1)
  • bootstrap (84-199)
crates/lakekeeper/src/implementations/postgres/catalog.rs (1)
  • bootstrap (92-98)
crates/lakekeeper/src/service/authz/implementations/openfga/mod.rs (5)
crates/lakekeeper/src/service/authz/implementations/allow_all.rs (1)
  • server_id (42-44)
crates/lakekeeper/src/service/authz/mod.rs (2)
  • server_id (200-200)
  • server_id (1051-1053)
crates/lakekeeper/src/service/catalog.rs (1)
  • server_id (231-236)
crates/lakekeeper/src/service/mod.rs (1)
  • server_id (57-59)
crates/lakekeeper/src/service/authz/implementations/openfga/client.rs (1)
  • new_authorizer (84-106)
crates/lakekeeper/src/api/management/v1/bootstrap.rs (6)
crates/lakekeeper/src/service/authz/implementations/allow_all.rs (2)
  • server_id (42-44)
  • bootstrap (62-64)
crates/lakekeeper/src/service/authz/implementations/openfga/mod.rs (2)
  • server_id (104-106)
  • bootstrap (165-199)
crates/lakekeeper/src/service/authz/mod.rs (4)
  • server_id (200-200)
  • server_id (1051-1053)
  • bootstrap (216-216)
  • bootstrap (1071-1073)
crates/lakekeeper/src/service/catalog.rs (3)
  • server_id (231-236)
  • get_server_info (318-320)
  • bootstrap (327-331)
crates/lakekeeper/src/service/mod.rs (1)
  • server_id (57-59)
crates/lakekeeper/src/implementations/postgres/bootstrap.rs (1)
  • bootstrap (47-80)
⏰ 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: check-generated-openapi-matches
  • GitHub Check: test
  • GitHub Check: clippy
  • GitHub Check: sqlx-check
  • GitHub Check: docker / docker
🔇 Additional comments (27)
crates/lakekeeper/src/implementations/postgres/endpoint_statistics/mod.rs (1)

29-29: Good switch to explicit construction of the test authorizer.

Using AllowAllAuthorizer::default() aligns tests with the new per-instance server_id flow and avoids relying on a static/global. Looks good.

Confirm that crate::tests::setup now expects an Authorizer instance (not a type) across all test sites to prevent subtle mismatches.

Also applies to: 68-68

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

56-60: Nice: expose server_id via State.

Thin passthrough keeps call sites clean.

Ensure every Authorizer impl provides a non-panicking server_id(). The trait shows an unimplemented!() fallback in authz/mod.rs (Lines 1050-1052 in the snippet). If that default is reachable, calling State::server_id() could panic. Prefer requiring impls without a default or gating the default behind unreachable code paths.

docs/docs/api/management-open-api.yaml (1)

4274-4281: Schema change to make server-id nullable is correct; required list already excludes it.

Description matches runtime behavior (null before bootstrap).

Rust ServerInfo gained open_for_bootstrap (internal enum). If this signal is intended for clients, mirror it here (e.g., open-for-bootstrap: boolean when bootstrapped). If it’s intentionally internal, consider noting that in API docs to avoid confusion.

crates/lakekeeper/src/service/catalog.rs (1)

228-243: Helpful convenience methods on ServerInfo.

server_id() and is_bootstrapped() reduce boilerplate at call sites.

crates/lakekeeper/src/catalog/tables.rs (1)

2892-2892: LGTM — all AllowAllAuthorizer instantiations use ::default() No remaining bare instantiations found.

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

349-349: LGTM — default authorizer for tests

Consistent with server_id being carried by the authorizer instance.

crates/lakekeeper/src/tests/stats.rs (1)

166-166: LGTM — use AllowAllAuthorizer::default() in stats test setup

Keeps test scaffolding aligned with per-instance server identity.

crates/lakekeeper/src/catalog/views.rs (1)

167-167: LGTM — pass Default-constructed authorizer to get_api_context

Appropriate given the new Authorizer shape.

crates/lakekeeper/src/catalog/namespace.rs (1)

841-841: LGTM — default authorizer in protected-namespace test

Matches the updated authorizer API.

crates/lakekeeper/src/tests/tasks.rs (1)

185-185: LGTM — default authorizer in tasks test setup

Consistent with server_id threading across queues.

crates/lakekeeper/src/service/task_queue/tabular_expiration_queue.rs (1)

291-291: LGTM — default authorizer for queue registration in tests

Keeps worker wiring consistent with the new Authorizer.

crates/lakekeeper/src/tests/endpoint_stats.rs (1)

654-654: LGTM — default authorizer in endpoint stats tests

Aligned with per-instance server identity changes.

.sqlx/query-65ea0db4aef662e0423eb85da840d20f62bf6b468a8c30de14bf980257d07b9f.json (1)

3-3: No action needed – zero-row RETURNING is already handled
The call uses fetch_one and matches on sqlx::Error::RowNotFound (mapping to false), which gracefully covers the case where RETURNING yields no rows.

crates/lakekeeper/src/service/authz/implementations/openfga/health.rs (1)

20-21: LGTM: per-instance server object used in health check

Switch to self.openfga_server() is correct and aligns with per-instance IDs.

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

94-98: Correct propagation of server_id into bootstrap.

Signature and call site are aligned with the trait and underlying SQL. Looks good.

crates/lakekeeper/src/service/authz/implementations/openfga/migration.rs (1)

111-116: Test: passing per-test server_id looks good

Supplying a random Uuid to new_authorizer keeps tests isolated.

crates/lakekeeper/src/service/authz/implementations/mod.rs (2)

18-21: Threading server_id through backends is correct

AllowAll and OpenFGA both receive the provided server_id. Good alignment with the new Authorizer API.


14-16: Signature change validated Only one usage—get_default_authorizer_from_config(sid) in crates/lakekeeper-bin/src/serve.rs—now passes a Uuid; no other call sites or tests reference this function.

crates/lakekeeper/src/service/authz/implementations/openfga/api.rs (2)

800-809: Server assignments: dynamic server id usage is correct

Authorization check and get_relations both use the per-instance server object.


1039-1046: Update server assignments: dynamic server id usage is correct

checked_write targets the per-instance server. All good.

crates/lakekeeper/src/service/authz/implementations/openfga/client.rs (1)

63-74: Signature change threads server_id correctly

Adding server_id to new_authorizer_from_config and forwarding it to new_authorizer looks correct.

crates/lakekeeper/src/implementations/postgres/bootstrap.rs (2)

37-41: ServerInfo now surfaces open_for_bootstrap — good

Returning open_for_bootstrap alongside server_id/terms_accepted aligns API and DB state.


54-61: Safe idempotent bootstrap confirmed

Migrations define the server table without inserting any placeholder row, so the initial INSERT will succeed and return the correct server_id.

crates/lakekeeper/src/api/management/v1/bootstrap.rs (3)

63-65: Expose server_id as Option — API shape matches semantics

Nullable server_id prior to bootstrap is the right contract.


110-112: server_id source is consistent with service state

Using state.v1_state.server_id() (authorizer-derived) keeps a single source of truth.


223-227: Server info response correctly reflects new ServerInfo helpers

Using is_bootstrapped() and server_id() keeps API decoupled from storage details.

crates/lakekeeper/src/service/authz/implementations/openfga/mod.rs (1)

104-107: Trait impl for server_id is correct

Matches Authorizer::server_id contract and surfaces the per-instance ID.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Sep 7, 2025
@c-thiel

c-thiel commented Sep 7, 2025

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 7, 2025

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
crates/lakekeeper/src/service/authz/implementations/openfga/migration.rs (1)

111-116: new_authorizer call sites missing required args

  • In crates/lakekeeper/src/service/authz/implementations/openfga/health.rs (line 55): only client.clone(), Some(store_name) are passed; append ConsistencyPreference::HigherConsistency and uuid::Uuid::new_v4().
  • In crates/lakekeeper/src/service/authz/implementations/openfga/mod.rs (line 1090): only client, Some(store_name) are passed; append the two missing arguments.
crates/lakekeeper/src/service/authz/implementations/openfga/mod.rs (1)

990-1006: Bug: continuation token not reset per userset suffix in delete_user_relations.

continuation_token is declared outside the for suffix in s loop; after the first suffix finishes with Some(""), subsequent suffixes skip the loop entirely.

-                let mut continuation_token = None;
-                for suffix in s {
+                for suffix in s {
+                    let mut continuation_token = None;
                     let user = format!("{fga_user_str}{suffix}");
                     while continuation_token != Some(String::new()) {
                         let response = self
                             .read(
                                 MAX_TUPLES_PER_WRITE,
                                 ReadRequestTupleKey {
                                     user: user.clone(),
                                     relation: String::new(),
                                     object: format!("{o}:"),
                                 },
                                 continuation_token.clone(),
                             )
                             .await?;
                         continuation_token = Some(response.continuation_token);
                         let keys = response
🧹 Nitpick comments (9)
crates/lakekeeper/src/serve.rs (1)

503-508: Include server_id (and the actual flag value) in the warning for better ops visibility

Surface %server_id and log the variable value instead of a hardcoded true. This aids correlation in logs and future-proofs the field.

-            if *open_for_bootstrap {
-                tracing::warn!(
-                    open_for_bootstrap = true,
-                    "The catalog is bootstrapped but still open for bootstrap. Re-run the bootstrap to set a new administrator and close the window (management v1 bootstrap endpoint)."
-                );
-            }
+            if *open_for_bootstrap {
+                tracing::warn!(
+                    %server_id,
+                    open_for_bootstrap = *open_for_bootstrap,
+                    "The catalog is bootstrapped but still open for bootstrap. Re-run the bootstrap to set a new administrator and close the window (management v1 bootstrap endpoint)."
+                );
+            }

Optionally consider emitting a metric or marking health as degraded when this is true.

crates/lakekeeper/src/service/authz/implementations/openfga/check.rs (1)

186-199: Simplify check_server: avoid extra allocation and unnecessary mutability

  • No mutation of for_principal; take Option<&UserOrRole> instead of &mut Option<...>.
  • Use &str from authorizer.openfga_server() and only allocate when returning.
-async fn check_server(
-    metadata: &RequestMetadata,
-    authorizer: &OpenFGAAuthorizer,
-    for_principal: &mut Option<UserOrRole>,
-    action: &APIServerAction,
-) -> Result<(String, String)> {
-    let openfga_server = authorizer.openfga_server().to_string();
+async fn check_server(
+    metadata: &RequestMetadata,
+    authorizer: &OpenFGAAuthorizer,
+    for_principal: Option<&UserOrRole>,
+    action: &APIServerAction,
+) -> Result<(String, String)> {
+    let openfga_server = authorizer.openfga_server();
     if for_principal.is_some() {
         authorizer
             .require_action(
                 metadata,
                 AllServerAction::CanReadAssignments,
-                &openfga_server,
+                openfga_server,
             )
             .await?;
     } else {
         authorizer.check_actor(metadata.actor()).await?;
     }
-    Ok((action.to_openfga().to_string(), openfga_server))
+    Ok((action.to_openfga().to_string(), openfga_server.to_string()))
 }

Call site adjustment in this file (illustrative):

// before
CheckOperation::Server { action } => {
    check_server(metadata, &authorizer, &mut for_principal, action).await?
}
// after
CheckOperation::Server { action } => {
    check_server(metadata, &authorizer, for_principal.as_ref(), action).await?
}
crates/lakekeeper/src/service/authz/implementations/openfga/api.rs (3)

369-373: Avoid allocation: use &str from openfga_server()

No need to allocate a String here.

-    let openfga_server = authorizer.openfga_server().to_string();
+    let openfga_server = authorizer.openfga_server();
 ...
-        &openfga_server,
+        openfga_server,

800-805: Avoid allocation and name consistently

Use &str and prefer the same name used elsewhere (openfga_server).

-    let server_id = authorizer.openfga_server().to_string();
+    let openfga_server = authorizer.openfga_server();
     authorizer
-        .require_action(&metadata, AllServerAction::CanReadAssignments, &server_id)
+        .require_action(&metadata, AllServerAction::CanReadAssignments, openfga_server)
         .await?;
-    let assignments = get_relations(authorizer, query.relations, &server_id).await?;
+    let assignments = get_relations(authorizer, query.relations, openfga_server).await?;

1035-1042: Avoid allocation in update_server_assignments

Pass the &str directly.

-    let server_id = authorizer.openfga_server().to_string();
+    let openfga_server = authorizer.openfga_server();
 ...
-        &server_id,
+        openfga_server,
crates/lakekeeper/src/service/authz/implementations/openfga/mod.rs (4)

265-286: Rename local variable for clarity.

server_id here holds "server:<uuid>", not a UUID. Rename to avoid confusion when scanning.

-        let server_id = self.openfga_server().to_string();
+        let server = self.openfga_server().to_string();
         match action {
             // Currently, given a user-id, all information about a user can be retrieved.
             // For multi-tenant setups, we need to restrict this to a tenant.
             CatalogUserAction::CanRead => Ok(true),
             CatalogUserAction::CanUpdate => {
                 self.check(CheckRequestTupleKey {
                     user: actor.to_openfga(),
                     relation: CatalogServerAction::CanUpdateUsers.to_string(),
-                    object: server_id.clone(),
+                    object: server.clone(),
                 })
                 .await
             }
             CatalogUserAction::CanDelete => {
                 self.check(CheckRequestTupleKey {
                     user: actor.to_openfga(),
                     relation: CatalogServerAction::CanDeleteUsers.to_string(),
-                    object: server_id,
+                    object: server,
                 })
                 .await
             }
         }

723-727: Method naming nit: clarify intent.

openfga_server() returns the fully-qualified object id ("server:<uuid>"), not a hostname. Consider an alias like server_object() for readability within this module.

Additional helper (outside this hunk):

#[inline]
fn server_object(&self) -> &str { self.openfga_server() }

1090-1097: Nice: tests pass random server_id into the authorizer.

Optional: add a test asserting isolation across different server_ids within the same store (admin on A doesn’t grant list-all on B).

I can draft a test if you’d like.


896-904: Typo in variable name.

openfga_tpye → openfga_type. Minor readability polish.

-        let openfga_tpye = object.openfga_type().clone();
+        let openfga_type = object.openfga_type().clone();
-        let objects = openfga_tpye.user_of();
+        let objects = openfga_type.user_of();
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b4ff425 and 9311a18.

📒 Files selected for processing (13)
  • crates/lakekeeper-bin/src/serve.rs (1 hunks)
  • crates/lakekeeper/src/api/management/v1/bootstrap.rs (3 hunks)
  • crates/lakekeeper/src/implementations/postgres/bootstrap.rs (3 hunks)
  • crates/lakekeeper/src/serve.rs (1 hunks)
  • crates/lakekeeper/src/service/authz/implementations/allow_all.rs (2 hunks)
  • crates/lakekeeper/src/service/authz/implementations/openfga/api.rs (19 hunks)
  • crates/lakekeeper/src/service/authz/implementations/openfga/check.rs (2 hunks)
  • crates/lakekeeper/src/service/authz/implementations/openfga/client.rs (3 hunks)
  • crates/lakekeeper/src/service/authz/implementations/openfga/health.rs (3 hunks)
  • crates/lakekeeper/src/service/authz/implementations/openfga/migration.rs (2 hunks)
  • crates/lakekeeper/src/service/authz/implementations/openfga/mod.rs (8 hunks)
  • crates/lakekeeper/src/service/authz/mod.rs (3 hunks)
  • crates/lakekeeper/src/service/catalog.rs (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (8)
  • crates/lakekeeper/src/service/authz/implementations/openfga/health.rs
  • crates/lakekeeper/src/service/authz/mod.rs
  • crates/lakekeeper-bin/src/serve.rs
  • crates/lakekeeper/src/service/authz/implementations/allow_all.rs
  • crates/lakekeeper/src/implementations/postgres/bootstrap.rs
  • crates/lakekeeper/src/service/authz/implementations/openfga/client.rs
  • crates/lakekeeper/src/api/management/v1/bootstrap.rs
  • crates/lakekeeper/src/service/catalog.rs
⏰ 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). (5)
  • GitHub Check: docker / docker
  • GitHub Check: docker / docker
  • GitHub Check: docker / docker
  • GitHub Check: docker / docker
  • GitHub Check: Validate PR Title
🔇 Additional comments (10)
crates/lakekeeper/src/serve.rs (2)

500-500: Pattern match updated for new schema — LGTM

Including open_for_bootstrap in ServerInfo::Bootstrapped aligns with the new API/docs.


510-513: Add structured fields to info log for consistency
Include terms_accepted = true (and optionally open_for_bootstrap = false) in the info log:

- tracing::info!(%server_id, "The catalog is bootstrapped.");
+ tracing::info!(%server_id, terms_accepted = true, "The catalog is bootstrapped.");

Confirm removal of config-based server_id validation is intentional and that all callers now derive or generate server_id at runtime.

crates/lakekeeper/src/service/authz/implementations/openfga/migration.rs (1)

81-83: Log wording fix — LGTM

Clearer message; no behavior change.

crates/lakekeeper/src/service/authz/implementations/openfga/api.rs (1)

1687-1690: Tests updated to derive per-instance server id — LGTM

Good move away from a global constant; usages correctly pass &str or allocate only when needed.

Also applies to: 1703-1704, 1712-1713, 1831-1833, 1843-1843, 1851-1853, 1862-1863, 1871-1873, 1881-1881, 1899-1901, 1910-1911, 1922-1922, 1942-1945, 1961-1962, 1968-1969, 1987-1988

crates/lakekeeper/src/service/authz/implementations/openfga/mod.rs (6)

98-101: Per-instance server identity is a solid move.

Storing both server_id and the pre-formatted openfga_server avoids repeated formatting hot paths. Looks good.


118-120: Trait surface addition is appropriate.

Exposing server_id() on the Authorizer is clear and minimal.


290-302: LGTM – server-scoped checks.

Using the per-instance server object for server actions is correct.


492-520: Project creation wiring looks correct.

Bidirectional links between server and project using the per-instance server object are consistent.


728-736: LGTM – list-all check scoped to this server.

Scoping CanListAllProjects to self.openfga_server() is aligned with the new identity model.


179-213: Resolved: bootstrap gating and server_id scoping are correctly enforced.

The management v1 bootstrap endpoint checks open_for_bootstrap and returns a bad-request if closed, and the underlying Postgres ON CONFLICT … WHERE server.open_for_bootstrap = true AND server.server_id = $1 ensures the operation is scoped to this server’s ID.

@github-actions

github-actions Bot commented Sep 7, 2025

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 4a84ce5 into main Sep 10, 2025
@c-thiel
c-thiel deleted the ct/feat-remove-server-id branch September 10, 2025 08:14
@c-thiel c-thiel mentioned this pull request Sep 9, 2025
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]>
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.

feat: Random Server ID

2 participants