Skip to content

fix(openfga)!: use the configured authorization model version and check it at startup - #2214

Merged
c-thiel merged 2 commits into
mainfrom
christian/openfga-configured-model-version
Nov 2, 2026
Merged

c-thiel merged 2 commits into
mainfrom
christian/openfga-configured-model-version

Conversation

@c-thiel

@c-thiel c-thiel commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

LAKEKEEPER__OPENFGA__AUTHORIZATION_MODEL_VERSION had no effect: lakekeeper migrate skipped OpenFGA when it was set, but the server always looked up the model of its built-in version. The server now uses the configured version and checks it at startup:

  • Default prefix collaboration (Lakekeeper's own models): the version must be the one this release installs, because own models change between versions under the same relation names. Otherwise the server does not start and names the configured and expected version.
  • Any other prefix (externally managed model): the model must define every type and relation the server checks or writes, compared by name; extra ones are allowed. Otherwise the server does not start and lists each missing type#relation.

The required names come from the relation enums in relations.rs, so new relations are checked automatically. Startup now reads the authorization model, so OpenFGA credentials need permission to read models. The store is looked up once per authorizer start.

Docs: the configuration reference describes the setting; two typos in neighbouring rows are fixed.

Release notes

  • OpenFGA: LAKEKEEPER__OPENFGA__AUTHORIZATION_MODEL_VERSION now selects the model. The server uses the configured model version and does not start if it cannot use it. Before upgrading, remove this setting or set it to the model version this release installs.

Downstream follow-up

  • OpenFGAError has a new variant AuthModel(AuthModelError); exhaustive matches need an arm for it.

Summary by CodeRabbit

  • New Features
    • Authorization model configuration now supports selecting a specific model version and external model prefix.
    • The server verifies that the selected model is available and includes the required types and relations before starting.
  • Bug Fixes
    • Authorization checks correctly handle actions answered locally without OpenFGA.
  • Documentation
    • Updated configuration guidance to explain model version selection, external model requirements, and startup validation.
    • Clarified the steps for updating authorization models.

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b8e68d22-9bfa-448e-b48a-911ef09b0466
Commits

Reviewing files that changed from the base of the PR and between 3df88d6 and 924932a.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: b139a3ba-5fac-4282-af9c-305343f52be2
Commits

Reviewing files that changed from the base of the PR and between 0a86441 and 3df88d6.

Files selected for processing: 9
  • crates/authz-openfga/src/authorizer.rs
  • crates/authz-openfga/src/client.rs
  • crates/authz-openfga/src/config.rs
  • crates/authz-openfga/src/error.rs
  • crates/authz-openfga/src/lib.rs
  • crates/authz-openfga/src/migration.rs
  • crates/authz-openfga/src/relations.rs
  • docs/docs/configuration.md
  • docs/docs/developer-guide.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 0 remain after this review.

Walkthrough

The OpenFGA authorizer now resolves both store and model IDs, checks the selected model for server-used types and relations, and reports model errors during initialization. Role checks use a shared predicate for actions answered locally. Configuration and migration guidance describe model-version requirements.

Changes

OpenFGA model and authorization

Layer / File(s) Summary
Relation inventory and local role checks
crates/authz-openfga/src/lib.rs, crates/authz-openfga/src/relations.rs, crates/authz-openfga/src/authorizer.rs
FGA types and relation enums support iteration. relations_in_use excludes the role relation answered locally, and role-action checks use the shared local-answer predicate.
Active model resolution and validation
crates/authz-openfga/src/migration.rs, crates/authz-openfga/src/error.rs, crates/authz-openfga/src/client.rs, crates/authz-openfga/src/config.rs, docs/docs/configuration.md, docs/docs/developer-guide.md
The active-model lookup returns store and model IDs and validates required types and relations. New errors cover model mismatches and missing model data. Client initialization, migration tests, configuration, and migration guidance use the updated model contract.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant new_authorizer
  participant get_active_auth_model
  participant BasicOpenFgaServiceClient
  participant OpenFGA
  participant missing_model_entries
  new_authorizer->>get_active_auth_model: optional store name
  get_active_auth_model->>BasicOpenFgaServiceClient: resolve store and selected model
  BasicOpenFgaServiceClient->>OpenFGA: read authorization model
  OpenFGA-->>BasicOpenFgaServiceClient: model response
  get_active_auth_model->>missing_model_entries: check required types and relations
  missing_model_entries-->>get_active_auth_model: missing entries
  get_active_auth_model-->>new_authorizer: store ID and model ID
Loading

Possibly related PRs

  • lakekeeper/lakekeeper#2115: Adds relations and updates the installed OpenFGA model version, which intersects with this PR’s required-name checks and version selection.

Suggested reviewers: mooori, brgr-s

Merge Risk: Minimal · previous review 3df88

No merge-blocking issue was identified; proceed with normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 58.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and specifically describes the main change: using the configured authorization model version and validating it at startup.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 58.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 12 functions across 7 files. (2 skipped: 2 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

A rabbit checks the model names,
Then hops through stores and version lanes.
Relations line up, the checks run true,
Local role answers skip the queue.
I nibble greens and call it done!

@c-thiel
c-thiel enabled auto-merge (squash) November 2, 2026 17:08
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

✅ PR Title Formatted Correctly

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

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