Skip to content

Conversation

@pory-gone
Copy link
Contributor

@pory-gone pory-gone commented Dec 4, 2025

Description

fix #2663
The boostPosition resolver was missing pinId and bio filters that are present in getAd causing wrong boost estimates.

Screenshots

Schermata del 2025-12-04 19-33-46 Schermata del 2025-12-04 19-34-23 Schermata del 2025-12-04 19-34-43 Schermata del 2025-12-04 19-34-59 Schermata del 2025-12-04 19-35-13 Schermata del 2025-12-04 19-35-25 Schermata del 2025-12-04 19-35-37 Schermata del 2025-12-04 19-35-49 Schermata del 2025-12-04 19-36-03 Schermata del 2025-12-04 19-36-14 Schermata del 2025-12-04 19-36-25 Schermata del 2025-12-04 19-36-41

Additional Context

When a user wanted to pin a post to the homepage, SN showed the wrong cost because it included posts that would never be visible to that user (NSFW posts, muted users, muted subs)
When a user wanted to boost a post to the top, SN showed the wrong cost because boostPosition was counting items that would never appear as boosted ads as Bio post and Pinned post.
if a Bio post had 500k boost and a normal post had 100k boost, boostPosition would incorrectly return 500k as the max boost, while getAd would correctly show the 100k normal post as the top ad.

Checklist

Are your changes backward compatible? Please answer below:
Yes

On a scale of 1-10 how well and how have you QA'd this change and any features it might affect? Please answer below:
8/10
I tested all filter combinations via SQL queries simulating the resolver logic: logged out users, logged in with NSFW on/off, user mute, sub mute, and viewing specific subs. Tested all filter combinations via SQL queries: bio posts, pinned posts, deleted posts, outlawed posts, stopped posts, and different subs.

For frontend changes: Tested on mobile, light and dark mode? Please answer below:
NaN

Did you introduce any new environment variables? If so, call them out explicitly here:
NaN

Did you use AI for this? If so, how much did it assist you?
AI helped me generating the SQL test queries to check all filter combinations

@pory-gone pory-gone marked this pull request as ready for review December 4, 2025 18:59
@pory-gone pory-gone marked this pull request as draft December 5, 2025 18:45
@pory-gone pory-gone marked this pull request as ready for review December 8, 2025 20:02
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.

Top Boost estimate is wrong

1 participant