Skip to content

refactor: derive mechanical Debug implementations in first batch - #973

Open
martintmk wants to merge 15 commits into
mainfrom
martintmk-debug-derives-batch-1
Open

martintmk wants to merge 15 commits into
mainfrom
martintmk-debug-derives-batch-1

Conversation

@martintmk

@martintmk martintmk commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Summary

Replace 15 field-based Debug implementations with derive_more::Debug across seven packages. Include printable fields and retain useful custom views, with the user-approved exceptions below. DispatcherClient prints worker count instead of the shared runtime tree. DriverHost omits owner_waker to avoid printing its data and vtable addresses. TaskList omits head and tail to avoid printing task-allocation addresses. The ten-package audit leaves anyspawn, bytesbuf_io, and cachet_memory unchanged because their implementations need custom presentation or generic handling.

  • This is an automated mechanical PR for allocation_hints.
  • This is an automated mechanical PR for anyspawn.
  • This is an automated mechanical PR for arty.
  • This is an automated mechanical PR for arty_executor.
  • This is an automated mechanical PR for arty_io_host.
  • This is an automated mechanical PR for bytesbuf.
  • This is an automated mechanical PR for bytesbuf_io.
  • This is an automated mechanical PR for cachet.
  • This is an automated mechanical PR for cachet_memory.
  • This is an automated mechanical PR for cachet_tier.

Evidence

Fourteen root assertions cover the migrated implementations and the bounded dispatcher view through fourteen .snap files. Ten assertions use public integration tests. Four use unit tests for private views. Root snapshots include nested views without duplicate assertions. Filters replace incidental addresses, identity values, and one toolchain-dependent internal Rc path. Snapshot tests are ignored under Miri as requested. Existing behavior tests retain their Miri coverage.

Current head a1ec684591b5dff3f4997a695fb0615af475aac8 merges main at 2dc2073b219b30c2fa368ad08e9f01b38386d72a without conflicts. Five CI failures on preceding head ac778e774 share one executor snapshot mismatch. Main changed PanicPolicy from an enum to a wrapper, so its derived output is now PanicPolicy(Shutdown). The snapshot now expects that exact representation. The mutation job failed its baseline on the same assertion, before mutation testing started. Production behavior and the assertion remain intact.

On the merged source, cargo test -p arty_executor --test lifecycle debug_snapshot passed both tests. cargo test -p arty --test io io_debug_snapshot passed. cargo check -p arty_executor -p arty passed. The diff against main passes the whitespace check. The staged merge also contains an upstream-only README blank line at EOF, left unchanged. CI is pending for this head. No workflow retry, coverage suppression, or gate change was made.

Earlier focused checks passed for the approved DriverHost and TaskList omissions. Executor snapshots use explicit names that passed under both module layouts. Earlier package checks and focused Debug tests also passed across the seven changed packages with cachet/test-util. Those earlier results do not replace current-head CI. Historical Codecov diagnostics identified five missed lines in unchanged macro entry points outside this batch. No coverage policy changes or suppressions were added.

Merge Danger

Debug output intentionally changes and includes more printable fields. ShutdownError.inner exposes source-error text and panic messages, as explicitly approved. The related tests and API documentation describe this change.

Heap's flattened fields, pool counts, buffer summaries and previews, task identity, type-name views, and callback summaries retain their custom presentation. DispatcherClient has a user-approved custom worker-count summary to keep output bounded. DriverHost omits owner_waker, and TaskList omits head and tail, with explicit user approval to avoid printing their addresses. Other skips cover fields without Debug support under the existing generic contracts. No extra generic Debug bounds or task-ID adapters are added.

Keep custom diagnostic views manual. Include supported fields and expose ShutdownError's inner error as requested.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 11, 2026 14:17

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

🟡 Changes recommended

The Debug-output test can pass when both non-try_ fields are missing because its substring checks also match the corresponding try_ field names.

1 open issue
What changed in this PR

Replaces 16 manual Debug implementations with derive_more::Debug across seven packages, reducing formatting boilerplate while retaining specialized implementations.

Changes:

  • Derives field-based output and skips fields that lack Debug under existing generic contracts.
  • Updates assertions for expanded output and documents the approved exposure of shutdown errors and panic messages.
  • Adds the required dependencies and lockfile entries.
File Description
crates/​cachet/​tests/​cache.rs Checks exposed merger fields.
crates/​cachet/​src/​transform/​testing.rs Derives MockCodec formatting.
crates/​cachet/​src/​refresh.rs Derives refresh formatting, skipping generic keys.
crates/​cachet/​src/​fallback.rs Derives inner-cache formatting and updates expected output.
crates/​cachet/​src/​cache.rs Exposes merger fields through derived formatting.
crates/​cachet/​Cargo.toml Adds the Debug derive dependency.
crates/​cachet_tier/​tests/​dynamic.rs Updates the expected tuple-wrapper output.
crates/​cachet_tier/​src/​dynamic.rs Derives formatting while skipping the erased cache.
crates/​cachet_tier/​Cargo.toml Adds the Debug derive dependency.
crates/​bytesbuf/​src/​mem/​callback_memory.rs Derives formatting while keeping callback data opaque.
crates/​bytesbuf/​Cargo.toml Adds the Debug derive dependency.
crates/​arty/​src/​runtime/​dispatch/​client.rs Derives dispatcher-client formatting.
crates/​arty/​src/​io/​handle.rs Derives expanded I/O-handle formatting.
crates/​arty_io_host/​tests/​hosting.rs Updates host assertions and error-helper formatting.
crates/​arty_io_host/​src/​runtime.rs Includes the sink in runtime Debug output.
crates/​arty_io_host/​src/​driver_host.rs Derives host formatting with internal-state skips.
crates/​arty_io_host/​Cargo.toml Adds the Debug derive dependency.
crates/​arty_executor/​tests/​lifecycle/​completion_lifecycle.rs Checks source-error and panic-message visibility.
crates/​arty_executor/​src/​wake.rs Derives opaque remote-wake formatting.
crates/​arty_executor/​src/​task_list.rs Derives task-list formatting and updates its assertion.
crates/​arty_executor/​src/​task_handle.rs Derives opaque task-template formatting.
crates/​arty_executor/​src/​shutdown.rs Derives and documents expanded shutdown-error output.
crates/​allocation_hints/​src/​lib.rs Derives WithHint formatting.
crates/​allocation_hints/​Cargo.toml Adds the Debug derive dependency.
Cargo.lock Records the five new dependency relationships.

Review effort: Balanced

Comment thread crates/cachet/tests/cache.rs Resolved
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 11, 2026 14:24

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

🔵 Needs a closer look

The tests can pass despite missing initializing or _single_threaded fields or incorrect thread and owner_waker values, leaving the expected output insufficiently verified.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Low severity Assert the complete constructor output, including all fields

crates/​arty_io_host/​tests/​hosting.rs:917

These checks still pass if initializing and _single_threaded are omitted, or if thread and owner_waker have incorrect values. Capture the constructor inputs and compare the complete expected string, as required by .github/skills/code-review/test-review.md under “Assert exact outcomes”. Format the captured inputs and an expected Cell::new(false) so incidental values and wrapper formatting match without hard-coding them.

1 resolved since last review

Review effort: Balanced

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 11, 2026 14:44

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

🟢 Approval recommended

No active review issues remain for the refactor replacing manual Debug implementations with derives.

No open issues 🎉

Review effort: Balanced

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 11, 2026 15:00

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

🟢 Approval recommended

No active review issues block the refactor from manual Debug implementations to derived formatting.

No open issues 🎉

Review effort: Balanced

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 11, 2026 15:24

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

🟢 Approval recommended

The refactor replacing manual Debug implementations with derived formatting has no active review issues blocking approval.

No open issues 🎉

Review effort: Balanced

@codecov

codecov Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.9%. Comparing base (2be413c) to head (a1ec684).
⚠️ Report is 2 commits behind head on main.

❌ Your project check has failed because the head coverage (99.9%) is below the target coverage (100.0%). You can increase the head coverage or adjust the target coverage.

Additional details and impacted files
@@           Coverage Diff            @@
##            main    #973      +/-   ##
========================================
  Coverage   99.9%   99.9%              
========================================
  Files        808     727      -81     
  Lines      68565   56022   -12543     
========================================
- Hits       68556   56017   -12539     
+ Misses         9       5       -4     
Flag Coverage Δ
linux 100.0% <100.0%> (ø)
linux-arm 100.0% <100.0%> (ø)
scheduled ?
windows 99.9% <100.0%> (+<0.1%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 11, 2026 16:47

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

🟢 Approval recommended

No active review issues remain for the Debug-derive refactor.

No open issues 🎉

Review effort: Balanced

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 12, 2026 13:44

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

🟢 Approval recommended

No active review issues were identified for the refactor replacing manual Debug implementations with derives.

No open issues 🎉

Review effort: Balanced

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 12, 2026 17:47

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

🟢 Approval recommended

No active review issues remain for the migration from manual Debug implementations to derived output.

No open issues 🎉

Review effort: Balanced

@martin-kolinek martin-kolinek left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🤖: Approved.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 13, 2026 14:41

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

🟢 Approval recommended

No active review issues require changes to the diagnostic-formatting update.

No open issues 🎉

Review effort: Balanced

Use explicit snapshot names without module prefixes so expectations work both on this branch and after main nests the lifecycle tests. Preserve both expected outputs.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 13, 2026 15:11

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

🟢 Approval recommended

There are no active review issues blocking approval of the diagnostic-formatting update.

No open issues 🎉

Review effort: Balanced

@martin-kolinek martin-kolinek left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🤖: Approved.

Apply the user-approved exception for DriverHost.owner_waker and update the public snapshot.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 13, 2026 15:24

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

🟢 Approval recommended

No active review issues are recorded for the Debug-derivation refactor.

No open issues 🎉

Review effort: Balanced

Apply the user-approved exception for TaskList head and tail, and update the public executor snapshot.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 13, 2026 15:38

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

🟢 Approval recommended

No active review issues are recorded for the refactor replacing manual Debug implementations with derives.

No open issues 🎉

Review effort: Balanced

Update the snapshot for main's PanicPolicy wrapper. Preserve the existing Debug assertions and approved bounded views.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 13, 2026 15:57

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

🟢 Approval recommended

No active review issues are recorded for the Debug-derivation refactor.

No open issues 🎉

Review effort: Balanced

@martin-kolinek martin-kolinek left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🤖: Approved.

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