otsukare Thoughts after a day of work

Week notes - 2020 w06 - worklog - Finishing anonymous reporting

Monday

I came back yesterday at home from Berlin All Hands at noon. Today will be probably tough on jetlag. Almost all Japanese from Narita Airport to home were wearing a mask (as I did). The coronavirus is in the mind: "deaths at 361 and confirmed infections in China at 17,238".

Cleaning up emails. And let's restart coding for issue #3140 (PR #3167). Last week, I discussed with mike, if I should rebase the messy commits so we have a cleaner version. On one hand, the rebase would create a clean history with commits by specific sections, but the history of my commits also document the thought process. For now I think I will keep the "messy informative" commits.

Unit tests dependency

When unit tests are not failing locally but failing on CircleCI, it smells a dependency on the environment. Indeed, here the list of labels returned behaved differently on CircleCI because locally, in my dev environment, I had a populated data/topsites.db. This issue would not have been detected if my local topsites.db was empty like on circleCI. A unittest which depends on an external variability is bad. For now I decided to mock the priority in the test and I opened an issue to create a more controlled environment.

Tuesday

Finishing the big pull request for the new workflow. I don't like usually to create huge pull request. I prefer a series of smaller ones, tied to specific issues. The circumstances pushed me to do that. But I think it's an interesting lesson. How much do we bend our guidelines and process rules in an emergency situation.

23:00 to midnight, we had a webcompat team video-meeting.

Wednesday

Code review today for kate's code on fetching the labels for the repos. She used GraphQL, which is cool. Small piece of codes creates opportunities to explore new ways of doing things.

I wonder if there is a client with a pythonic api for GraphQL, the same way that SQLAlchemy does for SQL.

I need to

Thursday

Big pull request… big bug. Big enough that it would create an error 500 on a certain path of the workflow. So more tests, and fixing the issue in a new pull request.

Restarting diagnosis too because the curve is going up. We are +50 above our minimum on January 2020. You can definitely help.

Friday

Such a big pull request created obviously more bugs. Anonymous reporting is activated with a flag and our flag didn't work as expected. So that was strange.

environment variables are always strings

After investigating a bit, we were using an environment variable for the activation with the value True or False in bash environment.

ANONYMOUS_REPORTING = True

and importing it in python with

ANONYMOUS_REPORTING = os.environ.get('ANONYMOUS_REPORTING') or False

then later on in the code it would be simple enough to do:

if ANONYMOUS_REPORTING:
    # do something clever here

Two mistakes here. Assumming that:

  1. True in bash will carry the same meaning than True once read in python
  2. True is not a boolean (and never was) but a string, which means that ANONYMOUS_REPORTING will always be True (in python boolean sense) because a string is true compared to the absence of a string.
>>> not ''
True
>>> not 'foo'
False

So to make it more explicit, we switched to ON or OFF values

ANONYMOUS_REPORTING = ON

In the process of doing this, we inadvertently (bad timing) into a regression because some flask modules have been adjusted to a different version of Werkzeug. So it is time for an upgrade.

So we are almost there but not yet.

By the end of this week, the epidemy is now close to 1000 deaths of Coronavirus. This is getting really serious.

Otsukare!