Skip to content

fix warning about chain DB migration in bootstrap#1062

Merged
jeluard merged 2 commits into
mainfrom
rk/warn-db
Jul 20, 2026
Merged

fix warning about chain DB migration in bootstrap#1062
jeluard merged 2 commits into
mainfrom
rk/warn-db

Conversation

@rkuhn

@rkuhn rkuhn commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

fixes #1060

also removes --force option as per EDR 19

Summary by CodeRabbit

  • Breaking Changes

    • Removed the --force option from node bootstrap and snapshot creation commands.
    • Bootstrap now stops with a warning when chain or ledger directories already exist; remove them manually before retrying.
  • Bug Fixes

    • New chain databases are created directly at the current schema version, avoiding unnecessary migration warnings.
  • Documentation

    • Updated changelog, trace documentation, and operational guidance to reflect the revised bootstrap behavior.

rkuhn added 2 commits July 19, 2026 16:23
Signed-off-by: Roland Kuhn <rk@rkuhn.info>
Signed-off-by: Roland Kuhn <rk@rkuhn.info>
@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Bootstrap now refuses to overwrite existing chain or ledger directories, removes the --force option and related trace events, creates new chain databases at the current schema version, and updates automation, documentation, and changelog entries.

Changes

Bootstrap safety and database initialization

Layer / File(s) Summary
Current-version chain database initialization
crates/amaru-stores/..., crates/amaru/src/bootstrap/mod.rs, crates/amaru-stores/.../tests.rs, engineering-decision-records/...
New or empty chain directories are created directly at CHAIN_DB_VERSION; existing databases continue through migration, with tests covering absent and empty paths.
Bootstrap refusal and trace contracts
crates/amaru/src/bin/.../bootstrap.rs, crates/amaru-observability/src/schemas.rs, docs/TRACES.md, docs/traces-schema.json
The CLI removes --force, reports existing directories as errors, and updates public trace schemas from forced removal to existence hints.
Automation and release updates
scripts/refresh-from-mithril, .github/workflows/..., CHANGELOG.md
Bootstrap and snapshot commands stop passing --force, and the unreleased changelog records the CLI and database changes.

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

Possibly related PRs

Suggested reviewers: etorreborre, ktorz, yhsj

Poem

No force flag rides into the night,
Old folders now must quit the fight.
Fresh chains wake at version-new,
Snapshots follow the safer cue.
Traces hum, migrations rest—
Bootstrap plays its careful best.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: fixing the chain DB migration warning during bootstrap.
Linked Issues check ✅ Passed The changes create the chain DB at the current version during bootstrap and remove the misleading migration path, matching #1060.
Out of Scope Changes check ✅ Passed The docs, changelog, tests, and --force removals all support the bootstrap DB change and do not look out of scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch rk/warn-db

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

Comment @coderabbitai help to get the list of available commands.

@rkuhn rkuhn self-assigned this Jul 19, 2026
@rkuhn

rkuhn commented Jul 19, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

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.

🧹 Nitpick comments (1)
crates/amaru/src/bin/amaru/cmd/node/bootstrap.rs (1)

17-20: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Reorder imports to group external crates before workspace crates.

G'day mate! What's the craic? Looks like the import order got a wee bit scrambled here. Just like trying to organize your inventory in Resident Evil 4, we gotta slot the items in the exact right spot to keep things tidy!

As per the coding guidelines, imports must follow the order: std, external crates, workspace/project crates, and finally self/super/crate. clap is an external crate, so it should sit right above the amaru* workspace imports. Defo an easy fix to keep the codebase lookin' fresh.

📦 Proposed import reordering
-use amaru::{bootstrap::bootstrap, default_chain_dir, default_ledger_dir};
-use amaru_kernel::{Epoch, GlobalParameters, NetworkName, utils::path::relative_path};
-use amaru_observability::{info, warn};
-use clap::Parser;
+use clap::Parser;
+
+use amaru::{bootstrap::bootstrap, default_chain_dir, default_ledger_dir};
+use amaru_kernel::{Epoch, GlobalParameters, NetworkName, utils::path::relative_path};
+use amaru_observability::{info, warn};
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/amaru/src/bin/amaru/cmd/node/bootstrap.rs` around lines 17 - 20,
Reorder the imports so the external crate import `use clap::Parser;` appears
before the workspace imports from `amaru`, `amaru_kernel`, and
`amaru_observability`, preserving the existing imports and grouping order.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@crates/amaru/src/bin/amaru/cmd/node/bootstrap.rs`:
- Around line 17-20: Reorder the imports so the external crate import `use
clap::Parser;` appears before the workspace imports from `amaru`,
`amaru_kernel`, and `amaru_observability`, preserving the existing imports and
grouping order.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 837c39a0-1096-4419-9665-fd5db91cfe16

📥 Commits

Reviewing files that changed from the base of the PR and between d90299f and 702d6a4.

📒 Files selected for processing (11)
  • .github/workflows/publish-bootstrap-snapshots.yml
  • CHANGELOG.md
  • crates/amaru-observability/src/schemas.rs
  • crates/amaru-stores/src/rocksdb/consensus/rocksdb_store.rs
  • crates/amaru-stores/src/rocksdb/consensus/tests.rs
  • crates/amaru/src/bin/amaru/cmd/node/bootstrap.rs
  • crates/amaru/src/bootstrap/mod.rs
  • docs/TRACES.md
  • docs/traces-schema.json
  • engineering-decision-records/017-version-and-migrate-db.md
  • scripts/refresh-from-mithril
💤 Files with no reviewable changes (3)
  • .github/workflows/publish-bootstrap-snapshots.yml
  • crates/amaru-observability/src/schemas.rs
  • docs/traces-schema.json

@jeluard
jeluard merged commit c6c3619 into main Jul 20, 2026
22 checks passed
@jeluard
jeluard deleted the rk/warn-db branch July 20, 2026 07:27
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.

don’t migrate chain DB upon bootstrap, just create current version

2 participants