Skip to content

auto-triage: allow Empty media (zero compounds) without ValueError - #6

Closed
jplfaria wants to merge 1 commit into
mainfrom
auto-triage/empty-media-valueerror
Closed

jplfaria wants to merge 1 commit into
mainfrom
auto-triage/empty-media-valueerror

Conversation

@jplfaria

@jplfaria jplfaria commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Fix _apply_media in src/modelseed_api/jobs/tasks.py to distinguish Empty media (zero mediacompounds) from the case where compounds are present but none match model exchange reactions. Empty media now closes all exchanges (cobra_model.medium = {}); the no-match case remains a warning-only path.
  • Add regression tests in tests/unit/test_load_media_and_apply_media.py covering both _load_media (empty compounds no longer raises) and _apply_media (empty media closes all exchanges, no-match is a warning, non-empty media opens the right exchanges).

Fixes ModelSEED/modelseed-api-ops#34

Root cause

The Empty workspace object at /chenry/public/modelsupport/media/Empty intentionally has zero mediacompounds, meaning all exchanges closed. The _apply_media function was treating empty media identically to the no-match case, leaving default exchange bounds instead of closing all exchanges.

Test plan

  • Run pytest tests/unit/test_load_media_and_apply_media.py -v -- all 6 tests pass
  • Confirm FBA jobs with Empty media complete without error and return zero growth
  • Confirm FBA jobs with non-empty media still work correctly

Generated with Claude Code

Refine _apply_media to distinguish three cases:
- compounds matched: open those exchanges
- compounds present but no match: warning, leave default bounds
- zero compounds (Empty media): close all exchanges

Add regression tests in tests/unit/test_load_media_and_apply_media.py
covering all three cases plus _load_media empty-compound handling.

Fixes ModelSEED/modelseed-api-ops#34
@jplfaria
jplfaria force-pushed the auto-triage/empty-media-valueerror branch from b9d893e to 89d23e9 Compare September 29, 2026 19:51
@jplfaria

Copy link
Copy Markdown
Contributor Author

Superseded by a9b7a72, which fixes Empty-media handling in both Celery and subprocess FBA paths, preserves malformed-payload errors, and includes regression coverage. That commit is deployed and production biological acceptance passed: https://github.com/ModelSEED/modelseed-api/actions/runs/36621735683

@jplfaria jplfaria closed this Sep 29, 2026
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