Skip to content

Limit /trends producer data to public fields - #198

Open
NetworkTheoryAppliedResearchInstitute wants to merge 1 commit into
mainfrom
fix/trends-public-fields
Open

NetworkTheoryAppliedResearchInstitute wants to merge 1 commit into
mainfrom
fix/trends-public-fields

Conversation

@NetworkTheoryAppliedResearchInstitute

Copy link
Copy Markdown
Collaborator

What

/trends/top-rated and the /trends/ai/insight text now carry only public producer fields, from one allowlist in aiTrendHelper: id, username, locationType, reputationScore, reputationWeight (matching #197's public user DTO). Insight text names producers by username only. Region-filtered results leave out producers with locationPrivacy set. Bylaws §2.4, JFA line 7. No binding changes, so CONFORMANCE.md is unchanged.

Please confirm before merge: this reads a truthy locationPrivacy as private; getPublicLocations reads it the other way.

Tests

New trendsRoutes.test.js calls every trends GET route, with and without a region, and checks that fields outside the allowlist stay out. It also checks the /top-rated field set and privacy exclusion. aiTrendHelper.test.js checks the insight text the same way. 11 tests fail with the fix reverted. Full suite: node:test 61/61, Jest 63/63.

Separate item: /top-rated still ranks producers by one score (covenant rule, JFA line 8).

🤖 Generated with Claude Code

/trends/top-rated and the /trends/ai/insight text now take producer
data from one allowlist in aiTrendHelper (publicProducers): id,
username, locationType, reputationScore and reputationWeight, the
same fields as the public user DTO proposed in #197. Insight text
names producers by username only. Region-filtered results leave out
producers with locationPrivacy set. A truthy locationPrivacy is read
as private; getPublicLocations reads it the other way, so that
meaning is still to be confirmed.

Tests: a new trendsRoutes test calls every GET route registered on
the trends router, with and without a region, and checks that
producer fields outside the allowlist stay out of every response. It
also checks the /top-rated field set and the locationPrivacy
exclusion, including non-boolean values. aiTrendHelper tests check
the insight text the same way. The existing fixture now uses
username, the field Users records carry.

Signed-off-by: Jodson Graves <info@ntari.org>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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