Skip to content

Strip stray backslash-escaping from labels at ingestion#79

Merged
Robbie1977 merged 1 commit into
mainfrom
fix/label-stray-backslash-escaping
Jul 16, 2026
Merged

Strip stray backslash-escaping from labels at ingestion#79
Robbie1977 merged 1 commit into
mainfrom
fix/label-stray-backslash-escaping

Conversation

@Robbie1977

Copy link
Copy Markdown
Contributor

Problem

Term/neuron labels can arrive from upstream (Cypher / string-literal escaping) with a stray backslash before an apostrophe. For VFB_jrchk0e3 the wire value of get_term_info is MBON01(y5β\'2a)_L — a literal \ before the ' (byte-verified on v3-cached).

Only MinimalEntityInfo.get_int_link stripped it, so the top-level termInfo["Name"] and Meta.Name (which read core.label / core.symbol directly) 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

  • Add a shared clean_label() helper — strips a backslash that precedes a quote/apostrophe (never legitimate in a label; idempotent; leaves genuine paths like C:\path untouched).
  • Apply it in MinimalEntityInfo.__post_init__ so label and symbol are clean at ingestion for every consumer (Name, Meta, links, synonyms).
  • get_int_link now uses the already-clean label.
  • Adds a regression test (test_label_stray_backslash_cleaned).

Verified via deserialize_term_info: MBON01(y5β\'2a)_LMBON01(y5β'2a)_L (β and apostrophe preserved, backslash gone).

🤖 Generated with Claude Code

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
@Robbie1977
Robbie1977 merged commit ce7530e into main Jul 16, 2026
0 of 4 checks passed
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