We are starting to retire Script Compatibility Mode

Hi everyone,

I am Scott a new developer working in the engineering team here at Tofugu. I have been working quietly behind the scenes for the last six months, but today I have something to share with you all.

Starting next Monday (21 November 2022) we will begin retiring Script Compatibility Mode from WaniKani. The burden of maintaining multiple code branches has become too great and prevents us from delivering awesome new features to our community of learners in a fast and reliable way. New features are on the way, but first we must address our legacy code that is active when Script Compatibility Mode is turned on. So next Monday we will begin by removing legacy lessons and soon after we will be removing legacy reviews. If you would like to check whether your scripts will be impacted by this change, please ensure that you have Script Compatibility Mode turned off in the app settings.

I’m sorry if you’re using any scripts that end up being affected by this. Please know that we’re not doing it to make your life harder — in the long run this will be beneficial for everyone.

If you have any questions I will be happy to answer them.

38 Likes

Thanks Jenny & Kumirei Scott.

I assume the process of determining if scripts are broken by this will mean disabling them all and going through them one by one or something like that?

Are there any scripts that you guys know for sure will be broken? would be useful even if it’s just a few so that we can more easily just remove them.

4 Likes

Unfortunately this is one of the great challenges with user-scripts. We have no way of knowing which scripts are in use on a given page, how many people are using the scripts, and whether the script is actively maintained.

My suggestion would be to turn off Script Compatibility Mode and see what breaks. As of Monday when I release the removal of the legacy lessons, you will be served the non legacy version always (regardless of the Script Compatibility Mode setting). So between now and then, you only need to concern yourself with the lesson section to see if anything breaks. If none of the scripts you use affect the Lesson section you will be fine until we remove the legacy reviews. I will post an update ahead of removing the legacy reviews so people will have some more warning.

8 Likes

What does legacy lesson / review mean?

5 Likes

Will this affect third party apps like Tsurukame?

At some point in the past the lesson and review sections got a code rewrite. Instead of removing the old code we have supported both. You would get the old (legacy) version when Script Compatibility Mode was turned on and the new version when Script Compatibility Mode was turned off. We kept the legacy versions around because we were not sure how much impact the new version would have on user scripts. While the functionality has remained largely the same between the legacy versions and the new versions the html markup differs. This difference allowed scripts to continue to work using the old page structure and provide some time for script authors to update their scripts.

4 Likes

Hi Scott,

thanks for reaching out and informing us about the change!

Is there any way to know when you will have finished the current change to React? Because as it stands, I don’t feel like updating my scripts over and over again while you do this conversion in little bits and pieces… I hope you can understand. So if you could let us know when that transformation will be finished, that would be appreciated!

3 Likes

No it shouldn’t. This change is only expected to affect users using third-party user scripts on wanikani.com. The API that powers Tsurukame is not affected by this change.

2 Likes

You’re most welcome!

I can’t give any timeline for future changes and what those changes might entail. However I think it is important to know that our approach is to deliver small incremental changes that build towards larger features over time as opposed to delivering large changes all in one go. The best I can do is keep you updated about any upcoming changes that may or may not affect third party scripts before the code is released.
Removing Script Compatibility Mode will hopefully allow us to make these incremental changes much faster and with more confidence so do stay tuned.

3 Likes

Oh sorry I think there is a misunderstanding. I’m not talking about delivering new features in small chunks. Please go ahead and deliver them as often as you like, and in increments of whatever size you see fit.

I was talking about the switch of the frontend from vanilla HTML/JS to React. I hope you agree with me that that’s not a feature, it’s a refactoring, and as such it shouldn’t introduce any changes. This project was started a long time ago (maybe even a year ago or so?) and what was done was that the frontend was slowly switched over to React (which is totally fine as a refactoring) while at the same time changes to the HTML structure were introduced (which is the issue I’m talking about), and mostly without letting the script devs know. The slow speed in combination with the continuous changes (which broke many scripts) was pretty bad for keeping scripts up-to-date at least on my end (don’t know how other script developers went about this). I don’t even know whether this switch to React is finished by now or whether we are still expecting more changes to the frontend? :woman_shrugging:

Anyways, it would be absolutely lovely if in the future you could keep the script devs in mind a little bit more - they add lots and lots of cool features to WK, for free. Thanks! :blush:

10 Likes

We will continue to make changes to the frontend as Wanikani evolves. Some of these changes will impact third party scripts. The best I can do is provide posts like this one to notify you of the new features/changes but it is too difficult for me to speculate which scripts will be affected and how. It is a tough challenge trying to deliver new features and balancing that with breaking scripts which aren’t under our control. I can only promise to try my best to keep you informed. I hope that is okay?!

4 Likes

Sorry, I think we are still not together yet :cold_sweat:
What I would like to know is: Are there any parts of the frontend that have not been switched to React yet? And if so, when are you planning to switch them over?
Maybe I missed the news but I haven’t heard anything along the lines of “We’re now done with the React transition”, and so I’m still waiting and not changing my scripts, because I don’t want to change them over and over again. So if you could shed some light on that question, that would be very much appreciated!

As I said before, of course you will evolve WK and make changes to the frontend. And that’s totally fine (it’s the nature of software development, after all). But the shotgun-surgery switch to React was a bit of a different beast regarding the impact for the script devs as it simply affected everything.

Thanks for your patience :blush:

3 Likes

Yes there are parts of the frontend that are not using React. I recently updated all subject and level pages away from React and back to server side rendered pages using BEM. Hopefully BEM will provide some stability to blocks of HTML even as they move around the page. Although I cannot make any guarantees that BEM blocks won’t disappear and be replaced with new and better functionality in future.

In terms of the plan to switch more over to React, that is not our plan moving forward. I don’t want say too much at the moment as we are still working out what the future path looks like and I don’t want to promise anything that may or may not happen.

When or if you choose to update your scripts is completely up to you. I can’t promise that a month or two from now we don’t add a new feature that will break one of your scripts, but like I said I can do my best to keep you updated. Unfortunately this is the nature of injecting scripts into pages you don’t control. We do make guarantees with our API but we don’t make any guarantees about the structure of our pages.

I hope that you understand this point of view, and I will continue to help however I can.

7 Likes

Hey Scott,

Do you see legacy reviews getting pulled before the end of the year or is it still to be determined?

The /user endpoint of the API is currently returning a wanikani_compatibility_mode property under preferences. Will that be removed at/around the time legacy reviews are pulled?

Thanks!

Yes I hope that this will be gone a few weeks from now all going well.

Thanks for pointing that out. I am not yet sure whether I will remove the wanikani_compatibility_mode key from the preferences object or whether I will always have it return false. This was done before my time, so the key may have been intentionally left out of our API contract as documented here. My preference would be to remove it as it is an undocumented API feature, and realistically the value is only intended to be used by our codebase.

1 Like

Thank you for the heads up, Scott. If all the scripts I’m using break, I will cry. At least I have almost a week to prepare mentally. :crabigator: :crabigator: :crabigator:

I’m hoping new features would be things like having a Recent Burned Mistakes Items under Burned Items and maybe some custom Graded Readers for WaniKani users. Like a Graded Reader section for levels 1-10, 11-20, etc.

3 Likes

This seems totally reasonable. Maintaining legacy code is extremely painful, especially for a relatively small team. The fact that you guys have tried to be conscientious about it for so long is very kind.

Any user scripts that depend on a specific DOM structure or selector queries are always going to be brittle. You can’t expect otherwise, as the developers need to be free to make changes.

It’s really the backend APIs that need to be stable. Ideally they should be versioned, with each version being entirely stable.

Anyways, since you’re moving to React (rather slowly, it seems), I’m wondering if you’re eventually planning on a React Native app? I was planning on making one myself. The main benefit of this to me is having app notification reminders, and maybe better text-to-speech input (so I can speak my answers sometimes if I choose).

1 Like

I personally won’t miss the script compatibility mode. On the one hand it was useful for keeping old scripts alive, but on the other hand it burdened userscript authors (and WK developers) with having to maintain/test against two versions of WaniKani. Or maybe even three versions if we include https://preview.wanikani.com – I don’t remember if the preview server was ever used during the lifetime of the script compatibility mode.

Much more important to me would be notifications whenever something changed on WaniKani so that I know when I have to update my scripts. There is a mailing list, the forum, and there was https://knowledge.wanikani.com/wanikani/script-compatibility-mode, but none of these communication channels were used for the recent changes. Since I don’t actively use WaniKani anymore, I had to rely on users eventually reporting problems with the scripts.

So that’s why the HTML/CSS structure was once again different from the structure in lessons. I was hoping that the change to React would make everything a bit more consistent. So, if I understand correctly, the transition to React is now discontinued? Now I’m wondering if another batch of breaking changes to the lesson screen is just around the corner or if the lesson screen will keep using React for a while :sweat_smile:

5 Likes

BEM has nothing to do with React. It’s just a CSS naming structure that can reduce or eliminate selector specificity issues, making the code more modular and the styles less affected by where they appear in the DOM. I seriously doubt they would abandon React.

1 Like