Skip to content

feat(scoring): add trusted PDS bonus - #2

Merged
Kzoeps merged 1 commit into
mainfrom
labeler-gainforest-id
Jun 1, 2026
Merged

feat(scoring): add trusted PDS bonus#2
Kzoeps merged 1 commit into
mainfrom
labeler-gainforest-id

Conversation

@Kzoeps

@Kzoeps Kzoeps commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add TRUSTED_PDS_HOSTS and TRUSTED_PDS_BONUS config with defaults for certified.one and gainforest.id
  • award the trusted-PDS bonus after actor DID -> PDS resolution and recompute
  • show the trusted PDS bonus in dashboard scoring breakdown and docs

Verification

  • npm test
  • npm run build
  • local full-stack smoke with Tap using TAP_SIGNAL_COLLECTION=app.certified.actor.profile and TAP_COLLECTION_FILTERS=app.certified.actor.profile,app.certified.actor.organization; verified a gainforest.id actor recomputed from trustedPds: 0 to trustedPds: 10

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced "Trusted PDS bonus" scoring: actors using designated data providers now receive configurable bonus points toward their overall score
    • Added configuration options to specify trusted PDS providers and bonus value (includes sensible defaults)
  • Documentation

    • Updated scoring rubric and documentation to reflect the new trusted PDS bonus component in score calculations

@coderabbitai

coderabbitai Bot commented Jun 1, 2026

Copy link
Copy Markdown

Review Change Stack

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Free

Run ID: 2d9ac523-1a87-4ebe-9f03-787a92514969

📥 Commits

Reviewing files that changed from the base of the PR and between 062a6d7 and de68107.

📒 Files selected for processing (15)
  • .env.example
  • README.md
  • src/app/docs/page.tsx
  • src/components/ScoreBreakdown.tsx
  • src/components/ScoreCard.tsx
  • src/labeler/tap-consumer.ts
  • src/lib/actor-pds-policy.ts
  • src/lib/config.ts
  • src/lib/constants.ts
  • src/lib/pds-utils.ts
  • src/lib/scorer.ts
  • src/lib/scoring-input.ts
  • src/lib/types.ts
  • tests/pds-test-override.test.ts
  • tests/trusted-pds-bonus.test.ts

📝 Walkthrough

Walkthrough

Organization scoring now includes a configurable bonus for actors hosted on trusted PDS servers. Environment variables define the trusted hosts and bonus amount, the scorer computes the bonus when an actor's resolved PDS host matches, and UI components display the bonus as an additional scoring criterion alongside completeness signals.

Changes

Trusted PDS Bonus Implementation

Layer / File(s) Summary
Configuration and constants
.env.example, src/lib/constants.ts, src/lib/config.ts
Environment variables TRUSTED_PDS_HOSTS and TRUSTED_PDS_BONUS are added with defaults; constants export DEFAULT_TRUSTED_PDS_HOSTS and DEFAULT_TRUSTED_PDS_BONUS; score thresholds adjust high-quality tier max to Number.POSITIVE_INFINITY to accommodate bonus-inflated scores; new nonNegativeIntegerEnv helper validates bonus amounts as non-negative integers.
PDS host parsing and matching
src/lib/pds-utils.ts, src/lib/actor-pds-policy.ts
parsePdsHosts helper parses comma-separated host lists and normalizes entries; isConfiguredPdsHost centralizes exact-match logic against configured lists; parseTestPdsHosts and isConfiguredTestPdsHost delegate to these reusable helpers; actor-pds-policy.ts adds trustedPdsBonusEnabled() and actorPdsResolutionEnabled() gates, updating resolution job enqueueing and host caching to include trusted-bonus scenarios.
Scoring types and contracts
src/lib/types.ts, src/lib/scoring-input.ts
ScoreBreakdown adds trustedPds: number field; ScoreResult.totalScore comment clarifies it includes configured bonuses; MergedScoringInput extends with actorPdsHost, trustedPdsHosts, and trustedPdsBonus fields.
Trusted PDS bonus calculation
src/lib/scorer.ts
New scoreTrustedPdsBonus() helper returns the configured bonus only when positive and the actor's resolved PDS host matches trusted hosts; scoreActivity() computes trustedPds from this helper and includes it in the returned breakdown.
Labeler integration
src/labeler/tap-consumer.ts
recomputeLabeledOrganizationRow wires trusted PDS configuration and the cached actor host into the scoring input.
Score display components
src/components/ScoreCard.tsx, src/components/ScoreBreakdown.tsx
ScoreCard clamps score width to [0, 100] to prevent overflow; ScoreBreakdown supports criteria with dynamic max values computed from breakdown fields and introduces the "Trusted PDS bonus" criterion with max derived from the bonus amount.
Documentation and rubric
README.md, src/app/docs/page.tsx
README documents the new trusted PDS bonus component, its configuration, resolution behavior, and recomputation timing; Docs page imports bonus defaults, adds the "Trusted PDS bonus" criterion to the scoring table, adjusts total from 100 to 100 + bonus, and updates quality-tier display to 70+.
Test coverage
tests/pds-test-override.test.ts, tests/trusted-pds-bonus.test.ts
Existing test fixture adds trustedPds: 0 field; new test file covers matching on resolved actor PDS host, distinguishing host from website domain, and exact host matching after normalization.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

A rabbit hops with glee so bright, 🐰
Trusted PDS hosts shine in the light,
Bonus points reward the worthy crew,
Scores now dance with credibility true,
Configuration blooms, tests verify right!


Note

🎁 Summarized by CodeRabbit Free

Your organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Pro by visiting https://app.coderabbit.ai/login.

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

@sonarqubecloud

sonarqubecloud Bot commented Jun 1, 2026

Copy link
Copy Markdown

@Kzoeps
Kzoeps merged commit 72f1bf0 into main Jun 1, 2026
3 checks passed
@Kzoeps
Kzoeps deleted the labeler-gainforest-id branch June 1, 2026 13:01
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