Skip to content

refactor: layered (DDD) architecture + dead-code cleanup#1

Merged
CSFeo merged 3 commits into
mainfrom
refactor/ddd-layers
Jun 23, 2026
Merged

refactor: layered (DDD) architecture + dead-code cleanup#1
CSFeo merged 3 commits into
mainfrom
refactor/ddd-layers

Conversation

@CSFeo

@CSFeo CSFeo commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Reorganizes src/ into four layers with dependencies pointing inward
(domaininfrastructureapplicationpresentation; main is the
composition root). No behavioral change — the same 28 tests pass; clippy -D warnings and fmt are clean.

Layers

  • domain/analysis, scoring, collector, timing, clock, config, warmup (pure model + logic; no I/O, no protobuf)
  • application/run (race/latency/full), slots, throughput pipelines
  • infrastructure/geyser (provider + gRPC client), proto, sntp, config_file
  • presentation/output (console/json/csv), html

Module splits (onto layer boundaries)

  • clock math (domain::clock) vs NTP UDP probe (infrastructure::sntp)
  • config value objects (domain::config) vs TOML loading (infrastructure::config_file)
  • protobuf created_at extraction + commitment conversion moved to infrastructure::geyserdomain no longer depends on generated protobuf
  • race/latency/full orchestration extracted from mainapplication::run
  • slot/throughput console renderers → presentation::output

Dead-code cleanup

  • removed BenchConfig.duration_secs (write-only)
  • dropped unused deps chrono + duplicate tokio-stream (kept as dev-dep)
  • inlined dead subscribe_with_request branch; dropped orphaned SubscribeSendError

Notes

  • Breaking for library consumers: public module paths moved (e.g. chainbench_grpc::analysischainbench_grpc::domain::analysis). Bumped to v0.4.0.
  • Adds ARCHITECTURE.md (layer map, dependency rule, ubiquitous language, run flow).
  • File moves are tracked as git renames, so history is preserved for review.

🤖 Generated with Claude Code

feofilaktov and others added 3 commits June 16, 2026 16:07
Reorganize src/ into four layers with dependencies pointing inward
(domain ← infrastructure ← application ← presentation; main is the
composition root). No behavioral change — all 28 tests pass unchanged.

Layers:
- domain/        analysis, scoring, collector, timing, clock, config, warmup
- application/   run (race/latency/full), slots, throughput pipelines
- infrastructure/ geyser (provider + client), proto, sntp, config_file
- presentation/  output (console/json/csv), html

Split mixed modules onto layer boundaries:
- clock math (domain) vs NTP UDP probe (infrastructure::sntp)
- config value objects (domain) vs TOML loading (infrastructure::config_file)
- protobuf created_at extraction + commitment conversion moved to
  infrastructure::geyser so domain no longer depends on generated protobuf
- race/latency/full orchestration extracted from main into application::run
- slot/throughput console renderers moved to presentation::output

Dead-code cleanup:
- remove BenchConfig.duration_secs (write-only)
- drop unused deps chrono + duplicate tokio-stream (kept as dev-dep)
- inline dead subscribe_with_request branch; drop SubscribeSendError variant

Public module paths moved (breaking for library consumers) -> v0.4.0.
Adds ARCHITECTURE.md (layer map + ubiquitous language). clippy -D warnings
and fmt clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Drop the private copy of `percentile` in application/slots.rs and call the
canonical `domain::analysis::percentile` instead (identical nearest-rank impl).
Addresses the code-review cleanup finding.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
CI failed with "'cargo-fmt' is not installed for the toolchain '1.90.0'":
dtolnay/rust-toolchain@stable installed rustfmt/clippy for `stable`, but
rust-toolchain.toml pins 1.90.0, so cargo selected a toolchain without the
components. Pin the action to @1.90.0 (ci.yml components; release.yml target)
so the installed toolchain matches the one cargo uses.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@CSFeo
CSFeo merged commit da74bcb into main Jun 23, 2026
1 check passed
@CSFeo
CSFeo deleted the refactor/ddd-layers branch June 23, 2026 20:32
CSFeo added a commit that referenced this pull request Jul 15, 2026
refactor: layered (DDD) architecture + dead-code cleanup
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.

1 participant