Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Howto fix kata #511

Merged
merged 6 commits into from
Mar 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions content/curation/howtos/fixing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
title: How to Fix a Kata
---

Codewars kata, like any code, may need bug fixes, improvements, or updates to match new versions of runtimes or dependencies. That's why content maintenance activities are important and sometimes require significant effort.

## Finding a kata to fix

The first step to fixing a Codewars kata is determining which kata need fixing in the first place. The Codewars platform provides several ways to find challenges that require maintenance:

- On the [kata search page](https://www.codewars.com/kata/my-languages), every entry shows the number of pending issues (if any).
- Posts on the home page [dashboard](https://www.codewars.com/dashboard/discourse/issues) can be filtered to display the most recently reported issues.
- The discourse page of every kata can be filtered for posts labeled as `ISSUE` or `SUGGESTION`.
- The [kata search page](https://www.codewars.com/kata/) can be used to find challenges that have not been updated to the latest version of their available languages. For example, to find kata with tests that need to be updated to the latest available version of JavaScript, filter for language: JavaScript, and manually add the parameter `&outdated=1` to the URL (example link to find all [outdated JavaScript kata](https://www.codewars.com/kata/search/javascript?q=&order_by=sort_date%20desc&outdated=1)).
- The [`codewars/content-issues`](https://github.com/codewars/content-issues) GitHub repository hosts [wiki pages](https://github.com/codewars/content-issues/wiki) with lists of kata that need an update and an [issue board](https://github.com/codewars/content-issues/issues) with tickets related to kata maintenance.

## Creating a fork

A new fork can be initiated by opening the kata details page, selecting one of the available languages, and clicking the `Fork` button in the top right corner. This opens the fork editor, where all editors are populated with the current state of the corresponding code snippets in the selected language and description. This code can be edited and used as a starting point for a fix.

:::warning Do not fork outdated forks
Fixes should not be applied by starting with a fork of an already approved fork. For example, when an issue is reported with a JavaScript version of a kata, it should be fixed by forking the current state of the kata, not by forking the original, approved JavaScript translation or the most recent JavaScript translation. The kata may have been modified after the translation was published and approved, and forking an old fork can revert changes applied afterward.
:::

:::warning Prefer forks to direct edits
Applying fixes via forks is preferred over updates done using the kata editor. Forks can be reviewed, and reviewers can share their remarks before approving the fix.
:::

### Scope of a fix

A single Codewars challenge can be affected by multiple problems. It may be tempting to fix as many things as possible in one go or even rewrite tests completely, but this is not always the best approach. Forks with extensive changes require significant effort to create, can be difficult to review, and make it harder for reviewers to determine what they attempt to fix and identify potential bugs. Forks that are difficult to review may remain unreviewed and unapproved for a long time.

A user must find a balance between making large-scale fixes that attempt to address many issues at once and smaller, incremental changes that are easier to review and approve. Sometimes, applying a series of small fixes is more effective than attempting to fix multiple issues in a single fork.

It is recommended to write a short comment in the discourse of a published fork explaining what problems it addresses.

### Announcing the fork

When a fork with a fix is ready, it needs to be published for review and potential merging. To notify reviewers about a fork ready for review, it can be helpful to announce the fix with a message posted in the discourse section of the kata (labeled as `SUGGESTION`) and in the `#fixing` channel of the Codewars Discord.

## Review of a fork

After a fork with a fix is published and announced, it should attract the attention of reviewers who will evaluate it and either approve it or request further improvements.

Users with sufficient privileges can approve their own forks without waiting for a review.

When a reviewer requests further improvements, they can be added to the same fork by its author. It is not necessary to fork a fork if it hasn't been approved or rejected. However, if the fork has already been merged and further improvements are required, it must be re-forked. Editing an approved fork is possible, but there is no way to merge the new changes into the kata.

## Pitfall: editing descriptions

Updading a kata description, with a fork or in any other way, renders all pending translations and update forks of this kata impossible to approve due to description merge conflicts. While unfortunate, it is not a serious impediment for fixing activities, because merge conflicts are relatively [easy to fix](/curation/translation/#merge-issues).

## Resources on fixing

Users interested in fixing Codewars challenges have several resources at their disposal:

- [Codewars documentation](https://docs.codewars.com/)
- [Authoring examples](https://www.codewars.com/collections/authoring-examples) collection
- Codewars Discord and its `#fixing` channel

### Community resources

:::info Note
Community resources are created and maintained by Codewars users not affiliated with the platform. These resources are not maintained by Codewars and may become outdated or non-functional.
:::

- [Codot](https://github.com/hobovsky/codot-client/blob/main/README.md#fixing-forks-beta), an AI-powered assistant, and its [fork refactoring](https://github.com/hobovsky/codot-client/blob/main/README.fixing.md#fixing-forks-with-codot-beta) function.
16 changes: 0 additions & 16 deletions content/curation/translation.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ When the translation is approved, a new language is immediately available for so

The user who approved the translation should also go through the kata discourse and mark suggestions posted by the translator as resolved.

**NOTE:** at the time of writing, a user who _approves_ a translation is marked as a **kata contributor**. Users with the "contributor" flag seem to be affected by a bug preventing them from earning any future points they would be rewarded for authoring activities on kata they contributed to. Be aware that as a result, approving a translation will render you ineligible for honor points you would otherwise earn by translating, editing or fixing the kata in the future until the bug is fixed.

### Merge Issues

Oftentimes if two translations are created around the same time, they may both update the description. When approving the 2nd translation, the 1st approved translation will already have updated the description. This will cause a merge conflict which has to be resolved.
Expand All @@ -70,20 +68,6 @@ Some possible reasons could be:

It's worth noting that rejected translations are not wasted work. They are still available in the system, can be forked and used as a base for new translations, or its code can be simply copied and reused.

## Fixing existing translations

Sometimes a kata needs to be fixed due to an issue, be it a bug in the reference solution, typos in the description or the lack of test coverage. Fixes and improvements to approved translations can be done in one of two ways:

- If a translation was created with the translations panel, the most recent fork can be forked again, modified, and published. Afterwards it has to go through the usual translation review process and wait until another user approves it. However, translations created directly within the kata editor cannot be forked.
- A translation may be modified directly with the kata editor. This method allows for immediate changes without waiting for approval, but it also has some drawbacks:
- it requires privileges which are available only to experienced users,
- it invalidates existing forks, what may cause merge conflicts for modified snippets if someone publishes a fork of this translation sometime in the future,
- direct edits are not subject to the review process and other users cannot verify the introduced changes.

:::warning
The way how kata edits are currently handled, existing pending forks can be very easily outdated by direct edits of the kata. When creating a fork based on some other, existing fork, you have to make sure that it contains the most current state of its language and does not overwrite or revert changes introduced with the kata editor.
:::

[translation-curating-guidelines]: /curation/guidelines/translation/
[translation-authoring-guidelines]: /authoring/guidelines/translation/
[privileges-reference]: /gamification/privileges/
1 change: 1 addition & 0 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ module.exports = {
items: [
"curation/kata",
"curation/translation",
"curation/howtos/fixing",
{
type: "category",
label: "Guidelines",
Expand Down