Component: Smrt.Infrastructure¶
Canonical source:
SmrtApps/src/Smrt.Infrastructure/README.md(mirrored below)
Smrt.Infrastructure¶
Overview & Responsibilities¶
- Provides the canonical bootstrap hook (
InfrastructureBootstrap) that host processes call during startup to coordinate one-time registrations. - Establishes the landing zone for future infrastructure adapters that must stay UI/runtime agnostic and integrate cleanly with
Smrt.Coreprimitives. - Keeps diagnostics centralized by deferring logging and configuration work to
Smrt.LoggingandSmrt.Config.
Dependencies & Integrations¶
- Targets .NET 8 and references
Smrt.Corefor shared primitives. - Designed to integrate with
Smrt.Config,Smrt.Logging, and other platform libraries without introducing circular dependencies.
Configuration & Log Paths¶
- Infrastructure helpers resolve configuration and logging paths via
Smrt.Configand defer log emission toSmrt.Logging. - No configuration files ship with the assembly; consuming apps provide overlays in their own AppData slugs per policy.
Runtime Flows¶
InfrastructureBootstrap.EnsureLoaded(Action? onLoaded)should be invoked from each host application's startup path. The method returnstrueonly the first time it runs, allowing callers to gate one-time registrations while remaining safe for repeated calls.- Future bootstrap entry points (e.g., dependency injection modules) must remain deterministic and side-effect free so they can be invoked in service hosts or desktop apps alike.
- Additional infrastructure adapters must document threading and lifecycle assumptions in their XML comments.
Public surface¶
The primary public surface is the bootstrap entry point listed under Key APIs below.
Key APIs¶
InfrastructureBootstrap.EnsureLoaded(Action? onLoaded)– idempotent bootstrap guard that executes the provided callback exactly once per process lifetime.
using Smrt.Infrastructure;
if (InfrastructureBootstrap.EnsureLoaded(RegisterInfrastructureServices))
{
// Execute logic needed only on the first process boot.
}
void RegisterInfrastructureServices()
{
// Perform dependency injection wiring, messaging subscriptions, etc.
}
Storage Guard Components¶
StorageGuard/StorageGuardService.cscaptures drive, sync, and retention health; it now embeds sanitized policy + legal-hold snapshots sourced fromSmrt.Retentionso compliance tooling consumes a single signed artifact.StorageGuard/StorageGuardModels.cscontains DTOs forStorageGuardSnapshot, the newStorageGuardRetentionStatus, and supporting records used throughout the platform.StorageGuard/StorageGuardPaths.csresolves canonical locations forstorage-guard.jsonand signatures, handling migrations between%LocalAppData%and%ProgramData%automatically.
System Info Snapshot¶
SystemInfo/SystemSpecsWriter.cswrites a machine-level system specs + capabilities snapshot once at startup.SystemInfo/SystemInfoPaths.csresolves the canonical path under%ProgramData%/SmrtHub/Logs/system-info/(withSMRTHUB_COMMON_APPDATA_OVERRIDEsupport for tests).- Consumers should treat the snapshot as best-effort diagnostics and still validate hard requirements at point-of-use.
- AI OCR note: Windows AI Text Recognition uses
Microsoft.Windows.AI.Imaging.TextRecognizer. The snapshot reportswindowsAiTextRecognizerReadyStateviaTextRecognizer.GetReadyState()and does not callEnsureReadyAsync()at startup. - UI note:
capabilities.evaluationsprovides stable, user-facing capability IDs with statuses + reasons (for exampleocr.windowsAi).
Testing & Validation¶
- Add component-level tests in the dependent application or a future
Smrt.Infrastructure.Testsproject to validate integration scenarios. - Validate new adapters against both .NET desktop and service hosts to ensure no UI-specific dependencies leak in.
Support Bundle & Diagnostics¶
- Infrastructure components leverage
Smrt.Loggingfor telemetry and automatically participate in Support Bundle exports when the host opts in.
Roadmap¶
- TODO: add dependency-injection extension methods that wrap
InfrastructureBootstrapso hosts can register common services via fluent calls.
Subdirectories¶
StorageGuard/– Storage Guard service, DTOs, and path helpers powering the system-info snapshot artifacts.- Generated build artifacts (
bin/,obj/).
Related docs¶
SmrtApps/src/Smrt.Core/README.mdSmrtApps/src/Smrt.Config/README.md