Skip to content

Simplify formatting, tests, and CI - #50

Merged
HDauven merged 6 commits into
mainfrom
cleanup/simplify-tests-ci
Aug 25, 2026
Merged

HDauven merged 6 commits into
mainfrom
cleanup/simplify-tests-ci

Conversation

@HDauven

@HDauven HDauven commented Aug 23, 2026 •

Copy link
Copy Markdown
Member

Summary

  • simplify generated hex formatting and remove an unused direct dependency
  • replace repetitive test matrices with explicit bidirectional golden vectors
  • add missing parsing and runtime-versus-const fixtures
  • run the existing checks through one CI target to avoid repeated runner setup

The resulting diff removes 166 net lines. Line coverage rises from 86.4% to 92.8%, region coverage from 88.9% to 95.0%, and function coverage reaches 100%.

Copilot AI 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.

Pull request overview

This PR streamlines hex formatting code generation in derive-hex, refactors tests to use clearer golden vectors/fixtures, and consolidates CI into a single Makefile target to reduce repeated runner setup in this foundational serialization workspace.

Changes:

  • Simplify generated LowerHex/UpperHex formatting loops and drop an unnecessary direct dependency in derive-hex.
  • Replace repetitive primitive test matrices with explicit bidirectional golden vectors; add parsing and const-vs-runtime fixtures.
  • Collapse multiple CI jobs into a single reusable-workflow invocation that runs a unified make ci target.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Makefile Adds a ci target that runs quality, tests, no-std build, and docs in one go.
dusk-bytes/tests/serialize_test.rs Refactors primitive serialization tests into golden vectors and reduces repetition.
dusk-bytes/tests/parse_test.rs Adds coverage for length/invalid-char errors, uppercase hex parsing, and const-vs-runtime fixtures.
derive-hex/tests/hex_test.rs Consolidates formatting assertions into a single test.
derive-hex/src/lib.rs Simplifies generated formatting loops and adjusts HexDebug internals.
derive-hex/Cargo.toml Removes the direct proc-macro2 dependency.
.github/workflows/dusk_ci.yml Replaces multiple jobs with a single job invoking make ci.
Suppressed comments (2)

derive-hex/src/lib.rs:38

  • Same hygiene concern as the LowerHex impl: prefer absolute ::core:: paths and qualify ::core::write! so the generated code cannot be broken by name shadowing in downstream crates.
        impl core::fmt::UpperHex for #ident {
            fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
                if f.alternate() {
                    write!(f, "0x")?
                }

                for byte in self.to_bytes() {
                    write!(f, "{byte:02X}")?
                }

derive-hex/src/lib.rs:66

  • The generated Debug impl also uses non-absolute core:: paths. Using ::core:: avoids downstream name shadowing and keeps the proc-macro output more robust.
    impl core::fmt::Debug for #ident {
        fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
            // `Formatter` does not publicly expose the debug-hex case. Bit 5 is
            // `FlagV1::DebugUpperHex` in `core`:
            // <https://github.com/rust-lang/rust/blob/90442458ac46b1d5eed752c316da25450f67285b/library/core/src/fmt/mod.rs#L1817-L1825>
            const DEBUG_UPPER_HEX: u32 = 1 << 5;

            #[allow(deprecated)]
            if f.flags() & DEBUG_UPPER_HEX != 0 {
                core::fmt::UpperHex::fmt(self, f)
            } else { // LowerHex is always the default for debug
                core::fmt::LowerHex::fmt(self, f)
            }

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread derive-hex/src/lib.rs
Comment thread .github/workflows/dusk_ci.yml
@HDauven
HDauven force-pushed the cleanup/simplify-tests-ci branch from 44e7231 to b6e8eb2 Compare August 25, 2026 10:49
@HDauven
HDauven marked this pull request as ready for review August 25, 2026 10:49
@HDauven
HDauven force-pushed the cleanup/simplify-tests-ci branch from b6e8eb2 to 54becce Compare August 25, 2026 11:00
@HDauven
HDauven merged commit ac45b6d into main Aug 25, 2026
1 check passed
@HDauven
HDauven deleted the cleanup/simplify-tests-ci branch August 25, 2026 11:11
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.

3 participants