Diagnostics Model

Buffalo Core provides structured diagnostics so Buffalo projects can report validation, workflow, and runtime issues in a consistent way. The design is intentionally small and machine-readable.

Components

  • DiagnosticSeverity classifies one diagnostic as error, warning, or info.

  • DiagnosticLocation optionally records where a diagnostic applies.

  • Diagnostic stores the stable code, message, severity, and optional location.

  • DiagnosticReport groups ordered diagnostics from one workflow.

  • OperationResult[T] pairs one primary return value with a DiagnosticReport.

Design Goals

Diagnostics should support both human-facing reporting and programmatic inspection. The model should work for configuration validation, geometry preparation, sampling workflows, export helpers, and future solver orchestration. Buffalo Core keeps this layer domain-light so that other Buffalo projects can build richer conventions on top of it without changing the shared types.

Usage Pattern

Use Diagnostic values when a workflow needs to communicate structured issues without immediately raising an exception. Use DiagnosticReport to aggregate those issues for a single operation. Use OperationResult[T] when a function should return both a value and the diagnostics emitted while producing it.