Skip to content

Deprecate the read-only accessors behind experimental-pre-api-5-deprecations - #1307

Closed
cberner wants to merge 1 commit into
masterfrom
claude/readonly-table-get-txn-lifetime-rat7vl
Closed

cberner wants to merge 1 commit into
masterfrom
claude/readonly-table-get-txn-lifetime-rat7vl

Conversation

@cberner

@cberner cberner commented Aug 4, 2026 •

Copy link
Copy Markdown
Owner

Follow-up to #1306 and #1343.

Change

Marks ReadOnlyTable::get(), ReadOnlyTable::range(), ReadOnlyMultimapTable::get(), and ReadOnlyMultimapTable::range() deprecated behind a new experimental-pre-api-5-deprecations feature. Contrary to their documentation, the 'static access guards these methods return, or yield, do not keep the transaction alive on their own. What holds it open is the ReadOnlyTable, which owns a clone of the TransactionGuard, together with the iterators and MultimapValues, which own clones of their own. A guard that outlives all of them lets a concurrent writer reclaim the pages it references, which panics the writer's commit() on a debug assertion. The doc comments are corrected to describe the actual behavior, including which objects a guard must not outlive.

Because the attribute is behind an opt-in feature, default builds stay warning-free for the rest of 4.x. Users who enable it get pointed at the replacements: the ReadableTable / ReadableMultimapTable trait accessors, whose guards borrow from the table so that the compiler enforces the lifetime, or the _owned() variants if the guards need to keep the transaction alive on their own.

experimental-api-5 already removes these methods outright, so the deprecation only applies to builds that enable the deprecations feature without the redb 5 preview — under --all-features (CI) the removal wins and the attribute is moot. Method bodies are untouched.

The pre-existing tests that exercise the deprecated accessors keep doing so, so the methods stay covered until they are removed. The suites built throughout on them carry a crate-level allow(deprecated) gated on all(feature = "experimental-pre-api-5-deprecations", not(feature = "experimental-api-5")), and the handful of incidental reads elsewhere carry a function-level #[allow(deprecated)], so unrelated deprecations are still reported in every configuration. The redb-derive test targets cannot use that gate, since feature = "..." there resolves against redb-derive's own features, so they use the function-level form.

Testing

  • Full suite passes with --all-features (475 tests)
  • fmt is clean, and clippy is clean under --deny warnings in four configurations: default, experimental-pre-api-5-deprecations, experimental-api-5, and --all-features
  • The deprecations-only combination is now deny-clean, which it was not previously

🤖 Generated with Claude Code

https://claude.ai/code/session_01YCYPuM4nb94pF36ZX7R8sa

@codecov

codecov Bot commented Aug 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.58%. Comparing base (4e6bb90) to head (57b5c97).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1307      +/-   ##
==========================================
+ Coverage   91.48%   91.58%   +0.10%     
==========================================
  Files          39       39              
  Lines       20050    20050              
==========================================
+ Hits        18342    18363      +21     
+ Misses       1708     1687      -21     
Files with missing lines Coverage Δ
src/multimap_table.rs 94.74% <ø> (ø)
src/table.rs 83.77% <ø> (ø)
src/transactions.rs 89.45% <ø> (ø)
src/tree_store/page_store/header.rs 96.32% <ø> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cberner
cberner force-pushed the claude/readonly-table-get-txn-lifetime-rat7vl branch from 0efc210 to 563b62c Compare August 4, 2026 21:05

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0efc210e5c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/table.rs Outdated
@cberner
cberner force-pushed the claude/readonly-table-get-txn-lifetime-rat7vl branch 3 times, most recently from 11fe58d to c9005ab Compare August 9, 2026 03:11
@cberner cberner changed the title Deprecate the read-only accessors that do not keep the transaction alive Deprecate the read-only accessors behind experimental-pre-api-5-deprecations Aug 9, 2026
@cberner
cberner force-pushed the claude/readonly-table-get-txn-lifetime-rat7vl branch from c9005ab to 7f84f54 Compare August 9, 2026 04:05
@cberner
cberner force-pushed the claude/readonly-table-get-txn-lifetime-rat7vl branch from 7f84f54 to be9b19c Compare August 9, 2026 14:24

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: be9b19c03e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread Cargo.toml
@cberner
cberner force-pushed the claude/readonly-table-get-txn-lifetime-rat7vl branch from be9b19c to d5233fb Compare August 23, 2026 04:01

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d5233fb1b6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/table.rs Outdated
Comment thread src/multimap_table.rs Outdated
Comment thread tests/basic_tests.rs Outdated
@cberner
cberner force-pushed the claude/readonly-table-get-txn-lifetime-rat7vl branch from d5233fb to 467255b Compare August 23, 2026 04:20

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 467255b700

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/table.rs Outdated
…cations

The inherent ReadOnlyTable::get(), ReadOnlyTable::range(),
ReadOnlyMultimapTable::get(), and ReadOnlyMultimapTable::range() hand out
'static AccessGuards that, contrary to their documentation, do not keep
the read transaction alive on their own. What holds it open is the
ReadOnlyTable, which owns a clone of the TransactionGuard, together with
the iterators and MultimapValues, which own clones of their own. A guard
that outlives all of them lets a concurrent writer reclaim the pages it
references, which panics the writer's commit() on a debug assertion.

Mark them deprecated behind the new experimental-pre-api-5-deprecations
feature, so default builds stay warning-free for the rest of 4.x while
users who opt in get pointed at the replacements: the Readable* trait
accessors, whose guards borrow from the table so that the compiler
enforces the lifetime, or the _owned() variants if the guards need to
keep the transaction alive on their own. The doc comments are corrected
to describe the actual behavior, including which objects a guard must
not outlive. The experimental-api-5 feature already removes these
methods outright, so the deprecation only applies to builds that enable
the deprecations feature without the redb 5 preview.

The pre-existing tests that exercise the deprecated accessors keep doing
so, so the methods stay covered until they are removed. The suites built
throughout on them carry a crate-level allow(deprecated) gated on the
feature combination that deprecates them, and the handful of incidental
reads elsewhere carry a function-level allow, so unrelated deprecations
are still reported in every configuration.

Assisted-by: Claude Code
@cberner
cberner force-pushed the claude/readonly-table-get-txn-lifetime-rat7vl branch from 467255b to 57b5c97 Compare August 23, 2026 04:29
@cberner cberner closed this Sep 21, 2026
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