Skip to content

fix(import): prevent placeholder parents from missing in text search#805

Open
vcnainala wants to merge 5 commits into
developmentfrom
fix/search-placeholder-parent-visibility
Open

fix(import): prevent placeholder parents from missing in text search#805
vcnainala wants to merge 5 commits into
developmentfrom
fix/search-placeholder-parent-visibility

Conversation

@vcnainala

@vcnainala vcnainala commented Jun 7, 2026

Copy link
Copy Markdown
Member

Fixes #506

Summary

  • Clear is_placeholder when import jobs assign a parent molecule as the canonical record without creating a stereo variant, matching the existing ImportEntriesAuto behaviour
  • Extend coconut:update-parent-variants-counts to reset is_placeholder for parents that have no variants, remediating any already-imported records
  • Add regression tests for SearchMolecule and UpdateParentVariantsCounts, plus Sail-compatible test DB configuration

Problem

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 = true even though no variants existed.

Changes

Area Change
ImportEntry / ImportEntryAuto Unset is_placeholder when stereo is undefined and the parent is the canonical molecule
UpdateParentVariantsCounts Also clear is_placeholder for parents without variants
Tests 5 unit tests covering search visibility and command reconciliation
Test infra .env.testing for Sail; remove hardcoded DB_HOST from phpunit.xml

Test plan

  • ./vendor/bin/sail artisan test --filter='SearchMoleculeTest|UpdateParentVariantsCountsTest'
  • Run php artisan coconut:update-parent-variants-counts on staging/production to remediate existing mis-flagged parents
  • Verify https://coconut.naturalproducts.net/search?q=Mirabilin+B returns CNP0571280.0 alongside synonym matches

vcnainala added 2 commits June 7, 2026 17:41
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.
vcnainala added 3 commits June 7, 2026 17:44
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-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 7.30%. Comparing base (4223a58) to head (c13ac37).

Files with missing lines Patch % Lines
app/Jobs/ImportEntry.php 0.00% 3 Missing ⚠️
app/Jobs/ImportEntryAuto.php 0.00% 3 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

2 participants