Skip to main content
← Back to list
01Issue
BugShippedSwamp CLIPublic
Assigneesstack72

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

  1. swamp repo init, then create a command/shell model rpt with reports.require: ["@swamp/method-summary"].
  2. Run swamp model method run rpt execute --input run="echo run-N" three times (N = 1, 2, 3).
  3. Controls pass: swamp data versions rpt report-swamp-method-summary lists versions 1–3, and swamp data get rpt report-swamp-method-summary --version 1 returns v1's content.
  4. swamp report get @swamp/method-summary --model rpt --version 1 (or --version 2) returns "Report not found". --version 3 and no version return v3. --version 99 returns 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).

02Bog Flow
✓OPEN✓TRIAGED✓IN PROGRESS✓SHIPPED+ 1 MOREASSIGNED+ 6 MOREREVIEW+ 7 MOREPR_MERGED+ 2 MORESESSION_SUMMARIZED

Shipped

9/28/2026, 5:40:43 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
stack72 assigned stack729/28/2026, 5:01:31 PM

Sign in to post a ripple.