Using AI in MediaWiki patches
Appearance
This page is currently a draft.
|
AI/LLM is useful or harmful depending on how people make use of it. For software development, AI/LLM can be used effectively, but improper use might cause code contributors to be led in the wrong direction or require excessive review time from peers to process contributions.
Key principles for using AI/LLM correctly
[edit]- The contributor must grasp the problem that they are solving.
- The contributor must take the time to understand the generated code. It is not the reviewer's job to puzzle out what the AI/LLM generated. It is your job to figure this out and double check the generated code before submitting your patch for review.
- You should test all of the generated code to make sure it works.
- A human reviewer should always be part of the review process of material changes to the code.
- Use of AI tools should be disclosed.
Key dangers of using AI/LLM
[edit]- Risks moving the burden of understanding the change from being shared between the patch writer and the reviewer, towards just the reviewer and as such overwhelming reviewers with additional work.
- AI/LLM may look like it generates code that fixes a problem or solves the ticket, but it might not have properly grasped the problem that should be fixed.
- AI/LLM has a tendency to satisfy your requests, instead of caring about the final code.
- Unnecessary code that isn't in use, doesn't work or that doesn't make use of the proper conventions of the code base.
- The types of errors made by humans and by AI tools differ, so reviewing contributions without knowing their source may not be as effective as it could be.
Proper use of AI/LLM
[edit]- Autocompletion/Autosuggestions
- As a rubber duck to give you ideas of things to try.
- To fill in simple functions/methods or a todo comment, which you then verify work.
- To write unit tests, which you then refine and improve, possibly deleting some that are redundant or don't make sense.
- To refactor code. For instance; extract this functionality into a new service.
Improper use of AI/LLM
[edit]- Creating a patch without testing it.
- Submitting code for review that you do not understand.
- Adding excessive comments or comments that are incorrect.
- Generating commit messages without making sure the commit message is correct, follows the MediaWiki commit message guidelines, and isn't too verbose. In general, writing commit messages yourself is better.
- Not following the MediaWiki development guidelines.
See also
[edit]- "Usage of LLM/AI coding assistants in Wikimedia projects" 2026 discussion thread on wikitech-l