Skip to content

friction: modify --set-field corrupts flow-style fields: {...} maps (file becomes unparseable, artifacts silently vanish) #573

Description

@avrabe

What I was trying to do: Add a release: field to requirements (release-planning workflow) in the agora project so I could scope artifacts to releases via rivet modify <ID> --set-field release=v0.1.0.

Tool + version: rivet 0.17.0 (d648ce4 main 2026-06-23)

What happened: rivet modify --set-field corrupts the YAML when the target artifact's fields: is written in flow style (fields: { priority: must, category: functional }). Instead of merging into the inline map, it appends a mis-indented block line right after it:

    fields: { priority: must, category: functional }
      release: v0.1.0          # <- invalid: block key under a flow mapping

This makes the whole file unparseable, so on the next load every artifact in that file silently vanishes (rivet list0 artifacts, with a WARN about a skipped source). A subsequent rivet modify on a sibling artifact then fails with artifact '...' does not exist even though it is still in the file. Data-loss-shaped: a routine planning command bricked the requirements file.

Block-style fields: is handled correctly — --set-field only mishandles the flow-style form.

Repro (minimal):

# artifacts/reqs.yaml
artifacts:
  - id: REQ-001
    type: requirement
    title: t
    status: draft
    description: d
    fields: { priority: must, category: functional }
  - id: REQ-002
    type: requirement
    title: t2
    status: draft
    description: d2
    fields: { priority: must, category: functional }
rivet list                                   # 2 artifacts
rivet modify REQ-001 --set-field release=v0.1.0
rivet list                                   # 0 artifacts (YAML parse error) — REQ-002 also gone

Workaround used: Hand-edited the YAML to convert flow-style fields: {...} to block style, added release: manually, re-ran rivet validate (PASS). After conversion, --set-field works fine.

Impact: Blocked (briefly) + data-corruption risk. The silent "0 artifacts" + later "does not exist" errors are especially dangerous — easy to not notice the file was bricked. Suggest: when --set-field targets a flow-style map, either normalize it to block style on write, or refuse with a clear error rather than emitting invalid YAML. Relatedly, a skipped-source parse error arguably should be a hard error for mutating commands, not a WARN that yields a silently-empty project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    tool-frictionFriction hit while using the tool for real work (dogfooding signal)

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions