Repository navigation
fix(identifierLookup): stop rejecting valid short SMILES strings - #42
Conversation
The generic short-token gibberish guard in isReasonableInput ran before the per-type switch, so any 2-3 character lowercase SMILES not in the atom allowlist (e.g. CC ethane, CCO ethanol, CCN ethylamine) was rejected with 'Invalid smiles' before any lookup. Skip that heuristic for smiles/inchi, which already have dedicated format checks. Relates to #4. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_016JeXARZo3JvULrjBzujdzV
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
|
|
The It's the exact conflict already tracked/fixed by #41. Once #41 lands, I'll merge Generated by Claude Code |
There was a problem hiding this comment.
Pull request overview
This PR fixes pre-validation in src/utils/identifierLookup.ts so valid short SMILES strings (e.g., CC, CCO, CCN, CCC) are no longer rejected as “very short gibberish” before the per-identifier-type validation and lookup logic runs.
Changes:
- Skips the short lowercase-token “gibberish” heuristic for
smilesandinchi. - Adds inline comments explaining why short SMILES must bypass that heuristic.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Heads-up on the red check here: the The actual fix is #41, which migrates to the ESLint 10 flat config, bumps Generated by Claude Code |



Summary
In
isReasonableInput, the generic short-token gibberish guardran before the per-type
switch, so any 2–3 character lowercase SMILES not in the atom allowlist was rejected with "Invalid {sourceType}" beforelookupChemicalIdentifiersever consulted the local DB or PubChem. That silently breaks valid molecules such asCC(ethane),CCO(ethanol),CCN(ethylamine), andCCC(propane) — even ones present in the built-incommonCompoundstable.Change
Skip that heuristic for
smilesandinchi, which already have dedicated format checks inside theswitch. Other identifier types (IUPAC names, etc.) still get the short-gibberish guard unchanged.Verification
Simulated
isReasonableInputover representative inputs:CC/CCO/CCN/CCCc1ccccc1xyz(gibberish)waterSingle-atom SMILES (
O,C,N) remain gated by the pre-existinglength < 2check — a separate limitation left out of scope here.Relates to #4 (limited SMILES parser). The repo has no test framework configured, so the change is validated by logic simulation rather than a unit test.
Generated by Claude Code