Skip to content

Mention resolution drops unmodelled attrs (localId, userType) on Jira-fetched nodes #71

Description

@Hinne1

Follow-up from the final review of claude/reply-to-adf-quoting. Not reachable today; filed so it is a deliberate design choice rather than a latent surprise.

Mechanism

ADFContent.RawAttrs holds a node’s attrs exactly as received and wins over the typed Attrs struct on marshal, so nodes fetched from Jira round-trip losslessly.

resolveInContent (internal/api/mention_resolve.go) mutates the typed Attrs when resolving a mention, so it must clear RawAttrs — otherwise the mutation is silently discarded. It does.

The consequence: a resolved mention falls back to the typed struct, which models only id, text, and accessLevel. A mention node carrying localId or userType loses them.

The unresolved path has no such issue — the node becomes type: "text", which must not carry mention attrs at all.

Not reachable today

All ResolveMentions call sites (internal/api/jira.go:1674, internal/cmd/issue/field_util.go:119) operate on documents freshly built by MarkdownToADF, which never populates RawAttrs. A future caller resolving mentions in a fetched document — say comment edit --append, or a description round-trip — would hit it.

Suggested fix

Patch the single key in place instead of discarding the raw form: unmarshal RawAttrs into map[string]json.RawMessage, overwrite "id", re-marshal. That keeps the resolved account id and every unmodelled attribute.

Related: #68, #69, #70.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions