Skip to content

feat(authz): write_data allows commits without updates; a commit to astaged table needs modify - #2230

Merged
c-thiel merged 1 commit into
mainfrom
christian/data-only-empty-commits
Nov 3, 2026
Merged

c-thiel merged 1 commit into
mainfrom
christian/data-only-empty-commits

Conversation

@c-thiel

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

Copy link
Copy Markdown
Member

A commit request without updates counts as a data commit, so write_data allows it. Spark sends such a commit before each mergeSchema write. A commit to a staged table, which finishes a staged create, always needs the permission to commit changes of any kind (modify in OpenFGA). A transaction that includes such a table is refused as a whole without it. Batch-check gives the same answer for a commit on a staged table.

Summary by CodeRabbit

  • Authorization

    • Data-only commits, including commits with no updates, can use write_data on established tables when no schema or property changes occur.
    • Commits to staged tables require modify regardless of their contents. Only the user who created a staged table can complete its creation.
    • Transactions containing a refused structural change or staged-table commit do not apply changes to other tables.
  • Documentation

    • Clarified commit permissions and how staged tables are handled.

… staged table needs modify

A commit request without updates counts as a data commit, so `write_data` allows it. Spark sends such a commit before each mergeSchema write. A commit to a staged table, which finishes a staged create, always needs the permission to commit changes of any kind (`modify` in OpenFGA). A transaction that includes such a table is refused as a whole without it. Batch-check gives the same answer for a commit on a staged table.
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Walkthrough

This change updates commit authorization for empty requests and staged tables. Applied empty commits on established tables can use write_data, while checks that omit update kinds remain general commit checks. Commits to staged tables also require modify authorization.

Changes

Commit authorization

Layer / File(s) Summary
Commit action classification
crates/lakekeeper/src/service/authz/mod.rs, crates/authz-openfga/src/relations.rs, crates/authz-openfga/src/authorizer.rs, crates/lakekeeper-integration-tests/tests/management_check.rs
Commit actions now mark whether their update-kind listing covers the full applied request. Empty applied requests count as data commits only with that marker; serialization and audit records exclude it. Tests cover the distinction and the OpenFGA mapping.
Commit action construction and staged-table checks
crates/lakekeeper/src/server/commit_tables.rs, crates/lakekeeper/src/server/tables.rs, crates/lakekeeper/src/api/management/v1/check.rs, crates/lakekeeper/src/service/catalog_store/*, crates/lakekeeper/src/service/events/backends/audit/tests.rs
The server builds commit authorization actions from updates. Staged tables receive an additional any_commit() authorization requirement. The management check path clears update-kind fields for staged-table commit checks, and TableInfo::is_staged identifies staged tables by a missing metadata location.
Policy validation and documentation
crates/lakekeeper-integration-tests/tests/openfga_write_data.rs, authz/openfga/README.md, authz/openfga/v4.15/components/lakekeeper_table.fga, docs/docs/authorization-openfga.md
Integration tests cover empty commits, staged-table permissions, batch checks, and transaction behavior. The OpenFGA and authorization documentation describes the commit requirements.

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

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant tables
  participant commit_action
  participant OpenFGA
  tables->>commit_action: Build action from table updates
  commit_action-->>tables: Return commit action and complete update listing
  tables->>OpenFGA: Check requested action and any_commit for staged tables
  OpenFGA-->>tables: Return authorization result
Loading

Possibly related PRs

  • lakekeeper/lakekeeper#2115: Introduced the separate data-write privilege and can_commit_data classification refined here.
  • lakekeeper/lakekeeper#2228: Renamed the data-write privilege to write_data and established model v4.15, whose commit authorization this change updates.
  • lakekeeper/lakekeeper#2229: Changes processing for table commits with no metadata changes; this PR changes authorization for commits without updates.

Suggested reviewers: brgr-s

Merge Risk: Minimal · up to 408e0

No merge-blocking authorization issue was established; the change is ready for normal merge checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 53.85% 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 summarizes both main authorization changes: data-only commits without updates are allowed by write_data, and commits to staged tables require modify. It contains a minor typo in “ast…
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: Title check

Explanation

The title clearly summarizes both main authorization changes: data-only commits without updates are allowed by write_data, and commits to staged tables require modify. It contains a minor typo in “astaged,” but remains understandable.

Full details: Docstring Coverage

Explanation

Docstring coverage is 53.85% 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 13 functions across 12 files. (3 skipped: 3 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 commit trail,
With staged tables marked without fail.
Empty updates hop through the gate,
While changed schemas must wait.
Then carrots celebrate the state.

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
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: 3a5b3a3b-41f2-4887-8cde-d4f6eace736b
Commits

Reviewing files that changed from the base of the PR and between 19d3d35 and 408e052.

Files selected for processing: 15
  • authz/openfga/README.md
  • authz/openfga/v4.15/components/lakekeeper_table.fga
  • crates/authz-openfga/src/authorizer.rs
  • crates/authz-openfga/src/relations.rs
  • crates/lakekeeper-integration-tests/tests/management_check.rs
  • crates/lakekeeper-integration-tests/tests/openfga_write_data.rs
  • crates/lakekeeper/src/api/management/v1/check.rs
  • crates/lakekeeper/src/server/commit_tables.rs
  • crates/lakekeeper/src/server/tables.rs
  • crates/lakekeeper/src/service/authz/mod.rs
  • crates/lakekeeper/src/service/catalog_store.rs
  • crates/lakekeeper/src/service/catalog_store/table.rs
  • crates/lakekeeper/src/service/catalog_store/tabular.rs
  • crates/lakekeeper/src/service/events/backends/audit/tests.rs
  • docs/docs/authorization-openfga.md

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

@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

✅ PR Title Formatted Correctly

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

@c-thiel
c-thiel enabled auto-merge (squash) November 3, 2026 19:40
@c-thiel
c-thiel merged commit 7b1e679 into main Nov 3, 2026
85 of 87 checks passed
@c-thiel
c-thiel deleted the christian/data-only-empty-commits branch November 3, 2026 22:20
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