Skip to content

Component: Smrt.Retention

Canonical source: SmrtApps/src/Smrt.Retention/README.md (mirrored below)


Smrt.Retention

Enterprise-grade retention and legal hold primitives shared by Supervisor, Storage Guard, HubWindow, and Support Bundle components.

Overview and responsibilities

  • Defines canonical models for retention policies, legal holds, and verification evidence.
  • Provides validation + normalization helpers so every host enforces the same business rules.
  • Provides canonical path resolution helpers for config + evidence artifacts.

Public surface / entry points

  • Not documented yet.

Dependencies and integrations

  • Consumed by Supervisor, Storage Guard, HubWindow, and Support Bundle.

Configuration and operational data

  • Persists retention config under %ProgramData%/SmrtHub/Config/retention/ via SmrtHub.Config.ConfigJson with atomic writes.
  • Evidence path resolution is provided via RetentionPaths (callers should not hard-code directories).

Observability and diagnostics

  • Not documented yet.

Testing and validation

  • Unit tests live in SmrtApps/tests/Smrt.Retention.Tests.

Support Bundle

  • Retention config and evidence artifacts are exported via Support Bundle (see Retention Capability/SubSystem docs).
  • Retention Subsystem (contracts and invariants): README.Files/Subsystems/Retention/README.md
  • Retention Capability (end-to-end flow): README.Files/Capabilities/Retention/README.md
  • Retention & Legal Hold Plan (Phase 3): README.Files/System/Plans/SmrtHub-Retention-and-LegalHold.README.md
  • Retention Subsystem (contracts and invariants): README.Files/Subsystems/Retention/README.md
  • Retention Capability (end-to-end flow): README.Files/Capabilities/Retention/README.md
  • Retention & Legal Hold Plan (Phase 3): README.Files/System/Plans/SmrtHub-Retention-and-LegalHold.README.md

Responsibilities

  • Define canonical models for retention policies, legal holds, and verification evidence.
  • Provide validation + normalization helpers so every host enforces the same business rules (slug uniqueness, retention windows, legal-hold overrides).
  • Handle persistence via SmrtHub.Config.ConfigJson with atomic writes under %ProgramData%/SmrtHub/Config/retention/ (falling back to %LocalAppData% on developer machines).
  • Surface deterministic helper APIs for resolving config/evidence paths so Storage Guard workers, Supervisor CLI, and Support Bundle providers never diverge.

Key Files

File Purpose
Models/RetentionPolicy.cs DTO representing per-provider retention rules (days, free-space floors, max artifact size).
Models/LegalHold.cs Captures hold metadata (scope, owner, reason, expiry).
Models/RetentionConfiguration.cs Aggregate of policies + holds with helper methods to resolve effective policies.
Models/RetentionEvidence.cs Output contract for scheduled verification jobs/signatures.
Storage/RetentionPaths.cs Canonical path resolution for config + evidence artifacts.
Storage/RetentionConfigurationStore.cs Atomic load/save helper that exposes PolicyPath/LegalHoldPath and enforces validation via Validation/RetentionConfigurationValidator.cs.
Validation/RetentionConfigurationValidator.cs Enforces enterprise guardrails (retention days, slug uniqueness, hold scope semantics).
Validation/RetentionValidationException.cs Exception that carriers validation issues back to callers for UI/CLI display.

Usage Notes

  • Always run configurations through RetentionConfigurationStore.Save so validation occurs before the files hit disk.
  • RetentionPaths exposes helper methods for policy, hold, evidence, and health files; do not hard-code directories.
  • The library does not schedule jobs or mutate provider data—callers handle orchestration and logging.

Tests

Unit tests live in SmrtApps/tests/Smrt.Retention.Tests. They cover validation, normalization, and round-trip persistence to ensure we don't regress path handling.