Goal
Stop entryDecisionTrustScore from awarding the same trust bonus to an entry explicitly marked packageVerified: false as one marked packageVerified: true.
Why this matters
An explicitly-unverified package is currently scored as if it were trustworthy, which can make it outrank a genuinely safer peer in the compare baseline selection this score feeds into.
Current behavior
apps/web/src/lib/entry-detail-decision-playbook-lib.ts:
hasPackageSignals (lines 90-94):
function hasPackageSignals(entry: Pick<Entry, "packageVerified" | "downloadSha256" | "downloadUrl">) {
return Boolean(entry.packageVerified !== undefined || entry.downloadSha256 || entry.downloadUrl);
}
- Used at line 106 inside
entryDecisionTrustScore: if (hasPackageSignals(entry)) score += 8;
- Because
entry.packageVerified !== undefined short-circuits the ||, this returns true whenever packageVerified is set at all — including packageVerified: false — giving the same +8 bonus as packageVerified: true.
- Every other canonical "package trust" helper in the codebase (
packageReady in entry-adoption-plan-lib.ts, hasPackage in browse-adoption-queue-lib.ts/compare-mitigation-priority-lib.ts/entry-compare-benchmark-lib.ts, packageTrustCompareSignal in compare-entry-signals-lib.ts) correctly requires packageVerified === true. Even packageChecklist in this same file correctly distinguishes true/false/undefined for its UI checklist item.
tests/entry-detail-decision-playbook-lib.test.ts covers packageVerified: false for the checklist item but has no test for entryDecisionTrustScore, confirming the scoring path is untested.
Desired behavior
hasPackageSignals (or the trust-score logic that uses it) only awards the package-trust bonus for packageVerified === true, matching every sibling helper's convention. downloadSha256/downloadUrl presence can still independently contribute if that's the intended design — the fix should not conflate "explicitly unverified" with "has some package signal."
Scope
apps/web/src/lib/entry-detail-decision-playbook-lib.ts (hasPackageSignals, entryDecisionTrustScore)
- focused tests
Out of scope
packageChecklist (already correct)
- Other files'
hasPackage/packageReady helpers (already correct, reference only)
Acceptance criteria
- PR includes
Closes #<issue>.
- An entry with
packageVerified: false and no other package signals no longer receives the +8 trust bonus.
- An entry with
packageVerified: true still receives it.
- A new test covers
entryDecisionTrustScore for packageVerified: false explicitly.
Quality evidence required in the PR
- No visual impact; include the exact scoring delta for a
packageVerified: false entry before/after.
Validation
pnpm build
pnpm exec vitest run tests/entry-detail-decision-playbook-lib.test.ts
git diff --check
Goal
Stop
entryDecisionTrustScorefrom awarding the same trust bonus to an entry explicitly markedpackageVerified: falseas one markedpackageVerified: true.Why this matters
An explicitly-unverified package is currently scored as if it were trustworthy, which can make it outrank a genuinely safer peer in the compare baseline selection this score feeds into.
Current behavior
apps/web/src/lib/entry-detail-decision-playbook-lib.ts:hasPackageSignals(lines 90-94):entryDecisionTrustScore:if (hasPackageSignals(entry)) score += 8;entry.packageVerified !== undefinedshort-circuits the||, this returnstruewheneverpackageVerifiedis set at all — includingpackageVerified: false— giving the same +8 bonus aspackageVerified: true.packageReadyinentry-adoption-plan-lib.ts,hasPackageinbrowse-adoption-queue-lib.ts/compare-mitigation-priority-lib.ts/entry-compare-benchmark-lib.ts,packageTrustCompareSignalincompare-entry-signals-lib.ts) correctly requirespackageVerified === true. EvenpackageChecklistin this same file correctly distinguishestrue/false/undefinedfor its UI checklist item.tests/entry-detail-decision-playbook-lib.test.tscoverspackageVerified: falsefor the checklist item but has no test forentryDecisionTrustScore, confirming the scoring path is untested.Desired behavior
hasPackageSignals(or the trust-score logic that uses it) only awards the package-trust bonus forpackageVerified === true, matching every sibling helper's convention.downloadSha256/downloadUrlpresence can still independently contribute if that's the intended design — the fix should not conflate "explicitly unverified" with "has some package signal."Scope
apps/web/src/lib/entry-detail-decision-playbook-lib.ts(hasPackageSignals,entryDecisionTrustScore)Out of scope
packageChecklist(already correct)hasPackage/packageReadyhelpers (already correct, reference only)Acceptance criteria
Closes #<issue>.packageVerified: falseand no other package signals no longer receives the +8 trust bonus.packageVerified: truestill receives it.entryDecisionTrustScoreforpackageVerified: falseexplicitly.Quality evidence required in the PR
packageVerified: falseentry before/after.Validation
pnpm build
pnpm exec vitest run tests/entry-detail-decision-playbook-lib.test.ts
git diff --check