Skip to content

Surface the score-direction assumption in dock_diverse - #111

Merged
roshan2004 merged 1 commit into
mainfrom
dock-diverse-direction-assumed
Jun 8, 2026
Merged

Surface the score-direction assumption in dock_diverse#111
roshan2004 merged 1 commit into
mainfrom
dock-diverse-direction-assumed

Conversation

@roshan2004

Copy link
Copy Markdown
Owner

Continues the docking review. Every docking entry point reports when it had to guess a score field's direction (lower-is-better, the docking convention) — except dock_diverse, which took only the boolean from higher_is_better() and dropped the assumed flag (cli.py and mcp_server.py both did higher_is_better(field)[0]). A user diversifying hits on an unrecognised score field got a shortlist silently ranked by a guessed direction, while dock_summary / dock_rank / dock_report all warned.

Changes

  • docking.pyDiverseResult gains a direction_assumed field; select_diverse_hits accepts and records it. Default False, fully backward-compatible.
  • CLI_run_dock_diverse captures (higher, assumed) and prints a (lower-is-better, assumed; pass --higher/--lower-is-better) note, matching dock_summary's wording.
  • MCP — the dock_diverse payload now includes direction and direction_assumed, matching dock_summary's keys exactly.

Scope note

I deliberately did not make docking refuse to run on an unknown field (one option raised in review). The assumption-with-notice pattern is already the established design across the other dock tools; dock_diverse was simply the one place that skipped the notice. This change makes it consistent rather than changing the contract.

Tests

4 new/extended tests: core threading of the flag, the CLI warning on an unrecognised field, and the MCP payload keys. Full suite: 866 passed, 21 skipped. ruff check clean.

Every docking entry point reports when it had to guess a score field's
direction (lower-is-better, the docking convention) except dock_diverse,
which took only the boolean from higher_is_better() and dropped the
"assumed" flag. A user diversifying hits on an unrecognised score field
got a shortlist silently ranked by a guessed direction while
dock_summary/dock_rank/dock_report all warned.

Bring it in line:
- DiverseResult gains direction_assumed; select_diverse_hits records it
  (default False, backward-compatible).
- The CLI prints a "(... assumed; pass --higher/--lower-is-better)" note
  matching dock_summary's wording.
- The MCP payload adds direction and direction_assumed, matching
  dock_summary's keys.
@codecov

codecov Bot commented Jun 8, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
molscope/cli.py 66.66% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@roshan2004
roshan2004 merged commit db174cc into main Jun 8, 2026
11 of 12 checks passed
@roshan2004
roshan2004 deleted the dock-diverse-direction-assumed branch June 8, 2026 19:47
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