I Only Wanted to Add a Link
Have you ever opened a repo to change one line, then found yourself wondering whether the repo needs a better way of deciding what a line is?
I wanted to put a blog link on my homepage. A working link. Preferably one you could find on a phone without opening a menu. Naturally, I took this as an opportunity to try out a model-driven development pipeline.
There’s probably a perfectly good reason I never finish the little jobs first.
How much model does a link need?
My first instinct with Clanker Foundry was to think about all the things I could model. The UI, the API, the infrastructure. At that rate I’d have had a diagram explaining how to deploy the diagram.
The homepage ended up with a much smaller model. It owns the opening paragraph and the Projects and Blog links. The editor-looking layout can stay where it is. So can the CSS. If I want to change where the blog link goes, there’s one place to do it, and a small script updates the HTML from there.
That was a useful limit. A model for the things I wanted to change was enough. The rest of the site didn’t need to move house.
The part that made it worth keeping
The check I cared about was pretty easy to say out loud:
Given I’m on my phone with the menu closed, when I find the blog link and press Enter, then it should open the blog.
That expectation lives separately from the model. Otherwise I could put the wrong address in the model, generate the wrong link, and have a test proudly confirm that I’d generated exactly the wrong link I asked for.
Which is a very efficient way of being wrong.
For the actual check, Chromium looked at the page people would use. Then we hid the link with CSS on purpose. The model still checked out. The generated HTML still checked out. The browser test failed because you couldn’t see or use the link. That was the bit I wanted to know.
Foundry puts the change and those scenarios in the same HTML review, with what we expected beside what happened. I can read the interesting part without opening three files and trying to remember which one I was looking at. I can still open those files if something looks off.
Would I do this for another link?
Probably not from scratch. If the machinery is already there, though, I’d use it again. The next thing I’d want to try is a change where a reviewer might reasonably say, “Hang on, I don’t think that’s what we meant.” If the review makes that conversation easier, I’ve got something useful.
In the meantime, the blog link works. I’m counting that as a win, even if it took me a slightly unusual route to get there.