Skip to main content
← Back to list
01Issue
FeatureOpenSwamp ClubPublic
AssigneesNone

Relationships

#2097 docs: data.latest second argument matches name OR spec, not just spec

Opened by stack72 · 9/10/2026

Current documentation

references/workflow/references/data-chaining.md (and references/model/references/data-chaining.md), line 87:

| `data.latest("<name>", "<spec>")` | Yes — shortcut for query | Yes | Shortcut |

The table header labels the second argument as <spec>, implying it matches only the data record's specName.

Actual behavior

Verified 2026-09-09 with a probe matrix in a throwaway workflow:

The second argument matches the record's name OR specName:

  • If it matches exactly one record (by name or spec), it returns that record
  • If it matches two records (one by name, another by spec), it throws: Ambiguous data.latest() match: specName "composed" resolves to 2 data items
  • A miss does not return null — accessing .attributes on a miss throws No such key: attributes (the accessor .attributes IS correct when it resolves)

Fix suggestion

Update the table to:

| `data.latest("<model>", "<nameOrSpec>")` | Yes — shortcut for query | Yes | Shortcut |

And add a note: "Resolves <nameOrSpec> against both the record's name and its specName. Throws on ambiguity (two records matched by different fields). A miss throws rather than returning null — use data.query() when you need to handle missing data gracefully."

Workaround for ambiguity-prone reads

${{ data.query('modelName == "myModel" && name == "myData"')[0].attributes }}

Automoved by swampadmin from https://github.com/swamp-club/swamp/issues/2426

02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED

Open

9/10/2026, 12:03:53 PM

No activity in this phase yet.

03Sludge Pulse
Editable. Press Enter to edit.

vcjdeboer commented 9/10/2026, 12:13:39 PM

apologies, my overactive Fable filed this one before I knew it, via github

Sign in to post a ripple.