Merged
Conversation
* Add enhanced article enhancement to HandleSpamWorker - Create Ai::ArticleEnhancer service for clickbait scoring and tag generation - Add clickbait_score calculation with retry logic after spam processing - Implement two-pass AI tag selection: top 10 by relevance, then 2-4 by summaries - Filter tags by subforem relationships and top 150 hotness score - Apply tags only to articles with no tags, score >= 0, and clickbait < 0.6 - Add comprehensive error handling and logging throughout - Include full test coverage for all functionality and edge cases Co-authored-by: Ona <no-reply@ona.com> * Fix test failures in article enhancement functionality - Fix clickbait score parsing to handle negative numbers properly - Fix RSpec mock chaining syntax for multiple AI calls - Fix tag creation conflicts using find_or_create_by - Fix AI client spy setup for proper call tracking - Ensure tests have proper setup for candidate tags and early returns Co-authored-by: Ona <no-reply@ona.com> * Fix test failures by properly mocking candidate tags and article state - Mock get_candidate_tags method to return test tags in ArticleEnhancer specs - Use enhancer instances in tests to allow proper method mocking - Mock article.update_score to prevent score changes affecting test conditions - Ensure all test scenarios have proper setup for tag generation criteria - Fix AI client call expectations by providing candidate tags Co-authored-by: Ona <no-reply@ona.com> * Fix test failures by creating articles without tags in factories - Use with_tags: false in article factories to ensure no default tags - Remove redundant tag clearing code since articles start without tags - Ensure proper test setup for tag generation conditions - Fix AI client call expectations with proper article state Co-authored-by: Ona <no-reply@ona.com> * Completely rewrite tests with simpler, more reliable approach - Rewrite ArticleEnhancer tests to mock Tag.from_subforem instead of complex instance mocking - Simplify worker tests to test actual behavior rather than complex mock interactions - Remove overly complex test setup that was fighting against the implementation - Focus on testing the actual outcomes rather than internal method calls - Use proper mocking patterns that align with Rails testing conventions Co-authored-by: Ona <no-reply@ona.com> * Fix remaining test failures with proper mocking - Mock get_candidate_tags method directly instead of complex Tag.from_subforem chain - Fix worker test by properly mocking enhancer instance and candidate tags - Fix error logging test by mocking enhancer to raise error at right level - Use consistent enhancer instance mocking pattern across all tests Co-authored-by: Ona <no-reply@ona.com> * Fix tests * Adjust logic --------- Co-authored-by: Ona <no-reply@ona.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.3)
Can you help keep this open source service alive? 💖 Please sponsor : )