Skip to content

Comments

[pull] main from forem:main#76

Merged
pull[bot] merged 1 commit intoamishakov:mainfrom
forem:main
Sep 11, 2025
Merged

[pull] main from forem:main#76
pull[bot] merged 1 commit intoamishakov:mainfrom
forem:main

Conversation

@pull
Copy link

@pull pull bot commented Sep 11, 2025

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 : )

* 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>
@pull pull bot locked and limited conversation to collaborators Sep 11, 2025
@pull pull bot added the ⤵️ pull label Sep 11, 2025
@pull pull bot merged commit fe302d5 into amishakov:main Sep 11, 2025
2 of 3 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant