fix(agent_registry): scale average_rating x100 and persist full Rating records (#94) - #234
Open
jjb9707 wants to merge 3 commits into
Open
fix(agent_registry): scale average_rating x100 and persist full Rating records (#94)#234jjb9707 wants to merge 3 commits into
jjb9707 wants to merge 3 commits into
Conversation
…g records (vespera-labs#94) - average_rating() now returns score scaled by 100 (e.g. 450 = 4.5) instead of truncated integer, avoiding systematic downward bias - rate_agent() persists the full Rating struct (rater, agent, score, rated_at) instead of just a boolean flag, making ratings auditable - Added get_agent_average_rating() and get_rating() getters - Uses checked_mul/checked_div to avoid overflow Closes vespera-labs#94
Merge upstream main (1488a77) into fix/issue-94-rating-fix to clear the dirty mergeable state that was blocking review of PR vespera-labs#234. The only conflict was in agent_registry/src/types.rs::average_rating. Upstream commit 58f7fd3 ("cross-layer KYC/screening security hardening") only reflowed the original one-line `checked_div(...).unwrap_or(0)` expression across three lines - a pure rustfmt change with no semantic difference. This PR replaces that same expression with the x100-scaled computation plus a zero-ratings guard, so the incoming formatting-only change is fully superseded. Resolution keeps this PR's implementation and loses nothing from upstream. Verified: resolved types.rs is byte-identical to the pre-merge PR head; net PR diff against new main is still only the 3 intended files (agent.rs, lib.rs, types.rs); rustfmt --check clean on all three.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #94
Changes
average_rating()returns scaled value (x100) — instead of truncated integer(e.g. 4.5 returns 450 instead of 4). Uses
checked_mul/checked_divfor safety.rate_agent()persists fullRatingstruct — stores(rater, agent, score, rated_at)instead of just a boolean flag, making individual ratings auditable.
get_agent_average_rating()andget_rating()Acceptance Criteria