Repository navigation
fix(openfga)!: use the configured authorization model version and check it at startup - #2214
Conversation
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes.
|
| 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
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: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passedFull 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.
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!
✅ PR Title Formatted CorrectlyThe title of this PR match the correct format. Thank you! |
LAKEKEEPER__OPENFGA__AUTHORIZATION_MODEL_VERSIONhad no effect:lakekeeper migrateskipped 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: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.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
LAKEKEEPER__OPENFGA__AUTHORIZATION_MODEL_VERSIONnow 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
OpenFGAErrorhas a new variantAuthModel(AuthModelError); exhaustive matches need an arm for it.Summary by CodeRabbit