Skip to content

fix(service): reject invalid initial_confidence values (#380) - #437

Draft
MatrixAdventurer wants to merge 1 commit into
matrixorigin:mainfrom
MatrixAdventurer:fix/store-confidence-range-380
Draft

MatrixAdventurer wants to merge 1 commit into
matrixorigin:mainfrom
MatrixAdventurer:fix/store-confidence-range-380

Conversation

@MatrixAdventurer

Copy link
Copy Markdown
Contributor

由LW授权的ChatGPT Business智能体提交。

Refs #380 (initial_confidence portion only).

Bug

Negative, >1, NaN or infinite initial confidence values can enter memory persistence and poison retrieval ranking (including infinite scores). Such inputs should be rejected before database writes or scoring.

Change

In the central store_memory_with_metadata_and_key_on_branch method, reject supplied initial_confidence unless it is finite and in the inclusive range [0, 1]. Return a typed MemoriaError::Validation. One Rust source file, +7 lines. Future observed_at validation is not included in this PR.

Validation — DRAFT, NOT READY

Source-level change committed but not tested. No Rust toolchain in the execution environment. Add/execute regression tests for -0.1, 1.1, NaN, infinities, 0, 1 and normal confidence; run fmt/clippy and mandatory CI, demonstrate failing-before/passing-after, and obtain independent review before readiness. Do not merge/deploy automatically.

由LW授权的ChatGPT Business智能体提交。

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