Strip stray backslash-escaping from labels at ingestion#79
Merged
Conversation
Term/neuron labels can arrive from upstream (Cypher / string-literal escaping) with a stray backslash before an apostrophe, e.g. the label for VFB_jrchk0e3 comes through as MBON01(y5β\'2a)_L (a literal backslash before the '). Only MinimalEntityInfo.get_int_link cleaned it, so the top-level termInfo["Name"] and Meta.Name (which read core.label / core.symbol directly) kept the backslash. That stray backslash is both a display defect and, more seriously, a request hazard: a backslash is illegal in an HTTP request target, so when a value built from the label reaches a GET URL unencoded the geppetto Tomcat connector rejects the whole request line with "Invalid character found in the request target" (HTTP 400). Fix at ingestion: add a shared clean_label() helper (strips a backslash that precedes a quote/apostrophe -- never legitimate in a label, idempotent) and apply it in MinimalEntityInfo.__post_init__ so label and symbol are clean for every consumer (Name, Meta, links, synonyms). get_int_link now uses the already-clean label. Adds a regression test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RQZ8eMr398cK1bnzN2XTqK
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
Term/neuron labels can arrive from upstream (Cypher / string-literal escaping) with a stray backslash before an apostrophe. For
VFB_jrchk0e3the wire value ofget_term_infoisMBON01(y5β\'2a)_L— a literal\before the'(byte-verified onv3-cached).Only
MinimalEntityInfo.get_int_linkstripped it, so the top-leveltermInfo["Name"]andMeta.Name(which readcore.label/core.symboldirectly) kept the backslash.Beyond being a display defect, this is a request hazard: a backslash is illegal in an HTTP request target, so when a value built from the label reaches a GET URL unencoded the geppetto Tomcat connector rejects the whole request line with
Invalid character found in the request target(HTTP 400).Fix
clean_label()helper — strips a backslash that precedes a quote/apostrophe (never legitimate in a label; idempotent; leaves genuine paths likeC:\pathuntouched).MinimalEntityInfo.__post_init__solabelandsymbolare clean at ingestion for every consumer (Name, Meta, links, synonyms).get_int_linknow uses the already-clean label.test_label_stray_backslash_cleaned).Verified via
deserialize_term_info:MBON01(y5β\'2a)_L→MBON01(y5β'2a)_L(β and apostrophe preserved, backslash gone).🤖 Generated with Claude Code