Migrate exists_by_qids_query from all_articles to category_members - #43
Conversation
Replace the LEFT JOIN against all_articles with a LEFT JOIN against category_members in exists_by_qids_query, matching the convention already used by the other functions in this file (exists_statics_by_category, missing_by_lang_and_category, exists_by_lang_and_category, statics_by_category). The optional category and campaign filters now read from cm.category instead of aa.category. Behaviour with a filter applied is unchanged. Without a filter, articles that belong to multiple categories may now appear once per category in the result set; this matches the cardinality the neighbouring queries already produce. Refs the migration plan in docs/all_articles_migration_audit.md (Phase 2).
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Code Review
This pull request migrates the exists_by_qids_query function in src/api_cod/subs/missing_exists.php to use the category_members table instead of all_articles. Feedback highlights that this change may introduce row duplication in the API response, as articles can belong to multiple categories in the new table. To maintain consistency with the previous implementation, it is suggested to use a GROUP BY clause or a subquery to ensure only one row is returned per article when no specific category filter is applied.
This pull request was created by @kiro-agent on behalf of @MrIbrahem 👻
Comment with /kiro fix to address specific feedback or /kiro all to address everything.
Learn about Kiro autonomous agent
Phase 2 of the
all_articles→category_membersmigrationImplements the rewrite recommended for
exists_by_qids_queryindocs/all_articles_migration_audit.md(PR #42), bringing the lastall_articlesreader in this repo in line with the convention already used by the four neighbouring functions in the same file.Change
src/api_cod/subs/missing_exists.php—exists_by_qids_query:LEFT JOIN all_articles aa ON aa.article_id = q.title→LEFT JOIN category_members cm ON cm.article_id = q.titleaa.category→cm.categoryin the SELECT list, in the optionalcategory = ?filter, and in the optionalcategory IN (... WHERE campaign = ?)filtercm.categoryBehaviour
category=orcampaign=filter: identical result set. The WHERE clause continues to act as an effective inner-join, returning one row per (qid, code) for articles in the matching category.category_members. If the consumer turns out to need the original "1 row per article" shape, we can wrap the join in aGROUP BY article_idsubquery in a follow-up — keeping this PR a pure column/table substitution.Verification
Ran locally inside the sandbox:
(The 206 PHPUnit doc-comment-metadata deprecation notices are pre-existing and unrelated to this change.)
After this PR no live code under
src/referencesall_articles. The schema insql.sqlis intentionally left in place; dropping it is Phase 4 and only happens after the Translation-Dashboard and mdwiki-python-files PRs are merged and observed.Companion PRs
exists_by_qids_queryinnew_sql_tables.phpmdcount/*.pySELECTs and the redundantto_sqlwrite) and Phase 3 (re-pointingfix_it_db.pyat thewordstable)