Skip to content

client-cli: merge cardano-database-v2 command into 'v1' command #2547

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Jun 10, 2025

Conversation

Alenar
Copy link
Collaborator

@Alenar Alenar commented Jun 4, 2025

Content

This PR merge in the client-cli the cardano-database-v2 command into the 'v1' cardano-database command, instead a new option is added in order to switch the backend: --backend [v1,v2].

Changes

mithril-client-cli

  • cardano-database:
    • all sub-commands:
      • add option --backend with two values, v1 and v2
      • when using backend v2 the --unstable option is still mandatory, if missing the command stop with the usual warning message
    • download sub-command:
      • add options --start {number}, --end {number}, and --allow-override: taken from the cardano-database-v2 command, ignored with a warning if the backend is not set to v2
      • reworked fast boostrap warning messages when printing in json in order to print a json structure instead of a multiline string
  • cardano-database-v2:
    • deprecated, a warning is print asking to use cardano-db command instead and pass the --backend v2 parameter
    • all codes have been moved to the cardano-database command, existing command are now only a indirection to the cardano-database with a forced v2 backend
  • other changes:
    • move unstable warning message creation from main to CommandContext to re-use it in sub-commands
    • enhance DeprecatedCommand system to support old command alias and printing of additional message

Pre-submit checklist

  • Branch
    • Tests are provided (if possible)
    • Crates versions are updated (if relevant)
    • CHANGELOG file is updated (if relevant)
    • Commit sequence broadly makes sense
    • Key commits have useful messages
  • PR
    • All check jobs of the CI have succeeded
    • Self-reviewed the diff
    • Useful pull request description
    • Reviewer requested
  • Documentation
    • Update documentation website (if relevant)
    • No new TODOs introduced

Issue(s)

Relates to #2493

@Alenar Alenar self-assigned this Jun 4, 2025
Copy link

github-actions bot commented Jun 4, 2025

Test Results

    3 files  ±0     77 suites  ±0   15m 44s ⏱️ + 1m 18s
1 996 tests +3  1 996 ✅ +3  0 💤 ±0  0 ❌ ±0 
3 454 runs  +9  3 454 ✅ +9  0 💤 ±0  0 ❌ ±0 

Results for commit 135710c. ± Comparison against base commit 475051c.

♻️ This comment has been updated with latest results.

@Alenar Alenar force-pushed the djo/2493/merge-cdb-v1-v2-in-client-cli branch from 703b404 to fa06a11 Compare June 4, 2025 16:24
@Alenar Alenar marked this pull request as ready for review June 4, 2025 16:25
Copilot

This comment was marked as outdated.

@Alenar Alenar temporarily deployed to testing-preview June 4, 2025 16:33 — with GitHub Actions Inactive
@Alenar Alenar force-pushed the djo/2493/merge-cdb-v1-v2-in-client-cli branch from fa06a11 to f4f42be Compare June 5, 2025 08:10
@Alenar Alenar temporarily deployed to testing-preview June 5, 2025 08:19 — with GitHub Actions Inactive
Copy link
Member

@jpraynaud jpraynaud left a comment

Choose a reason for hiding this comment

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

LGTM 🔥

@Alenar Alenar force-pushed the djo/2493/merge-cdb-v1-v2-in-client-cli branch 2 times, most recently from a141119 to aafcb05 Compare June 5, 2025 09:53
Copy link
Collaborator

@dlachaume dlachaume left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@Alenar Alenar force-pushed the djo/2493/merge-cdb-v1-v2-in-client-cli branch 2 times, most recently from 8daa5dc to d775bfb Compare June 6, 2025 09:29
Alenar added 10 commits June 6, 2025 11:33
Using the new `--backend` parameter to allow to switch to `v2` (default
to `v1`).
V2 command still exist but call 'v1' code to avoid duplication.
for a cleaner separation between v1 and v2 code as there's much more
code for that command in comparaison to `show` and `list`
Using the new `--backend` parameter to allow to switch to `v2` (default
to `v1`).
V2 command still exist but call 'v1' code to avoid duplication.
+ print thoses messages to stderr instead of stdout
+ move them from utils to the `cardano-db` command since there's now
  only one place were thoses messages must be print.
Alenar added 3 commits June 6, 2025 11:39
…ep` mod

Two steps affected:
- `fetch_certificate_and_verifying_chain`: unchanged, the code was
  identical
- `log_download_information`: changed to make the function parameters
  agnostics to the snapshot types.
@Alenar Alenar force-pushed the djo/2493/merge-cdb-v1-v2-in-client-cli branch from d775bfb to 0ce8ee5 Compare June 6, 2025 09:40
@Alenar Alenar temporarily deployed to testing-preview June 6, 2025 09:49 — with GitHub Actions Inactive
Copy link
Collaborator

@turmelclem turmelclem left a comment

Choose a reason for hiding this comment

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

LGTM 🐴

@Alenar Alenar force-pushed the djo/2493/merge-cdb-v1-v2-in-client-cli branch from 0ce8ee5 to eb5306c Compare June 6, 2025 12:22
@Alenar Alenar requested a review from Copilot June 6, 2025 12:25
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR merges the previously separate cardano-database-v2 command into the cardano-database command via the new --backend option, deprecating the old cardano-db-v2 subcommand.

  • Migrate v2 functionality into the existing cardano-database command with a new --backend [v1,v2] option
  • Enforce that backend v2 usage requires the --unstable flag while maintaining legacy behavior for v1
  • Update warning messages, deprecation handling, documentation, and tests accordingly

Reviewed Changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/utils/mod.rs Added a JSON CAUTION key constant for structured warning messages
src/utils/cardano_db.rs Removed AncillaryLogMessage and updated warning message handling
src/main.rs Updated command handling to enforce unstable flag for v2 backend and print deprecation messages
src/commands/deprecation.rs Enhanced deprecation message formatting to include additional messages and aliases
src/commands/cardano_db/* Refactored the Cardano database commands to support the new --backend option (v1 default, v2 unstable)
docs/website/... Updated documentation to reflect deprecation of cardano-db-v2 and instructions for using --backend
Comments suppressed due to low confidence (1)

mithril-client-cli/src/commands/cardano_db/show.rs:47

  • [nitpick] Consider refactoring the common logic shared between the print_v1 and print_v2 methods into a helper function to reduce code duplication and simplify future maintenance.
match self.backend { CardanoDbCommandsBackend::V1 => self.print_v1(client).await?, CardanoDbCommandsBackend::V2 => self.print_v2(client).await?, }

@Alenar Alenar temporarily deployed to testing-preview June 6, 2025 12:31 — with GitHub Actions Inactive
@Alenar Alenar force-pushed the djo/2493/merge-cdb-v1-v2-in-client-cli branch from eb5306c to 1e2e5ee Compare June 6, 2025 12:50
@Alenar Alenar temporarily deployed to testing-preview June 6, 2025 13:00 — with GitHub Actions Inactive
@Alenar Alenar force-pushed the djo/2493/merge-cdb-v1-v2-in-client-cli branch from 1e2e5ee to 58e31fb Compare June 6, 2025 13:20
@Alenar Alenar temporarily deployed to testing-preview June 6, 2025 13:31 — with GitHub Actions Inactive
@Alenar Alenar force-pushed the djo/2493/merge-cdb-v1-v2-in-client-cli branch from 58e31fb to e1125dc Compare June 6, 2025 13:47
@Alenar Alenar temporarily deployed to testing-preview June 6, 2025 13:56 — with GitHub Actions Inactive
@Alenar Alenar force-pushed the djo/2493/merge-cdb-v1-v2-in-client-cli branch from e1125dc to a628374 Compare June 6, 2025 13:58
@Alenar Alenar temporarily deployed to testing-preview June 6, 2025 14:07 — with GitHub Actions Inactive
@Alenar Alenar force-pushed the djo/2493/merge-cdb-v1-v2-in-client-cli branch from a628374 to 45180d5 Compare June 6, 2025 14:20
@Alenar Alenar temporarily deployed to testing-preview June 6, 2025 14:31 — with GitHub Actions Inactive
@Alenar Alenar force-pushed the djo/2493/merge-cdb-v1-v2-in-client-cli branch from 45180d5 to f653b40 Compare June 6, 2025 14:43
Alenar added 3 commits June 6, 2025 16:52
…k space

we need to free disk space to avoid hitting the limit of 14Go on github
hosted runners.
* mithril-client-cli from `0.12.8` to `0.12.9`
@Alenar Alenar force-pushed the djo/2493/merge-cdb-v1-v2-in-client-cli branch from f653b40 to 135710c Compare June 6, 2025 14:52
@Alenar Alenar temporarily deployed to testing-preview June 6, 2025 15:03 — with GitHub Actions Inactive
@Alenar Alenar merged commit 017d0dd into main Jun 10, 2025
44 of 57 checks passed
@Alenar Alenar deleted the djo/2493/merge-cdb-v1-v2-in-client-cli branch June 10, 2025 07:48
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.

4 participants