fix(import): prevent placeholder parents from missing in text search#805
Open
vcnainala wants to merge 5 commits into
Open
fix(import): prevent placeholder parents from missing in text search#805vcnainala wants to merge 5 commits into
vcnainala wants to merge 5 commits into
Conversation
When an entry has stereocenters but no defined stereochemistry, the parent molecule becomes the canonical record but was left flagged as a placeholder. That excluded real compounds from text search (fixes #506). Align ImportEntry and ImportEntryAuto with ImportEntriesAuto, and extend coconut:update-parent-variants-counts to clear is_placeholder on parents that have no variants.
Add unit tests for SearchMolecule text search and UpdateParentVariantsCounts command. Configure Sail-compatible test database via .env.testing and remove hardcoded DB_HOST from phpunit.xml.
Fixes #506
Clear config before migrate so CI env vars take effect, and stop .env.testing from overriding DB_HOST so GitHub Actions can reach Postgres on localhost.
Laravel loads .env.testing when APP_ENV=testing, so the key generated in .env during CI setup was ignored and caused MissingAppKeyException.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## development #805 +/- ##
================================================
+ Coverage 6.13% 7.30% +1.16%
- Complexity 1737 1739 +2
================================================
Files 227 227
Lines 8961 8967 +6
================================================
+ Hits 550 655 +105
+ Misses 8411 8312 -99 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Fixes #506
Summary
is_placeholderwhen import jobs assign a parent molecule as the canonical record without creating a stereo variant, matching the existingImportEntriesAutobehaviourcoconut:update-parent-variants-countsto resetis_placeholderfor parents that have no variants, remediating any already-imported recordsSearchMoleculeandUpdateParentVariantsCounts, plus Sail-compatible test DB configurationProblem
Compounds such as CNP0571280.0 (Mirabilin B) could be reachable on their compound page but absent from text search. This happened when a parent molecule was created for undefined stereochemistry and left with
is_placeholder = trueeven though no variants existed.Changes
ImportEntry/ImportEntryAutois_placeholderwhen stereo is undefined and the parent is the canonical moleculeUpdateParentVariantsCountsis_placeholderfor parents without variants.env.testingfor Sail; remove hardcodedDB_HOSTfromphpunit.xmlTest plan
./vendor/bin/sail artisan test --filter='SearchMoleculeTest|UpdateParentVariantsCountsTest'php artisan coconut:update-parent-variants-countson staging/production to remediate existing mis-flagged parentshttps://coconut.naturalproducts.net/search?q=Mirabilin+Breturns CNP0571280.0 alongside synonym matches