Skip to content

Core: BenchmarkEnvironment and BenchmarkRun domain model - #59

Merged
AamiriYouness merged 1 commit into
mainfrom
feat/benchmark-environment-domain-model
Aug 18, 2026
Merged

AamiriYouness merged 1 commit into
mainfrom
feat/benchmark-environment-domain-model

Conversation

@AamiriYouness

Copy link
Copy Markdown
Collaborator

Summary

Implements ADR-0006 Decisions 1 and 2: the report-level BenchmarkRun
type and the BenchmarkEnvironment domain model, plus four supporting
enums. Pure Core types — zero I/O, parsing, validation, or comparison
logic. First issue in the v0.5.0 ("Filesystem history") chain; has no
dependencies.

Design notes

  • BenchmarkRun.Environment == null (no document supplied) is kept
    strictly distinct from a present BenchmarkEnvironment whose fields
    are all null (document existed, dimensions unavailable). Never
    merged, per ADR-0006.
  • BenchmarkArchitecture and BenchmarkHardwareTimerKind are
    Core-owned enums, not BenchmarkDotNet's own types — Core has no
    BenchmarkDotNet dependency. Member sets mirror
    BenchmarkDotNet.Environments.Platform and
    Perfolizer.Horology.HardwareTimerKind respectively, confirmed
    against a real BenchmarkDotNet 0.15.8 fixture.
  • Both enums carry an Unknown member for forward compatibility:
    history snapshots can outlive the BenchmarkGate version that wrote
    them, so a future BDN value this version doesn't recognize maps to
    Unknown rather than failing deserialization or being coerced into
    an unrelated known value. HardwareTimerKind.Unknown is additionally
    a real BDN-emitted sentinel, confirmed in the fixture.
  • EnvironmentCompatibilityRole and EnvironmentDimension are added
    as data only — no equality-role behavior (what a Filter mismatch
    does) is implemented here; that's compatibility comparison in a
    later issue.
  • Mapping BenchmarkDotNet's own types into these enums (the adapter)
    is explicitly out of scope for this issue.

Files

  • src/BenchmarkGate.Core/Model/BenchmarkRun.cs (new)
  • src/BenchmarkGate.Core/Model/BenchmarkEnvironment.cs (new)
  • src/BenchmarkGate.Core/Model/BenchmarkArchitecture.cs (new)
  • src/BenchmarkGate.Core/Model/BenchmarkHardwareTimerKind.cs (new)
  • src/BenchmarkGate.Core/Model/EnvironmentCompatibilityRole.cs (new)
  • src/BenchmarkGate.Core/Model/EnvironmentDimension.cs (new)
  • tests/BenchmarkGate.Core.Tests/Model/BenchmarkEnvironmentTests.cs (new)
  • tests/BenchmarkGate.Core.Tests/Model/BenchmarkRunTests.cs (new)
  • tests/BenchmarkGate.Core.Tests/Model/EnvironmentEnumsTests.cs (new)
  • CHANGELOG.md (modified)

Testing checklist

  • dotnet build — no CS1573 (doc-comment) errors
  • dotnet test — all new tests green
  • EnvironmentDimension reflection test confirms 15 members match BenchmarkEnvironment property count
  • No using BenchmarkDotNet.* anywhere in BenchmarkGate.Core

Adds the report-level BenchmarkRun/BenchmarkEnvironment types and
supporting enums (BenchmarkArchitecture, BenchmarkHardwareTimerKind,
EnvironmentCompatibilityRole, EnvironmentDimension) per ADR-0006
Decisions 1-2. Pure Core types only — no parsing, validation, or
comparison logic; those land in later issues in the v0.5.0 chain.

BenchmarkArchitecture and BenchmarkHardwareTimerKind normalize
BenchmarkDotNet's own vocabulary into Core-owned enums so persisted
history is never coupled to a BenchmarkDotNet dependency. Both carry
an Unknown member: HardwareTimerKind.Unknown is a confirmed real BDN
sentinel (0.15.8 fixture), Architecture.Unknown is a forward-compat
fallback for values a future BDN version might add.
@AamiriYouness AamiriYouness linked an issue Aug 18, 2026 that may be closed by this pull request
@codecov

codecov Bot commented Aug 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@AamiriYouness
AamiriYouness merged commit 2089665 into main Aug 18, 2026
4 checks passed
@AamiriYouness
AamiriYouness deleted the feat/benchmark-environment-domain-model branch August 18, 2026 11:38
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.

Core: BenchmarkEnvironment and BenchmarkRun domain model

1 participant