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

Relationships

#2520 Versions written by different steps of one workflow run all stay isLatest=true (data query / readModelData / queryData return stale "latest")

Opened by crudec · 9/25/2026· Shipped 10/2/2026

Swamp 20260925.013241.0-sha.4489c40d (also 20260922.185723.0). Same symptom as #1902 (shipped), via a path that fix doesn't cover.

Repro (fresh repo)

Model @repro/counter with one resource spec item and a method write that does ctx.writeResource("item", "item-" + args.name, { state: args.state, step: args.step }).

Workflow two-steps: one job, step s1 runs c1.write {name: b, state: Ingesting}, step s2 (dependsOn s1) runs c1.write {name: b, state: Ingested}.

swamp workflow run two-steps
swamp data query 'modelName == "c1" && name == "item-b"' --select '"v=" + string(version) + " latest=" + string(isLatest)'

Actual: v=1 latest=true and v=2 latest=true (distinct ids and content; they differ only in tags.step/stepName). Expected: only v2 is latest.

Scope

  • Only writes from different steps of the same workflow run. 3 steps across 2 jobs → 3 "latest" versions.
  • Fine: two swamp model method run calls; two separate runs of a 1-step workflow; CLI → workflow; workflow → CLI.
  • Wrong: swamp data query, extension context.readModelData(model, spec), context.queryData(...). A later step in the same run already sees the duplicates.
  • Right: swamp data get, swamp data list, swamp data versions (reports v1 isLatest=false), context.readResource, CEL data.latest(...).
  • swamp data gc doesn't clear it. The next write from outside that run demotes the old versions, but that run's own multi-step writes are again all left latest.

Impact

An extension that lists its resources with readModelData and filters on content (e.g. state == "Ingesting") matches the stale version. If it then writes both records back, it fails with Data output validation failed: Duplicate data instance name. We work around this by keeping the highest version per name.

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

Shipped

10/2/2026, 6:00:22 PM

Click a lifecycle step above to view its details.

03Sludge Pulse
hammz assigned hammz10/2/2026, 3:26:49 PM
Editable. Press Enter to edit.

hammz commented 10/2/2026, 6:00:23 PM

Thanks @crudec for reporting this! We shipped: Separate the two meanings that share the catalog is_latest flag. Restore is_latest to one latest row per (namespace, type, model, data name), ordered by version, which fixes data query, data search, context.readModelData and context.queryData. Move the per-step chain heads that #1761/#1802 need into a new is_step_latest column, read only by CEL findBySpec/findByTag through a latestPerStep query option. Make runtime promotion and repair version-aware and transactional, bump the catalog schema version so existing catalogs rebuild, normalise pulled foreign rows, and update the design docs and the swamp skill.. The fix has been merged and a release is on its way. We appreciate your contribution to swamp.

Sign in to post a ripple.