HoneyDrunk.Kernel.Abstractions 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package HoneyDrunk.Kernel.Abstractions --version 0.1.0
                    
NuGet\Install-Package HoneyDrunk.Kernel.Abstractions -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="HoneyDrunk.Kernel.Abstractions" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="HoneyDrunk.Kernel.Abstractions" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="HoneyDrunk.Kernel.Abstractions" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add HoneyDrunk.Kernel.Abstractions --version 0.1.0
                    
#r "nuget: HoneyDrunk.Kernel.Abstractions, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package HoneyDrunk.Kernel.Abstractions@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=HoneyDrunk.Kernel.Abstractions&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=HoneyDrunk.Kernel.Abstractions&version=0.1.0
                    
Install as a Cake Tool

HoneyDrunk.Kernel

Foundational primitives for HoneyDrunk.OS

๐Ÿงฌ Overview

HoneyDrunk.Kernel is the primordial layer of the Grid โ€” the bedrock that powers every Node, service, and agent across HoneyDrunk.OS. It defines the shared primitives that make the ecosystem coherent and interoperable: dependency injection, configuration, diagnostics, context propagation, and application lifecycles. Every architectural pattern within the Grid ultimately descends from the Kernel.

Signal Quote: "Where everything begins."

Target Framework: .NET 10.0

๐Ÿš€ Purpose

The Kernel exists to make architectural decisions once, not repeatedly across services. It's how small teams achieve large-scale stability โ€” one unified runtime grammar guiding the entire Hive.

๐Ÿงฉ Core Responsibilities

Area Description
Dependency Injection (DI) Central composition layer for service registration and lifetime scoping.
Configuration Unified configuration provider that reads from environment variables, manifests, and Vault.
Context Propagation Lightweight context object for tracing, correlation, and cancellation across async boundaries.
Diagnostics Shared contracts for logging, metrics, and health checks.
Time & ID Abstractions Deterministic abstractions for time and unique identifiers to improve testability.
Hosting Lifecycle Common startup, shutdown, and background worker orchestration primitives.

๐Ÿง  Design Philosophy

  • Predictability > Cleverness โ€“ Simplicity scales.
  • Replaceable without regret โ€“ Kernel defines contracts, not frameworks.
  • Observable by default โ€“ Every operation should emit measurable signals.
  • Secure by design โ€“ Vault integration from the start, not bolted on later.
  • Portable โ€“ Works in APIs, background services, or agent runtimes.

๐Ÿ”— Framework Integration

HoneyDrunk.Kernel extends rather than replaces Microsoft.Extensions primitives:

Microsoft.Extensions Feature Kernel's Role
ILogger<T> Used directly; no wrapper needed
IConfiguration Used directly; Kernel adds ISecretsSource for Vault integration
IHostedService Used directly for background services
IServiceCollection Extended via AddKernelDefaults()

What Kernel Adds:

  • IKernelContext for correlation/causation propagation across async boundaries
  • IClock and IIdGenerator for deterministic, testable time and ID generation
  • ISecretsSource for unified secrets management (environment, Vault, composite)
  • IHealthCheck composition patterns for service health monitoring
  • IMetricsCollector abstraction (no-op by default; real backends provided by downstream services)

๐Ÿšซ Intentionally Out of Scope

The following belong in downstream Nodes, not Kernel:

Feature Recommended Location
Metrics backends (OpenTelemetry, Application Insights) Service-level registration
Resilience (retry, circuit breaker, timeout) HoneyDrunk.Transport
Validation (IValidator<T>, FluentValidation) Service-level or HoneyDrunk.Data
Result<T> monads / Railway-oriented programming Service-level or future HoneyDrunk.Common
HTTP clients (HttpClientFactory) HoneyDrunk.Web.Rest
Database abstractions (repositories, EF Core) HoneyDrunk.Data
Authentication/Authorization HoneyDrunk.Auth

Why? Kernel stays minimal and focused. Heavy behavior belongs at service boundaries where it can be composed and replaced independently.

๐Ÿงฑ Repository Layout

HoneyDrunk.Kernel/
 โ”œโ”€โ”€ HoneyDrunk.Kernel/                 # Runtime library
 โ”œโ”€โ”€ HoneyDrunk.Kernel.Abstractions/    # Interfaces & shared contracts
 โ”œโ”€โ”€ HoneyDrunk.Kernel.Tests/           # Separate test project
 โ”œโ”€โ”€ HoneyDrunk.Kernel.sln
 โ”œโ”€โ”€ Directory.Build.props
 โ”œโ”€โ”€ Directory.Build.targets
 โ”œโ”€โ”€ .editorconfig
 โ”œโ”€โ”€ .gitattributes
 โ”œโ”€โ”€ .gitignore
 โ”œโ”€โ”€ CODEOWNERS
 โ””โ”€โ”€ .github/
     โ””โ”€โ”€ workflows/
         โ””โ”€โ”€ build.yml

Testing Policy

  • All tests live in HoneyDrunk.Kernel.Tests โ€” none in runtime projects.
  • Shared fixtures will later come from HoneyDrunk.Testing.
  • Tests must use IClock and IIdGenerator for deterministic runs.
  • CI gate: build fails if tests fail; coverage threshold optional.

๐Ÿ”— Relationships

Upstream:

  • HoneyDrunk.Standards
  • HoneyDrunk.Build

Downstream:

  • HoneyDrunk.Data
  • HoneyDrunk.Transport
  • HoneyDrunk.Web.Rest
  • HoneyDrunk.Auth
  • HoneyDrunk.Vault

๐Ÿ“– Quick Start

Register Kernel Services

using HoneyDrunk.Kernel.DI;

var builder = WebApplication.CreateBuilder(args);

// Register Kernel defaults (Clock, IdGenerator, Context, Metrics)
builder.Services.AddKernelDefaults();

var app = builder.Build();
app.Run();

Use Context Propagation

using HoneyDrunk.Kernel.Abstractions.Context;
using Microsoft.Extensions.Logging;

public class OrderService(IKernelContext context, ILogger<OrderService> logger)
{
    public async Task ProcessOrderAsync(string orderId)
    {
        logger.LogInformation(
            "Processing order {OrderId} with CorrelationId: {CorrelationId}", 
            orderId, 
            context.CorrelationId);
        
        // Context flows through async boundaries automatically
        await SaveOrderAsync(orderId, context.Cancellation);
    }
}

Use Deterministic Time

using HoneyDrunk.Kernel.Abstractions.Time;

public class EventStore(IClock clock)
{
    public Event CreateEvent(string data)
    {
        return new Event
        {
            Data = data,
            Timestamp = clock.UtcNow  // Mockable in tests
        };
    }
}

Record Metrics

using HoneyDrunk.Kernel.Abstractions.Diagnostics;

public class PaymentProcessor(IMetricsCollector metrics)
{
    public async Task ProcessPaymentAsync(decimal amount)
    {
        metrics.RecordCounter("payments.processed", 1, 
            new KeyValuePair<string, object?>("currency", "USD"));
        
        metrics.RecordHistogram("payments.amount", (double)amount);
    }
}

Note: Kernel provides a no-op IMetricsCollector by default. Register a real backend (OpenTelemetry, Application Insights, etc.) in your service's startup.

๐Ÿงช Local Development

git clone https://github.com/HoneyDrunkStudios/kernel
cd kernel

dotnet restore
dotnet build
dotnet test HoneyDrunk.Kernel.Tests/HoneyDrunk.Kernel.Tests.csproj

This Node consumes private packages from the HoneyDrunk Azure Artifacts feed. Configure the following secrets or NuGet.config sources:

  • HD_FEED_URL
  • HD_FEED_USER
  • HD_FEED_TOKEN

Writing Tests

Kernel abstractions enable deterministic testing:

using HoneyDrunk.Kernel.Abstractions.Time;
using Xunit;

public class EventStoreTests
{
    [Fact]
    public void CreateEvent_UsesFixedTimestamp()
    {
        // Arrange
        var fixedTime = new DateTimeOffset(2025, 1, 1, 0, 0, 0, TimeSpan.Zero);
        var clock = new FixedClock(fixedTime);
        var store = new EventStore(clock);
        
        // Act
        var evt = store.CreateEvent("test-data");
        
        // Assert
        Assert.Equal(fixedTime, evt.Timestamp);
    }
}

// Simple test double for IClock
public class FixedClock(DateTimeOffset fixedTime) : IClock
{
    public DateTimeOffset UtcNow => fixedTime;
    public long GetTimestamp() => fixedTime.Ticks;
}

Testing Best Practices:

  • Always inject IClock instead of using DateTime.UtcNow or DateTimeOffset.UtcNow
  • Use IIdGenerator for correlation/causation IDs in tests
  • Mock IMetricsCollector to verify metrics are recorded correctly
  • Use IKernelContext with known correlation IDs for tracing validation

โš™๏ธ Build & Release

  • Workflow: HoneyDrunk.Actions โ†’ publish-nuget.yml
  • Tag Convention: vX.Y.Z โ†’ triggers build, pack, and publish
  • Analyzers: Enforced automatically via HoneyDrunk.Standards (buildTransitive)
  • Output: Internal Azure Artifacts feed

CI runs on:

  • push โ†’ build + test
  • pull_request โ†’ validate formatting and analyzers
  • tag v* โ†’ publish package

๐Ÿงƒ Motto

"If the Kernel is stable, everything above it can change fearlessly."

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (16)

Showing the top 5 NuGet packages that depend on HoneyDrunk.Kernel.Abstractions:

Package Downloads
HoneyDrunk.Kernel

Production-ready runtime implementations for HoneyDrunk.OS Grid. Provides GridContext, NodeContext, OperationContext implementations, transport binders (HTTP/messaging/jobs), context mappers, GridContextMiddleware, lifecycle orchestration, AgentsInterop, telemetry (GridActivitySource), and unified bootstrapping (AddHoneyDrunkGrid).

HoneyDrunk.Vault

Secrets and configuration management library for .NET. Provides a unified abstraction for accessing secrets from multiple providers (File, Azure Key Vault, AWS Secrets Manager, Configuration, In-Memory). Integrated with HoneyDrunk.Kernel v0.8.0 for lifecycle management, health reporting, and distributed telemetry.

HoneyDrunk.Transport

Transport-agnostic messaging library for .NET. Provides a unified abstraction layer over different message brokers with middleware pipeline pattern, retry strategies, and transactional outbox support. Uses HoneyDrunk.Kernel.Abstractions for Grid-aware context propagation.

HoneyDrunk.Transport.InMemory

In-memory transport implementation for HoneyDrunk.Transport. Provides observable queues and pub/sub subscriptions for testing without external dependencies.

HoneyDrunk.Data

Provider-neutral persistence orchestration layer for HoneyDrunk.OS Grid. Complete architecture overhaul with Kernel integration for tenant resolution, correlation tracking, and telemetry enrichment. Does not depend on any specific database provider.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.8.0 1,690 5/26/2026
0.7.0 2,267 5/18/2026
0.6.0 108 5/17/2026
0.5.0 595 5/4/2026
0.4.0 1,888 1/19/2026
0.3.0 432 11/28/2025
0.2.1 285 11/22/2025
0.2.0 249 11/22/2025
0.1.2 428 11/13/2025
0.1.1 353 11/10/2025
0.1.0 175 11/7/2025