Relationships
#2596 swamp report get --version N returns "Report not found" for any version older than the latest
Opened by swamp_lord · 9/28/2026· Shipped 9/28/2026
What happens
swamp report get <name> --version N exits 1 with Report not found: "<name>" version N for every N below the latest version. It fails the same way with --model, with --workflow, and with neither (global lookup). The latest version works, whether requested with --version or with no version.
Version: 20260928.160203.0-sha.b76c8a82
Reproduction
swamp repo init, then create acommand/shellmodelrptwithreports.require: ["@swamp/method-summary"].- Run
swamp model method run rpt execute --input run="echo run-N"three times (N = 1, 2, 3). - Controls pass:
swamp data versions rpt report-swamp-method-summarylists versions 1–3, andswamp data get rpt report-swamp-method-summary --version 1returns v1's content. swamp report get @swamp/method-summary --model rpt --version 1(or--version 2) returns "Report not found".--version 3and no version return v3.--version 99returns the same "not found".
The same happens globally (no --model), and on a workflow with @swamp/workflow-summary run three times using --workflow.
Expected
The stored older report: Markdown and paired JSON, matching what swamp data get … --version N returns.
Cause
reportGet (src/libswamp/reports/get.ts, version selection around line 197) filters by the requested version a candidate list built from findAllForModel (model and workflow paths) or findAllGlobal (global path). findAllForModel (src/infrastructure/persistence/unified_data_repository.ts:562) calls findByName without a version, so it returns only the latest version of each item. findAllGlobal builds its list from findAllForModel (same file, line 239). An older version is therefore never among the candidates.
Suggested fix
Resolve the owner from the latest-only list as today, keeping the ambiguity and variant handling. When version is set, load that version for the resolved owner with a version-aware lookup (findByName(type, modelId, name, version)). Add this as a dep on ReportGetDeps, wired in src/cli/commands/report_get.ts and src/serve/handlers/report_handlers.ts. The paired -json twin is already read by data.version, so it follows automatically.
Tests
src/libswamp/reports/get_test.ts has no --version coverage. Add cases for an older version on the model, workflow and global paths, and for a version that doesn't exist. The swamp-uat test tests/cli/report/get_test.ts only checks the latest version.
Found while triaging #2595 (dashboard deep links).
Shipped
Click a lifecycle step above to view its details.
Sign in to post a ripple.