GSoC Week 5
Tags: gsoc, googlesummerofcode, wagtail, opensource
Published: 2024-07-01 23:44:59

In hindsight, I realized I did many things this week. This might be a testament to my GSoC project's progress and overall status so far. There was a lot of focused work.

## Weekly Check-in
I had recovered from my illness just in time for the week's tasks. The goal was to make up for lost time from the previous week. We started with a review of the backlog and pending actions from the discussions over the previous week. Most of the meeting was centered on getting a finished product (PR) ready so that the codebase maintainers would have enough time to review the code, make suggestions, ask for improvements in certain areas, properly document, perform any other internal processes, accept, and merge. The idea is that for all of this to be done before the end of the GSoC deadline, the PR must be ready well in advance.

The first major delay was that the RFC didn't have as many comments as we would have liked. We understood that not everyone from the core team would have a chance to look at it right away, but we were looking out for some form of "negative feedback". Negative, in the sense that someone would be against our approach so that we could look for an optimal way if we had missed some details. My mentors decided that it would be good to push the RFC to the wider Wagtail community. We collectively brought up some suggestions:
1. Making an announcement in the Slack announcements channel.
2. Featuring it in the "This Week in Wagtail" newsletter.
3. Making a social media post about the RFC and getting it posted via the Wagtail social media handles.

Afterward, I promised to fix all the failing tests and complete the new ones for the edge cases to be tested for. I planned on getting the PR in a completely reviewable state by the end of the week.

## Publicizing the RFC
After the meeting, I ran the suggestions for pushing the RFC to the wider community by Wagtail's community manager, and she was kind enough to quickly get the RFC featured in the newsletter before starting her holidays. She also mentioned some other people I could talk to in her absence and hinted at the fact that I could make the post on my own social media handles, and then Wagtail could amplify it on their own social media handles. It sounded like a good plan I could work with. I elected to do this much later in the week, to give some time between the newsletter post and official posts.

Towards the end of the week, I brought the topic up with another one of the Wagtail admins, and he suggested that a nice-to-have post would be one where I could do a demo showcasing my proposed changes, provided I was comfortable with it. This discussion happened on a late Friday afternoon, so I chose not to make any decision until consulting with my mentors the following week.

## Finishing the draft PR
For months since finishing the PR, there were lots of test cases that were failing or were just flat-out unaccounted for. This was mostly because Wagtail's default behaviour for the `ImageChooserBlock` was to default to titles as alt text in the absence of any alt text. At the time of writing this, Wagtail defaults image titles to the name of the image file itself and seeing as editors often overlook it, tends to be a 'rubbish' file default. Bad alt text is often worse than empty alt text, because unlike the former, the latter can easily be spotted by an accessibility checker. 

Now, because of the existing behaviour, lots of test cases were checking that the returned image HTML had an alt attribute that defaulted to the title of the file. I had to remove all occurrences of those test scenarios. I also had to write some tests for the Wagtail internals that we modified to make the new block work, e.g to test that every image instance from the cache matched with the image instance, and to test that each image was retrieved, regardless of whether it had the same image ID or not. I got some help from Wagtail's lead developer as he helped clarify some things, and I got to work on the test cases.

The final stage of getting the tests to work was to update my copies to the latest versions on the parent repo, and then rebase my commits to not scatter the commit history thus far. After all of this, I updated my branch, and for the first time in months, I had no CI errors. All the tests and actions ticked green.

>Note: I still left the 'draft' status on so that my mentors would be able to get a good look at it.

## AI goal feasibility research
I went through the Accessibility team's Spreadsheet to compare some alt text data. I went through well over a hundred sample images from existing wagtail sites and examined the alt text that was done by humans. I compared this to the output from AI models when the same image was passed in with a prompt to generate alt text. It was surprising to see that even without context, AI models (Chat GPT specifically, as it was what we used) did a better job of generating alt text than human editors. 

This put into perspective the fact that the intentions behind the project were justified, and the next step for me was to explore models and learn about the model/API contract that would be needed to integrate Wagtail with these AI models.

## Accessibility meeting
I had an accessibility team meeting by the end of the week, and the other GSoC contributor (Nandini) was there. It was nice to interact with her briefly, and the team as a whole discussed the progress with the new alt text validation rules for the accessibility checker. The team had done an amazing job on it. 

I gave a brief update on the status of my work and got to see Nandini's progress so far on generating a low-carbon footprint template for Wagtail pages. Wagtail is doing some amazing stuff, and I am excited about what we'll have by the end of this year.

## Challenges
I had a tough time trying to work around the validation error messages without touching the Python code, but I asked someone more experienced within the Wagtail community to take a look at it, and he promised to look into it, as well as give a colleague of his a chance to look at it as well.

I also had to get feedback from the two biggest Wagtail code maintainers to make sure they were okay with me modifying the existing tests. It wasn't a challenge in itself, but it did involve me navigating around a topic I found scary to touch. Both maintainers were in total support of it, provided the new behaviour was what was intended, and was better than the previous way of doing things.

It was a week full of activity, but there weren't as many challenges as I'd become more well-versed with the stuff I needed to know.

## What I learned
The RFC did receive some more feedback, and from the comments I saw, I learned just how compatible the `ImageBlock` would be with the existing `ImageChooserBlock` because they operated similarly. 

Thanks to my lead mentor Storm, I also learned about factors to consider when drafting 'upgrade considerations' for newer releases, as well as the thought process that goes into it.


With that, I can call my week 5 of GSoC a wrap. I'm growing increasingly proud of the work I am doing.

Thank you for reading.

Cheers. 🥂