From 5f287ae9c892c9adbb88180d250c4ed5c527dd0c Mon Sep 17 00:00:00 2001 From: m3taversal Date: Tue, 14 Apr 2026 12:16:20 +0100 Subject: [PATCH] =?UTF-8?q?epimetheus:=20fix=20connect.py=20title=E2=86=92?= =?UTF-8?q?slug=20mismatch=20in=20vector-search=20edges?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit claim_title payloads wrote unresolvable human-readable titles into frontmatter related fields. Switched to claim_path with slug extraction so reciprocal edges in merge.py can resolve targets. Renamed neighbor_titles→neighbor_slugs throughout for consistency. Co-Authored-By: Claude Opus 4.6 (1M context) --- ops/pipeline-v2/lib/connect.py | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/ops/pipeline-v2/lib/connect.py b/ops/pipeline-v2/lib/connect.py index d80bb800c..2c5633968 100644 --- a/ops/pipeline-v2/lib/connect.py +++ b/ops/pipeline-v2/lib/connect.py @@ -63,7 +63,7 @@ def _build_search_text(content: str) -> str: return " ".join(parts) -def _add_related_edges(claim_path: str, neighbor_titles: list[str]) -> bool: +def _add_related_edges(claim_path: str, neighbor_slugs: list[str]) -> bool: """Add related edges to a claim's frontmatter. Returns True if modified.""" try: with open(claim_path) as f: @@ -87,10 +87,10 @@ def _add_related_edges(claim_path: str, neighbor_titles: list[str]) -> bool: # Add new edges added = [] - for title in neighbor_titles: - if title.strip().lower() not in existing_lower: - added.append(title) - existing_lower.add(title.strip().lower()) + for slug in neighbor_slugs: + if slug.strip().lower() not in existing_lower: + added.append(slug) + existing_lower.add(slug.strip().lower()) if not added: return False @@ -167,27 +167,28 @@ def connect_new_claims( stats["skipped_no_neighbors"] += 1 continue - # Extract neighbor titles - neighbor_titles = [] + # Extract neighbor slugs (filename stems, not titles — reciprocal edges need resolvable names) + neighbor_slugs = [] for hit in hits: payload = hit.get("payload", {}) - title = payload.get("claim_title", "") - if title: - neighbor_titles.append(title) + claim_path_qdrant = payload.get("claim_path", "") + if claim_path_qdrant: + slug = claim_path_qdrant.rsplit("/", 1)[-1].replace(".md", "") + neighbor_slugs.append(slug) - if not neighbor_titles: + if not neighbor_slugs: stats["skipped_no_neighbors"] += 1 continue # Add edges to the new claim's frontmatter - if _add_related_edges(claim_path, neighbor_titles): + if _add_related_edges(claim_path, neighbor_slugs): stats["connected"] += 1 - stats["edges_added"] += len(neighbor_titles) + stats["edges_added"] += len(neighbor_slugs) stats["connections"].append({ "claim": os.path.basename(claim_path), - "neighbors": neighbor_titles, + "neighbors": neighbor_slugs, }) - logger.info("Connected %s → %d neighbors", os.path.basename(claim_path), len(neighbor_titles)) + logger.info("Connected %s → %d neighbors", os.path.basename(claim_path), len(neighbor_slugs)) else: stats["skipped_no_neighbors"] += 1