Conversation
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
Important Review skippedToo many files! This PR contains 107 files, which is 7 over the limit of 100. To get a review, narrow the scope: Upgrade to a paid plan to raise the limit. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (109)
You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughThis PR revises Python tooling configuration, modernizes type annotations, adjusts API and category processing, fixes journal matching, changes data-copy flows, and cleans up several one-time utility scripts. ChangesRepository modernization
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✨ 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.
Actionable comments posted: 8
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/newapi/client_wiki/bot_api.py (1)
479-482: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winBound the three-hour recentchanges window correctly.
src/newapi/client_wiki/bot_api.py:479-482—rcstart=now-3hwith the defaultrcdir=olderand norcendwalks backward from that cutoff, so this can return changes older than three hours. Setrcdir="newer"with an explicitrcend, or swap the bounds.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/newapi/client_wiki/bot_api.py` around lines 479 - 482, Correct the three-hour recent-changes window in the three_houers branch by pairing rcstart with an explicit current-time rcend and using rcdir="newer", or equivalently swapping the bounds. Ensure the request only returns changes from the last three hours and does not include older results.Source: MCP tools
src/newapi/client_wiki/categories/category_db.py (1)
74-99: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
self.limitisn't coerced tointlikeself.depthis, despite the tightenedintannotation.Line 42 declares
self.limit: int, but Line 88 keepsself.limit = kwargs.get("limit") or 0without anyint()cast — unlikeself.depth, which now gets atry/except int(...)guard just above (Lines 74-78). Iflimitis passed as a non-numeric string (previously valid under the oldint | strtype),self.limitwill hold astrat runtime, and the laterself.limit > 0comparisons (used inget_cat_new/subcatquery_) will raiseTypeError.🐛 Proposed fix: mirror the depth-parsing pattern
- self.limit = kwargs.get("limit") or 0 + try: + self.limit = int(kwargs.get("limit") or 0) + except ValueError: + logger.error(f"self.limit != int: {kwargs.get('limit')}") + self.limit = 0🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/newapi/client_wiki/categories/category_db.py` around lines 74 - 99, Coerce the limit option to an integer in the initializer, mirroring the existing depth parsing and fallback behavior. Update the self.limit assignment to handle invalid values safely by logging the conversion error and defaulting to 0, so self.limit remains an int for later comparisons in get_cat_new and subcatquery_.
🧹 Nitpick comments (1)
src/newapi/client_wiki/api_utils/txtlib.py (1)
14-14: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRedundant
str | Anyannotation — simplifies toAnyfor type checkers.Since
Anyis compatible with any type,str | Anyconveys the same information as plainAnyto static analyzers; thestrpart is misleading given the function still runtime-validates viaisinstance(text, str).-def extract_templates_and_params(text: str | Any) -> list[dict[str, Any]]: +def extract_templates_and_params(text: Any) -> list[dict[str, Any]]:🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/newapi/client_wiki/api_utils/txtlib.py` at line 14, Update the extract_templates_and_params parameter annotation from str | Any to Any, leaving the existing runtime isinstance(text, str) validation and function behavior unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pyproject.toml`:
- Line 251: Update the Pyright configuration around typeCheckingMode to use a
less restrictive base mode instead of "strict", then explicitly enable the
desired strict type-checking diagnostics while retaining the intended
lower-severity or disabled report overrides. Ensure the resulting configuration
preserves the targeted checks without strict mode overriding those settings.
In `@src/md_core_helps/apis/mdwiki_api_call.py`:
- Around line 226-227: Update Get_template_pages and its
api_new.Get_template_pages delegate to thread the limit argument through and use
it for the gtilimit request parameter, preserving caller-selected caps;
alternatively remove limit from the wrapper API if configurability is not
intended.
In `@src/md_core_helps/one_time/prior/add_old.py`:
- Around line 125-130: Deep-copy data before the iteration and mutation flow
that produces data_new, ensuring nested entries are independent from the
original data. Keep the existing data_new == data comparison and write behavior,
so mutated copies are serialized when changes occur.
In `@src/newapi/client_wiki/api_utils/bot_edit/__init__.py`:
- Line 18: Update the delay handling in the bot edit request body so truthy
string values are coerced to integers before the last-edit-time safety check.
Ensure invalid strings are rejected or handled consistently, and preserve the
existing guard behavior for valid numeric delays in the code surrounding the
isinstance(delay, int) check.
In `@src/newapi/client_wiki/categories/category_db.py`:
- Around line 136-139: Guard the namespace conversion in params_work so the
default self.ns value "all" does not reach int(). Preserve the existing "0"/"10"
page handling and apply the "subcat" branch only when self.ns is numeric and
equals 14, while allowing get_cat_new to proceed normally for "all".
- Around line 202-233: Update the request configuration used by get_cat_new so
the API requests formatversion=2, matching pages_table_work’s list-based
iteration over query.pages. Preserve the existing pages_table_work processing
and ensure the format-version parameter is applied to this category request.
In `@src/td_core/copy_data/copy_enwiki_pageviews.py`:
- Around line 40-43: Replace truthiness-based fallback checks with
key-membership checks in the SQL merge paths: update the condition in
src/td_core/copy_data/copy_enwiki_pageviews.py lines 40-43 and the corresponding
condition in src/td_core/copy_data/copy_assessments.py lines 41-42 to use title
not in new_data, preserving existing falsy values.
In `@src/td_core/mdcount/bots/links.py`:
- Around line 78-79: Update the `vav` assignment after `Get_page_links` to
convert the links mapping keys into a mutable list using the requested
`list(result.get("links", {}))` form, so subsequent `vav[:]` and `vav.remove()`
operations work correctly.
---
Outside diff comments:
In `@src/newapi/client_wiki/bot_api.py`:
- Around line 479-482: Correct the three-hour recent-changes window in the
three_houers branch by pairing rcstart with an explicit current-time rcend and
using rcdir="newer", or equivalently swapping the bounds. Ensure the request
only returns changes from the last three hours and does not include older
results.
In `@src/newapi/client_wiki/categories/category_db.py`:
- Around line 74-99: Coerce the limit option to an integer in the initializer,
mirroring the existing depth parsing and fallback behavior. Update the
self.limit assignment to handle invalid values safely by logging the conversion
error and defaulting to 0, so self.limit remains an int for later comparisons in
get_cat_new and subcatquery_.
---
Nitpick comments:
In `@src/newapi/client_wiki/api_utils/txtlib.py`:
- Line 14: Update the extract_templates_and_params parameter annotation from str
| Any to Any, leaving the existing runtime isinstance(text, str) validation and
function behavior unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 83d59808-6c27-4ba0-a15c-9669a972c1a2
📒 Files selected for processing (29)
pyproject.tomlsrc/db/analytics/replica_db.pysrc/md_core/fix_cs1/bots/pmid.pysrc/md_core/p11143_bot/wd_helps.pysrc/md_core/updates/io.pysrc/md_core_helps/apis/mdwiki_api_call.pysrc/md_core_helps/one_time/WHOem/find_views_by_lang.pysrc/md_core_helps/one_time/prior/add_old.pysrc/md_core_helps/one_time/prior/read5.pysrc/md_core_helps/one_time/priorviews/bots/count_words.pysrc/md_core_helps/one_time/priorviews/bots/gt_blame.pysrc/md_core_helps/one_time/priorviews/bots/sections_links.pysrc/md_core_helps/one_time/priorviews/find/find_blame.pysrc/md_core_helps/one_time/priorviews/find/find_creator.pysrc/md_core_helps/one_time/priorviews/find/find_translators.pysrc/md_core_helps/one_time/priorviews/find/find_views.pysrc/md_core_helps/one_time/priorviews/find/find_word.pysrc/md_core_helps/one_time/wikiblame/bot.pysrc/newapi/api_client/client.pysrc/newapi/client_wiki/api_utils/bot_edit/__init__.pysrc/newapi/client_wiki/api_utils/txtlib.pysrc/newapi/client_wiki/bot_api.pysrc/newapi/client_wiki/categories/category_db.pysrc/newapi/client_wiki/pages/super_page.pysrc/td_core/copy_data/copy_assessments.pysrc/td_core/copy_data/copy_enwiki_pageviews.pysrc/td_core/mdcount/bots/links.pysrc1/md_core/add_rtt/pup.pysrc1/newupdater/__init__.py
💤 Files with no reviewable changes (5)
- src/md_core_helps/one_time/WHOem/find_views_by_lang.py
- src1/md_core/add_rtt/pup.py
- src/md_core_helps/one_time/priorviews/find/find_translators.py
- src/md_core_helps/one_time/priorviews/find/find_views.py
- src/md_core_helps/one_time/priorviews/find/find_word.py
Summary by CodeRabbit
Bug Fixes
Improvements
Developer Experience