Skip to content

Add duplication analysis and migration plan for super folder refactoring#2

Merged
MrIbrahem merged 4 commits intomainfrom
copilot/analyze-page-repository-files
Jan 26, 2026
Merged

Add duplication analysis and migration plan for super folder refactoring#2
MrIbrahem merged 4 commits intomainfrom
copilot/analyze-page-repository-files

Conversation

Copy link
Contributor

Copilot AI commented Jan 26, 2026

Analyzed duplicate get_text methods in page_repository.py and super_page.py as requested. Finding: duplications are intentional - part of ongoing refactoring from legacy god object to repository pattern.

New Documentation

  • Doc/DUPLICATION_ANALYSIS.md - Comprehensive analysis covering:

    • Comparison of all duplicate methods (get_text, get_categories, get_langlinks, save, exists)
    • Architecture comparison: legacy MainPage (987 lines, side effects) vs new PageRepository (clean, testable)
    • Migration recommendations and status
  • merge.md - Complete migration plan for all files in the super/ folder:

    • Current state of all legacy files with migration status
    • Target architecture with new modules (core/, repositories/, services/, auth/, api/)
    • Step-by-step migration for each module:
      • super_login.pyauth/
      • S_Page/super_page.pyrepositories/ + services/
      • S_API/bot_api.pyrepositories/ + services/
      • S_Category/bot.pyrepositories/ + services/
    • Execution timeline (6 phases over 9 weeks)
    • Testing strategy with coverage targets
    • Deprecation schedule and backward compatibility plan
    • Complete file mapping reference

Updated Documentation

  • refactor.md - Synced checklist with actual state:
    • ✅ Phase 1-3 items already completed (config, page, protocols, repositories, services, exceptions)
    • ⏳ Pending: MainPage delegation to new components

Recommendation

Do not remove either implementation. The migration path:

# Eventually MainPage.get_text() should delegate to PageRepository:
def get_text(self, redirects=False):
    page = Page(title=self.title, lang=self.lang, family=self.family)
    repository = PageRepository(self.login_bot)
    self.text = repository.get_text(page)
    return self.text
Method Legacy Location New Location Status
get_text super_page.py:186 page_repository.py:33 Coexist
save super_page.py:657 page_repository.py:118 Coexist
get_categories super_page.py:496 page_repository.py:182 Coexist
Original prompt

why we have
def get_text
in both

mw_api/repositories/page_repository.py
mw_api/super/S_Page/super_page.py

new files should replace the old ones?

write plan to analyse all files and find which one should be removed or should be used or merge, ... etc...


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 26, 2026 08:26
Co-authored-by: MrIbrahem <26301308+MrIbrahem@users.noreply.github.com>
Co-authored-by: MrIbrahem <26301308+MrIbrahem@users.noreply.github.com>
Copilot AI changed the title [WIP] Analyze get_text in page_repository and super_page Add duplication analysis for get_text methods and update refactoring checklist Jan 26, 2026
Copilot AI requested a review from MrIbrahem January 26, 2026 08:29
@MrIbrahem
Copy link
Contributor

@copilot Create a plan to complete the merge process for all files located within the super folder and save it as merge.md

Co-authored-by: MrIbrahem <26301308+MrIbrahem@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Jan 26, 2026

@copilot Create a plan to complete the merge process for all files located within the super folder and save it as merge.md

Created merge.md (commit a9e24a1) with a comprehensive migration plan covering:

  • Migration steps for each module in super/:
    • super_login.pyauth/
    • S_Page/super_page.pyrepositories/ + services/
    • S_API/bot_api.pyrepositories/ + services/
    • S_Category/bot.pyrepositories/ + services/
  • Execution timeline (6 phases over 9 weeks)
  • Testing strategy with coverage targets
  • Deprecation schedule and backward compatibility plan
  • Complete file mapping reference

Copilot AI changed the title Add duplication analysis for get_text methods and update refactoring checklist Add duplication analysis and migration plan for super folder refactoring Jan 26, 2026
@MrIbrahem MrIbrahem marked this pull request as ready for review January 26, 2026 09:06
@MrIbrahem MrIbrahem merged commit bb17409 into main Jan 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants