From 02a9b6176d89ca8b1c389451096756bb1a88e2d2 Mon Sep 17 00:00:00 2001 From: Jan Svabenik Date: Thu, 2 Apr 2026 23:09:00 +0200 Subject: [PATCH] feat: report source label in dry-run summaries --- docs/README.md | 2 +- internal/dryrun/dryrun.go | 6 ++++++ internal/dryrun/dryrun_test.go | 12 ++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/docs/README.md b/docs/README.md index b0b6cc7..b286f9d 100644 --- a/docs/README.md +++ b/docs/README.md @@ -55,7 +55,7 @@ Current patchable runtime fields via `POST /config`: ## Dry run The dry-run mode generates a synthetic, hardware-free frame summary based on the current config. -It is intended as a no-hardware smoke path for the CLI and config/control-adjacent logic. +It now reports the active source label as well, so dry-run output is less disconnected from the offline/sim paths. The HTTP control plane also exposes `GET /dry-run` for quick inspection of the currently effective no-hardware summary. diff --git a/internal/dryrun/dryrun.go b/internal/dryrun/dryrun.go index c509e20..ed5303d 100644 --- a/internal/dryrun/dryrun.go +++ b/internal/dryrun/dryrun.go @@ -19,6 +19,7 @@ type FrameSummary struct { PilotLevel float64 `json:"pilotLevel"` RDSInjection float64 `json:"rdsInjection"` OutputDrive float64 `json:"outputDrive"` + Source string `json:"source"` PreviewSamples []float64 `json:"previewSamples"` } @@ -32,6 +33,10 @@ func Generate(cfg cfgpkg.Config) FrameSummary { } preview[i] = sign * base * float64(i+1) / 16.0 } + source := "tones" + if cfg.Audio.InputPath != "" { + source = cfg.Audio.InputPath + } return FrameSummary{ Mode: "dry-run", FrequencyMHz: cfg.FM.FrequencyMHz, @@ -42,6 +47,7 @@ func Generate(cfg cfgpkg.Config) FrameSummary { PilotLevel: cfg.FM.PilotLevel, RDSInjection: cfg.FM.RDSInjection, OutputDrive: cfg.FM.OutputDrive, + Source: source, PreviewSamples: preview, } } diff --git a/internal/dryrun/dryrun_test.go b/internal/dryrun/dryrun_test.go index 4361f81..407c03d 100644 --- a/internal/dryrun/dryrun_test.go +++ b/internal/dryrun/dryrun_test.go @@ -17,6 +17,18 @@ func TestGenerate(t *testing.T) { if len(frame.PreviewSamples) != 16 { t.Fatalf("unexpected preview length: %d", len(frame.PreviewSamples)) } + if frame.Source != "tones" { + t.Fatalf("unexpected source: %s", frame.Source) + } +} + +func TestGenerateUsesInputPathAsSource(t *testing.T) { + cfg := cfgpkg.Default() + cfg.Audio.InputPath = "demo.wav" + frame := Generate(cfg) + if frame.Source != "demo.wav" { + t.Fatalf("unexpected source: %s", frame.Source) + } } func TestWriteJSONFile(t *testing.T) {