Skip to content

Conversation

@Alenar
Copy link
Collaborator

@Alenar Alenar commented Jul 21, 2025

Content

This PR add a new Dummy trait in mithril-common that supersede and standardize the previous pub fn dummy() methods that are scattered across the codebase.

Implementations of this traits are placed in crates test module (or test-utils for common) when all implementers members are public which is almost always the case, if they have not public members implementations are placed below the implementers types.

This PR also add a dev-adr to specify how dummies should be added to the project.

Pre-submit checklist

  • Branch
    • 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
    • Add ADR blog post or Dev ADR entry (if relevant)
    • No new TODOs introduced

Issue(s)

Relates to #2580

@Alenar Alenar self-assigned this Jul 21, 2025
Copy link

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 introduces a standardized Dummy trait in mithril-common to replace scattered pub fn dummy() methods across the codebase, centralizing test double creation and improving code organization.

  • Adds a new Dummy trait for standardized test double creation
  • Migrates all existing dummy() methods to implement the new trait
  • Establishes clear placement guidelines for test doubles based on type visibility

Reviewed Changes

Copilot reviewed 131 out of 132 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
mithril-common/src/test_utils/double/mod.rs Introduces the new Dummy trait definition
mithril-common/src/test_utils/double/dummies.rs Implements Dummy for entities and messages in a centralized location
Multiple entity/message files Removes old dummy() methods and adds Dummy trait imports
Multiple test files Updates imports to use the new test_utils::double::Dummy
DEV-ADR.md Adds architectural decision record for dummy test double guidelines

@github-actions
Copy link

github-actions bot commented Jul 21, 2025

Test Results

    4 files  ±0    154 suites  ±0   22m 44s ⏱️ -6s
2 118 tests ±0  2 118 ✅ ±0  0 💤 ±0  0 ❌ ±0 
6 466 runs  ±0  6 466 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit dd5d4b8. ± Comparison against base commit 890801c.

♻️ This comment has been updated with latest results.

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 🚀

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 👍

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 added 6 commits July 22, 2025 11:14
A trait similar to the standard `Default` but dedicated to dummy test
double creation.
and, when applicable, move the `Dummy` impl to a `test::double::dummies`
module.
* mithril-cardano-node-chain from `0.1.4` to `0.1.5`
* mithril-dmq from `0.1.4` to `0.1.5`
* mithril-era from `0.1.2` to `0.1.3`
* mithril-signed-entity-preloader from `0.0.7` to `0.0.8`
* mithril-api-spec from `0.1.1` to `0.1.2`
* mithril-aggregator from `0.7.74` to `0.7.75`
* mithril-client-cli from `0.12.22` to `0.12.23`
* mithril-client from `0.12.22` to `0.12.23`
* mithril-common from `0.6.9` to `0.6.10`
* mithril-relay from `0.1.47` to `0.1.48`
* mithril-signer from `0.2.260` to `0.2.261`
@Alenar Alenar force-pushed the djo/2580/refactor-common-dummies branch from 475ef3d to dd5d4b8 Compare July 22, 2025 09:14
@Alenar Alenar temporarily deployed to testing-preview July 22, 2025 09:24 — with GitHub Actions Inactive
@Alenar Alenar merged commit b76f911 into main Jul 22, 2025
41 checks passed
@Alenar Alenar deleted the djo/2580/refactor-common-dummies branch July 22, 2025 09:25
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.

5 participants