Skip to content

Feat/relevance threshold route#226

Merged
LeonardoVieira1630 merged 13 commits intodevfrom
feat/relevance_threshold_route
Mar 9, 2026
Merged

Feat/relevance threshold route#226
LeonardoVieira1630 merged 13 commits intodevfrom
feat/relevance_threshold_route

Conversation

@LeonardoVieira1630
Copy link
Member

Summary

  • Add GetEventRelevanceThreshold GraphQL query and threshold repository to fetch relevance thresholds from the anticapture API
  • Refactor voting power changed trigger to filter notifications based on relevance threshold
  • Add tests for threshold repository and voting power trigger, along with type exports in the anticapture client

Test plan

  • Threshold repository unit tests added
  • Voting power trigger tests updated
  • Anticapture client tests updated

@LeonardoVieira1630 LeonardoVieira1630 self-assigned this Mar 4, 2026
@LeonardoVieira1630 LeonardoVieira1630 added the enhancement New feature or request label Mar 4, 2026
@vercel
Copy link

vercel bot commented Mar 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flow-editor Ready Ready Preview, Comment Mar 6, 2026 7:21pm
notification-system-dashboard Ready Ready Preview, Comment Mar 6, 2026 7:21pm

Request Review

Copy link
Member

@pikonha pikonha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some things to consider, nothing to block it

Comment on lines +65 to +75
const keep = await Promise.all(
data.map(async (event) => {
const type = event.changeType.toUpperCase();
if (!Object.values(FeedEventType).includes(type as FeedEventType)) return true;

const threshold = await this.thresholdRepository.getThreshold(event.daoId, type as FeedEventType);
return threshold === null || Math.abs(Number(event.delta)) >= Number(threshold);
})
);

return data.filter((_, i) => keep[i]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couldn't this be added to the votes endpoint query? i.e, votes(fromDelta: <vote high relevance>)

we currently don't have it supported, but it would be a piece of cake to add it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On votes, yes!

But on this case, (voting power changes), it would not work. The flow here is:

  • fetch ALL vp changes;
  • loop -> filter considering the event type (delegation or transfer).

As the threshold could be different for each type, we cannot filter on the query. We need to get all, then filter locally. The other option would be to use "relevance" as a query parameter, then the api filter on the repo-layer (but it looks ugly).

@LeonardoVieira1630 LeonardoVieira1630 merged commit 7a080ed into dev Mar 9, 2026
10 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants