Skip to content

fix(worthiness): preserve a configured min_score of 0 - #603

Merged
plind-junior merged 2 commits into
vouchdev:testfrom
Yurii214:fix/worthiness-min-score-zero
Jul 30, 2026
Merged

fix(worthiness): preserve a configured min_score of 0#603
plind-junior merged 2 commits into
vouchdev:testfrom
Yurii214:fix/worthiness-min-score-zero

Conversation

@Yurii214

@Yurii214 Yurii214 commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

summary

worthiness.load_config builds min_score with _as_float(raw.get("min_score")) or DEFAULT_MIN_SCORE. _as_float returns 0.0 for a configured min_score: 0, and 0.0 or 0.4 is 0.4 — so a kb that sets worthiness.min_score: 0 in config.yaml silently gets the default instead. the or conflates three distinct inputs — unset, unparseable, and the legitimate value zero — and rewrites the last one.

min_score: 0 is a meaningful, distinct setting (compute worthiness but never let the threshold defer a claim — unlike scorer: off, which computes nothing), so it should be honored verbatim. the existing contract test test_load_config_parses_block already asserts a configured 0.6 is honored; this restores the same rule for 0.

the sibling admission.py uses the identical _as_float(...) or DEFAULT idiom but is unaffected only because its default is 0.0 (a no-op); every other numeric config loader (enrich, session_split, compile, retrieval_events, inbox) preserves a legitimate zero. worthiness is the lone outlier.

fix

fall back to DEFAULT_MIN_SCORE only when the value is absent or unparseable (is not None), not when it is a real 0.0.

test

test_load_config_preserves_zero_min_score writes min_score: 0 and asserts the loaded value is 0.0; it fails on the current code (loads 0.4) and passes with the fix.

validation

make check green: ruff check src tests, mypy src (no issues, 116 files), pytest tests/ --ignore=tests/embeddings (all pass).

Summary by CodeRabbit

  • Bug Fixes

    • Explicitly configured minimum worthiness scores of 0 are now preserved instead of being replaced by the default.
  • Tests

    • Added coverage to verify zero-valued minimum scores remain effective.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

load_config() now preserves an explicitly configured worthiness.min_score of 0.0, falling back to the default only when parsing returns None. A unit test verifies the zero-valued configuration.

Changes

Worthiness configuration

Layer / File(s) Summary
Minimum score parsing and regression coverage
src/vouch/worthiness.py, tests/test_worthiness.py
load_config() uses the parsed value when it is 0.0, and a unit test confirms that an explicit min_score: 0 is preserved.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

  • vouchdev/vouch#553: Modifies the same load_config() minimum-score parsing behavior around explicit 0.0 values.

Suggested labels: ci: passing

Suggested reviewers: plind-junior

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: preserving an explicitly configured min_score of 0 in worthiness config parsing.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added tests tests and fixtures size: XS less than 50 changed non-doc lines labels Jul 30, 2026
`_as_float(...) or DEFAULT_MIN_SCORE` swallowed a legitimate min_score: 0
(an explicit "never defer") and rewrote it to the 0.4 default, conflating
unset/unparseable/zero. fall back only when the value is absent or
unparseable, matching every other numeric config loader in the codebase.
@Yurii214
Yurii214 force-pushed the fix/worthiness-min-score-zero branch from 75bc032 to 8fe527a Compare July 30, 2026 04:50
coderabbitai[bot]
coderabbitai Bot previously requested changes Jul 30, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/vouch/worthiness.py`:
- Around line 213-218: Update _as_float() to reject bool values before float
conversion, returning None so load configuration falls back to
DEFAULT_MIN_SCORE. Add regression coverage verifying YAML min_score values off
and on both use the default.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 142cf342-c8e9-4b01-bbd6-037a6b0a90de

📥 Commits

Reviewing files that changed from the base of the PR and between 75bc032 and 8fe527a.

📒 Files selected for processing (2)
  • src/vouch/worthiness.py
  • tests/test_worthiness.py

Comment thread src/vouch/worthiness.py
@plind-junior
plind-junior enabled auto-merge July 30, 2026 08:20
@github-actions
github-actions Bot disabled auto-merge July 30, 2026 08:20
@plind-junior
plind-junior enabled auto-merge July 30, 2026 08:33
@plind-junior
plind-junior dismissed coderabbitai[bot]’s stale review July 30, 2026 08:33

Disabled coderabbit review

@plind-junior
plind-junior merged commit 80c32b5 into vouchdev:test Jul 30, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: XS less than 50 changed non-doc lines tests tests and fixtures

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants