Skip to content

fix(agent_registry): scale average_rating x100 and persist full Rating records (#94) - #234

Open
jjb9707 wants to merge 3 commits into
vespera-labs:mainfrom
jjb9707:fix/issue-94-rating-fix
Open

fix(agent_registry): scale average_rating x100 and persist full Rating records (#94)#234
jjb9707 wants to merge 3 commits into
vespera-labs:mainfrom
jjb9707:fix/issue-94-rating-fix

Conversation

@jjb9707

@jjb9707 jjb9707 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #94

Changes

  1. average_rating() returns scaled value (x100) — instead of truncated integer
    (e.g. 4.5 returns 450 instead of 4). Uses checked_mul/checked_div for safety.
  2. rate_agent() persists full Rating struct — stores (rater, agent, score, rated_at)
    instead of just a boolean flag, making individual ratings auditable.
  3. New getters: get_agent_average_rating() and get_rating()

Acceptance Criteria

  • average_rating returns scaled value (x100), documented in code
  • rate_agent persists the full Rating record
  • Getter exposes agent's average rating and individual ratings

jjb9707 and others added 3 commits July 10, 2026 12:15
…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.
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