Skip to content

fix(tag): tolerate dict-bodied tags attachment and apply name:value/dict options (CON-737) - #198

Open
howethomas wants to merge 1 commit into
mainfrom
con-737-links-tag-dict-tags
Open

fix(tag): tolerate dict-bodied tags attachment and apply name:value/dict options (CON-737)#198
howethomas wants to merge 1 commit into
mainfrom
con-737-links-tag-dict-tags

Conversation

@howethomas

Copy link
Copy Markdown
Contributor

Problem

The SIPREC -> conserver interop path (CON-737) DLQ'd every real vCon: the siprec_provenance link (links.tag) crashed with AttributeError: 'dict' object has no attribute 'append', so nothing reached Postgres storage.

Two distinct defects:

  1. add_tag assumed a list body. It did tags = decoded_body(...); tags.append(...). The SIPREC adapter emits a purpose:"tags" attachment whose body is a dict of provenance metadata (source, call_id, session_id, ...), so .append raised and the vCon was DLQ'd before storage. A vCon with no prior tags attachment worked (fresh list), which is why it only bit real adapter traffic.

  2. The tag link doubled name:value options. run() called add_tag(tag_name=tag, tag_value=tag), so a configured "source:siprec-adapter" became the tag "source:siprec-adapter:source:siprec-adapter".

Fix

  • add_tag flattens a dict body to the tag convention's "name:value" list (and coerces any other non-list body) before appending. Pre-existing dict entries are preserved as k:v tags and remain readable via get_tag.
  • links.tag parses "name:value" option strings into (name, value) and also accepts dict-form options {name: value}. Bare names keep the existing name:name behavior.

Tests

Adds 3 regression tests to conserver/links/tag/test_tag.py (name:value strings, dict-form options, dict-bodied existing attachment). Full file: 6 passed.

Verified live on the CON-737 interop conserver: after the fix, synthetic SIPREC calls flow adapter -> ingress -> siprec_chain -> Postgres with tags ["source:siprec", ..., "source:siprec-adapter", "pipeline:siprec-interop"].

🤖 Generated with Claude Code

…ict options (CON-737)

The SIPREC->conserver interop path (CON-737) DLQ'd every real vCon because
the tag link crashed in add_tag.

Two defects:
- add_tag assumed the existing purpose="tags" attachment body was a list and
  called .append on it. The SIPREC adapter emits purpose="tags" with a dict
  body (provenance metadata), so add_tag raised
  AttributeError: 'dict' object has no attribute 'append' and the vCon was DLQ'd
  before storage. add_tag now flattens a dict body to the tag convention's
  "name:value" list (and coerces any other non-list body) before appending.
- The tag link applied options as add_tag(tag_name=tag, tag_value=tag), so a
  configured "source:siprec-adapter" became the doubled tag
  "source:siprec-adapter:source:siprec-adapter". The link now parses
  "name:value" strings and also accepts dict-form options {name: value}.

Adds regression tests for both fixes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant