Fix spurious new-assessment log entries for renamed articles#1126
Open
arnchlmcodes wants to merge 4 commits intoopenzim:mainfrom
Open
Fix spurious new-assessment log entries for renamed articles#1126arnchlmcodes wants to merge 4 commits intoopenzim:mainfrom
arnchlmcodes wants to merge 4 commits intoopenzim:mainfrom
Conversation
audiodude
approved these changes
Mar 27, 2026
Member
audiodude
left a comment
There was a problem hiding this comment.
This looks great! Please add the tests now.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Heyy @audiodude During update_project_assessments_by_kind, any article whose ref is absent from old_ratings gets treated as new. The problem is that a renamed article will always look new at this stage because the old name is what's stored in old_ratings, not the new one. Previously, store_new_ratings would immediately call add_log_for_rating for these, writing a spurious log entry with old_rating_value defaulting to NotA-Class.
The fix defers those log entries into a list instead of writing them immediately. Only articles that already existed in old_ratings but had a rating change get logged right away, since an existing ref changing its rating cannot be a rename.
process_unseen_articles runs after both quality and importance passes complete. For each old ref that wasn't seen, it calls get_move_data() to check if the article was renamed. If a move is detected, the destination ref is added to a moved_articles set. Back in update_project_assessments, the deferred logs are then written only for refs not present in moved_articles, ensuring that renamed articles don't get a spurious new-assessment log entry while genuinely new articles are logged correctly.
fixes issue #72
let me know if the fix is correct, I'll start working on the test cases next.