Skip to content

feat!: update to latest 1.0.0-rc.0 deps and redb@4#100

Merged
dignifiedquire merged 4 commits into
mainfrom
feat-iroh-rc-0
May 8, 2026
Merged

feat!: update to latest 1.0.0-rc.0 deps and redb@4#100
dignifiedquire merged 4 commits into
mainfrom
feat-iroh-rc-0

Conversation

@dignifiedquire
Copy link
Copy Markdown
Contributor

No description provided.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh-docs/pr/100/docs/iroh_docs/

Last updated: 2026-05-08T17:06:49Z

Comment thread src/api/actor.rs Outdated
use irpc::{channel::mpsc, LocalSender, WithChannels};
use n0_future::task::{self};
use n0_future::{
task::{self},
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.

Weird import. Isn't that just n0_future::task?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

lol, yeah

@dignifiedquire dignifiedquire merged commit d4092bf into main May 8, 2026
24 of 25 checks passed
@dignifiedquire dignifiedquire deleted the feat-iroh-rc-0 branch May 8, 2026 17:15
cbenhagen added a commit to cbenhagen/iroh-docs that referenced this pull request May 29, 2026
Stores written by iroh-docs 0.94..=0.98 (redb 2.6) carry the old
on-disk type tag for variable-width tuples on records-1,
records-by-key-1, and latest-by-author-1. Opening them under 0.99+
(redb 4) fails with TableTypeMismatch because the 2 to 4 jump in
n0-computer#100 skipped the redb 3.x Legacy<...> migration window.

When Store::persistent hits TableTypeMismatch, open the file with
redb 3 via Legacy wrappers on the three affected tables, copy
everything into a fresh redb 3 file with plain tuple types, and
swap files. The original is preserved at
<path>.backup-redb-v2-tuples. redb 4 then opens the result.

Closes n0-computer#104
cbenhagen added a commit to cbenhagen/iroh-docs that referenced this pull request May 29, 2026
Stores written by iroh-docs 0.94..=0.98 (redb 2.6) carry the old
on-disk type tag for variable-width tuples on records-1,
records-by-key-1, and latest-by-author-1. Opening them under 0.99+
(redb 4) fails with TableTypeMismatch because the 2 to 4 jump in
n0-computer#100 skipped the redb 3.x Legacy<...> migration window.

When Store::persistent hits TableTypeMismatch, open the file with
redb 3 via Legacy wrappers on the three affected tables, copy
everything into a fresh redb 3 file with plain tuple types, and
swap files. The original is preserved at
<path>.backup-redb-v2-tuples. redb 4 then opens the result.

Closes n0-computer#104
Frando pushed a commit that referenced this pull request Jun 1, 2026
## Description

Fixes #104.

Stores created or opened by iroh-docs 0.94 through 0.98 (redb 2.6)
cannot be opened under 0.99+ (redb 4): `Tables::new` fails with
`TableTypeMismatch` on `records-1`, `records-by-key-1`, and
`latest-by-author-1`. The issue write-up has the full root cause
analysis. In short, redb 3.0 changed the on-disk type tag for
variable-width tuples, and #100 jumped from redb 2.6 straight to redb
4.1, skipping the redb 3.x release line where the documented
`Legacy<...>` migration would have run. By the time a user is on 0.99+,
the migration window is closed inside any release pinned to redb 4
(which dropped the `Legacy` type entirely).

This PR keeps redb 4.1 as the primary dependency and adds redb 3.1
alongside it for the one job that requires it. When `Store::persistent`
sees a `TableTypeMismatch` from the initial `Tables::new`, it:

1. Opens the file with redb 3.
2. Reads the three affected tables through `Legacy<...>` wrappers (which
match the redb 2.6 stamping).
3. Copies every table into a fresh redb 3 file at a temp path in the
same directory, using plain tuple types on the write side. That commit
re-stamps the metadata as `Internal2`.
4. Renames the original to `<path>.backup-redb-v2-tuples` and persists
the temp file in its place.

redb 4 then opens the result normally and the existing data migrations
(`migrations::run_migrations`) run as before.

Changes:

- `Cargo.toml`: add `redb_v3 = { package = "redb", version = "3.1" }`.
- `src/store/fs/migrate_redb_v2_tuples.rs` (new): migration logic. Uses
the same `migrate_table!` / `migrate_multimap_table!` macro style as the
existing `migrate_v1_v2.rs`.
- `src/store/fs.rs`: `Store::persistent` catches
`TableError::TableTypeMismatch` from `new_impl`, runs the migration, and
retries once.
- Tests: one synthesises a redb 2.x-shaped file by writing through
`Legacy<...>` with redb 3, then asserts (a) redb 4 rejects it before
migration, (b) `Store::persistent` succeeds, (c) the backup file is
created, and (d) all rows survive when read back with redb 4 plain
types. A second test asserts a fresh open never creates a backup file.

## Breaking Changes

None for users already on 0.99+. Users coming from 0.94..=0.98 will see
their original file renamed to `<path>.backup-redb-v2-tuples` on first
open. The new file at the original path holds the same data.

## Notes & open questions

- redb 3 needs to ship as long as we want to migrate stores written by
0.94..=0.98 directly. Dropping the dependency later means those users
would have to install an intermediate iroh-docs release first.
- The fixed-width tuple tables (`namespaces-2`, `sync-peers-1`) are not
affected, because variable-width tuples are the only thing redb 3
changed the tag for. The migration still copies them so the resulting
file is a clean redb 3 write top to bottom.

## Change checklist

- [x] Self-review.
- [ ] Documentation updates following the [style
guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text),
if relevant.
- [x] Tests if relevant.
- [x] All breaking changes documented.
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.

2 participants