fix(tag): tolerate dict-bodied tags attachment and apply name:value/dict options (CON-737) - #198
Open
howethomas wants to merge 1 commit into
Open
fix(tag): tolerate dict-bodied tags attachment and apply name:value/dict options (CON-737)#198howethomas wants to merge 1 commit into
howethomas wants to merge 1 commit into
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The SIPREC -> conserver interop path (CON-737) DLQ'd every real vCon: the
siprec_provenancelink (links.tag) crashed withAttributeError: 'dict' object has no attribute 'append', so nothing reached Postgres storage.Two distinct defects:
add_tagassumed a list body. It didtags = decoded_body(...); tags.append(...). The SIPREC adapter emits apurpose:"tags"attachment whose body is a dict of provenance metadata (source,call_id,session_id, ...), so.appendraised 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.The tag link doubled
name:valueoptions.run()calledadd_tag(tag_name=tag, tag_value=tag), so a configured"source:siprec-adapter"became the tag"source:siprec-adapter:source:siprec-adapter".Fix
add_tagflattens 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 ask:vtags and remain readable viaget_tag.links.tagparses"name:value"option strings into(name, value)and also accepts dict-form options{name: value}. Bare names keep the existingname:namebehavior.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