Skip to content

feed: fix challenge_solve events showing wrong dojo - #1052

Open
adamdoupe wants to merge 1 commit into
masterfrom
dojo-feed-accuracy
Open

feed: fix challenge_solve events showing wrong dojo#1052
adamdoupe wants to merge 1 commit into
masterfrom
dojo-feed-accuracy

Conversation

@adamdoupe

Copy link
Copy Markdown
Contributor

Summary

  • Fix live feed showing the wrong dojo for challenge solves when a challenge exists in multiple dojos
  • The root cause was DojoChallenges.query.filter_by(challenge_id=...).first() in DojoChallenge.solve(), which returned an arbitrary match rather than the dojo the user actually solved in
  • Move feed event publishing to DojoChallengeSolve.post() where the correct dojo, module, and dojo_challenge are already resolved from the request URL

Test plan

  • Add test_feed_solve_shows_correct_dojo regression test verifying feed events contain the correct dojo_id and module_id
  • All 146 tests pass (4 skipped)

🤖 Generated with Claude Code

DojoChallenge.solve() only receives the CTFd challenge_id, so it used
DojoChallenges.query.filter_by(challenge_id=...).first() to find dojo
context for the feed event. When the same challenge exists in multiple
dojos, this returned an arbitrary match rather than the dojo the user
actually solved in.

Move feed publishing to DojoChallengeSolve.post(), where the correct
dojo, module, and dojo_challenge are already resolved from the URL.

Add regression test verifying the feed event contains the correct
dojo_id and module_id after a solve.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Jan 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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