CreateWiki icon indicating copy to clipboard operation
CreateWiki copied to clipboard

Implement fast track deletion for unused wikis

Open pixDeVl opened this issue 1 year ago • 2 comments

This was requested and approved by the community in https://meta.miraheze.org/wiki/Requests_for_Comment/Content_and_Dormancy_Policies back in March(over half a year ago, so long overdue and then some). Since many, many, many wiki requests unfortunately never really get into editing and just give up on or forget about making entirely, leaving swarms of ghost wikis on the site taking up space. This pull request implements the 'fast-track' deletion, where wikis that have no edits(besides MediaWiki default) are marked as inactive after 15 day, and deleted after 30. Rest in peace our 10k badge.

pixDeVl avatar Oct 22 '24 02:10 pixDeVl

[!IMPORTANT]

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

This pull request restructures the configuration for wiki state days by nesting the previous flat structure into two objects: default and no-edits. The change affects how inactivity, closure, removal, and deletion periods are determined. The deletion process in the Wiki Manager now uses the no-edits configuration for the deletion grace period. Additionally, a filtering condition is added in the wiki activity check to exclude log entries from the default actor. The inactive wiki management script is updated to retrieve and validate configuration values more strictly, throwing an error if critical configuration is missing.

Changes

File(s) Change Summary
extension.json Restructured CreateWikiStateDays configuration from direct integer values into a nested structure with default and no-edits objects holding the respective values.
includes/Services/WikiManagerFactory.php and maintenance/ManageInactiveWikis.php Updated the retrieval of configuration values to use the nested no-edits object (e.g., deletion grace period and inactive days). In ManageInactiveWikis.php, added error handling (via ConfigException) and fallback logic to choose between default and no-edits based on activity status.
maintenance/CheckLastWikiActivity.php Introduced a new variable to fetch the default actor's ID and modified the timestamp query to exclude log entries associated with this actor by adding an extra filtering condition to the query.

Sequence Diagram(s)

sequenceDiagram
    participant Cron as Cron Job
    participant MIW as ManageInactiveWikis
    participant Config as Configuration
    participant Wiki as Wiki Data
    Cron->>MIW: execute()
    MIW->>MIW: checkLastActivity()
    MIW->>Config: Retrieve 'default' state config
    alt 'default' config exists
        MIW->>MIW: Determine config (default/no-edits) based on last activity
    else 'default' missing
        MIW->>MIW: Throw ConfigException
    end
    MIW->>Wiki: Update inactivity, closure, and removal statuses
sequenceDiagram
    participant User as User Action
    participant WMF as WikiManagerFactory
    participant Config as Configuration
    participant Wiki as Wiki Data
    User->>WMF: Request deletion
    WMF->>Config: Retrieve deletion grace period from 'no-edits' config
    WMF->>WMF: Evaluate deletion conditions
    alt Conditions met
        WMF->>Wiki: Perform deletion
    else Conditions not met
        WMF->>User: Return error/skip deletion
    end

Suggested reviewers

  • Universal-Omega

Poem

I'm a bunny with a code-hop beat,
New nests for settings now look neat,
With default and no-edits in a clever twist,
Logs and grace periods all coexist,
Hopping through changes with a joyful leap,
CodeRabbit cheers—these changes run deep!
🐇✨

✨ Finishing Touches
🧪 Generate unit tests
  • [ ] Create PR with unit tests
  • [ ] Post copyable unit tests in a comment

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Oct 27 '24 23:10 coderabbitai[bot]

Looks ~~gay~~ good to me

BlankEclair avatar Nov 19 '24 03:11 BlankEclair

Codecov Report

Attention: Patch coverage is 40.00000% with 6 lines in your changes missing coverage. Please review.

Project coverage is 23.47%. Comparing base (b0cae5c) to head (45a7c37).

Files with missing lines Patch % Lines
maintenance/ManageInactiveWikis.php 0.00% 6 Missing :warning:
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #605      +/-   ##
============================================
- Coverage     26.55%   23.47%   -3.08%     
- Complexity      819      820       +1     
============================================
  Files            50       50              
  Lines          4135     4140       +5     
============================================
- Hits           1098      972     -126     
- Misses         3037     3168     +131     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Mar 09 '25 03:03 codecov[bot]

@coderabbit review

pixDeVl avatar Mar 17 '25 03:03 pixDeVl

:white_check_mark: Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

coderabbitai[bot] avatar Mar 17 '25 03:03 coderabbitai[bot]