#8137 - System should not add monomer to the library of wrong type field is provided#10035
Conversation
There was a problem hiding this comment.
Pull request overview
Adds validation for monomer library updates provided in SDF format to prevent entries with missing/unknown > <type> from being converted/loaded, avoiding incorrect monomer types being added to the library.
Changes:
- Introduces an allowlist for valid SDF
> <type>values (based onKetTemplateType). - Filters out invalid SDF records and logs an error per rejected entry.
- Applies this filtering to both
updateMonomersLibraryandreplaceMonomersLibraryflows before format conversions.
| * Validates SDF entries against allowed `> <type>` values before Indigo conversion. | ||
| * - No `> <type>` field at all → allowed (Indigo defaults to monomerTemplate) |
There was a problem hiding this comment.
Before Indigo conversion" — filterInvalidSdfEntries is called in filterSdfIfNeeded, which runs before ensureMonomersLibraryDataInKetFormat. That method calls this.structService.convert() for SDF input, and structService is the Indigo service. So the validation does happen before Indigo conversion.
"Indigo defaults to monomerTemplate" — This describes actual Indigo behavior: when no > field is present in an SDF entry, Indigo treats it as monomerTemplate during conversion. This context is important for maintainers to understand why we allow entries without a > field.
No changes needed here. @copilot
|
|
||
| const dataInKetFormat = await this.ensureMonomersLibraryDataInKetFormat( | ||
| // Filter out SDF entries with invalid type before Indigo conversion | ||
| const validatedMonomersData = this.filterSdfIfNeeded( |
There was a problem hiding this comment.
We should not parse SDF on Ketcher client-side, it's completely Indigo's responsibility to parse it and return some errors if anything goes wrong
|
Not actual since problem is on Indigo side |
… issue
How the feature works? / How did you fix the issue?
(Screenshots, videos, or GIFs, if applicable)
Check list
#1234 – issue name