Chris Roos by Chris Roos

Week 339

Afternoon y’all.

Nothing out of the ordinary this week: We spent Monday to Thursday on Smart Answers and Friday (today!) on GFR.

Smart Answers


The end of our quest to convert Smart Answers to use ERB templates is now in sight! We finished the week with 32 of 35 smart answers converted.

I started to convert marriage-abroad (one of the largest Smart Answers) on Monday but was was forced to stop working on it when I realised that Tadas still has a large branch of changes waiting to be merged! I thought these changes were already in master but they were hiding in a closed pull request. I’d previously been in favour of closing these long-lived pull requests that were out for fact check but this incident made me realise that it’s not such a good idea.

I switched to converting the similarly large maternity-paternity-calculator instead. This ended up being quite painful and taking a good couple of days to convert. It was hard to see what was going on and I ended up trying to restructure it a couple of different ways before coming up with something that made the ultimate conversion easier. One positive side-effect of this particular conversion is that it fixes some problems with the version currently in production.

Tadas joined us in our office on Wednesday. We wanted to chat about the problems mentioned in week-338 and he was good enough to save us a trip to Aviation House by joining us in our office.

We discussed the problems Tadas experienced when working on overseas-passports. As mentioned last week, part of the problem is to do with the lack of indenting in the template files, and part of it is to do with the way the Smart Answer is structured. We agreed to prioritise investigations into both allowing us to indent the ERB templates, and into alternative ways of structuring the Smart Answer to make it easier to manage. James has been talking about how it might be useful to treat the Smart Answers that deal with country selection differently to the others. We’re hoping that anything we can do to improve this Smart Answer will also apply to some of the other larger answers.

I finished up the week with a pull request that allows us to indent the content in our ERB templates. Our initial concern about this approach was that we might break markup that relies on significant whitespace (e.g. indented lists and code blocks) but we don’t appear to be using any of those so our simple implementation might just be good enough.

Simplifying FlowRegistry

James made use of the fact that all our Smart Answers are now defined in classes to simplify the SmartAnswer::FlowRegistry class. It feels particularly good to see the use of eval removed.

Regression test artefacts

James spent some time converting our regression tests artefacts from HTML to Govspeak. While the HTML gave us lots of confidence to be able to make changes, it also caused us some pain when things outside of Smart Answer content changed (e.g. Google Analytics tracking). Having suffered this pain a few times now we decided it was finally time to switch from HTML to Govspeak. The Govspeak artefacts are both smaller and easier to read than their HTML counterparts. Compare this apply-tier-4-visa outcome in HTML and Govspeak to see the difference.

Hidden/failing tests

I was bitten by the problem of duplicate contexts hiding some failing tests when converting one of the Smart Answers to ERB. While I’ve not completely fixed the problem, I did make some changes to at least fix the hidden tests that were also broken.



Mocha celebrated its ninth birthday on Monday. Congratulations to James for doing such a great job of maintaining this popular open source library for such a long time.

Show and Tell

We hosted our 14th Show and Tell in our office on Tuesday. It was fairly quiet with just five of us in attendance, but enjoyable nonetheless. James is busy writing this up at the moment so I’ll leave it to him to say more about that.


I’ve spent most of the day writing up notes for weeks 338 and 339.

Have good weekends, and until next time.

– Chris

If you have any feedback on this article, please get in touch!

Historical comments can be found here.