my prefect server setup prefect-metrics.waow.tech
python orchestration
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

weave: fix tag mapping for existing cards (URL evidence collection bug)

existing card URLs were skipped in evidence collection, so they never
got mapped to tags. now all URLs are tracked in url_evidence (including
existing ones), and existing cards get mapped to their observation tags.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

zzstoatzz c42f8b55 3c659b14

+12 -18
+12 -18
flows/weave.py
··· 684 684 row_tags = list(getattr(row, "tags", []) or []) 685 685 for url in _URL_RE.findall(content): 686 686 url = url.rstrip(".,;:!?") 687 - if url in existing_urls: 688 - continue 689 687 if url not in url_evidence: 690 688 url_evidence[url] = { 691 689 "tags": set(), ··· 695 693 url_evidence[url]["tags"].update(row_tags) 696 694 url_evidence[url]["count"] += 1 697 695 698 - # build tag->card mapping for ALL cards (existing + new) 699 - # for existing cards, match by URL presence in observations 696 + # build tag->card mapping from observation-level associations 700 697 tag_cards: dict[str, list[dict[str, Any]]] = defaultdict(list) 701 698 702 - # also index existing cards by their URL for tag mapping 699 + # map existing cards to tags via their URLs 703 700 existing_by_url: dict[str, dict[str, Any]] = {} 704 701 for card in existing_cards: 705 702 val = card.get("value", {}) 706 703 if val.get("type") == "URL": 707 704 card_url = val.get("content", {}).get("url", "") 708 705 existing_by_url[card_url] = card 709 - # check if this URL appears in any observation evidence 710 - for url, evidence in url_evidence.items(): 711 - if url == card_url: 712 - for tag in evidence["tags"]: 713 - tag_cards[tag].append(card) 714 - # also check url_evidence for the already-existing cards 715 - for url in existing_urls: 716 - if url in url_evidence and url in existing_by_url: 717 - for tag in url_evidence[url]["tags"]: 718 - if existing_by_url[url] not in tag_cards.get(tag, []): 719 - tag_cards[tag].append(existing_by_url[url]) 706 + if card_url in url_evidence: 707 + for tag in url_evidence[card_url]["tags"]: 708 + tag_cards[tag].append(card) 709 + 710 + # find new URLs not yet represented as cards 711 + new_urls = { 712 + url: ev for url, ev in url_evidence.items() if url not in existing_urls 713 + } 720 714 721 - if not url_evidence: 715 + if not new_urls: 722 716 logger.info("no new URLs found in observations") 723 717 return {"cards": existing_cards, "tag_cards": dict(tag_cards)} 724 718 725 719 # sort by evidence strength 726 720 ranked = sorted( 727 - url_evidence.items(), 721 + new_urls.items(), 728 722 key=lambda x: x[1]["count"] * len(x[1]["tags"]), 729 723 reverse=True, 730 724 )