An AI-assisted code audit found that my language-switcher test could pass without checking the destination visitors would actually use.
While modernizing my personal website, yonka.dev, I used GitHub Copilot CLI to assist with implementation, code review, and automated verification. I replaced an ASP.NET-based site with Astro, which generates static HTML during a production build.
This was a personal website, not a large production system. I chose it as a manageable place to experiment with AI-assisted engineering. I had taken a course on GitHub Copilot CLI, which helped me learn the tool, but it didn't give me a complete workflow for deciding what to delegate, what to review, or what evidence to trust. Those questions became concrete once I started building.
I didn't begin with an established workflow. I let Copilot analyze the project and propose approaches, then examined the results and learned from the gaps I found. Even on a small website, this gave me problems to work through that a course alone hadn't prepared me for.
One requirement was simple: the site supports English and German, and switching languages should open the equivalent page when a translation exists. My automated verification reports eventually showed more than 2,000 passing assertions. Then a separate AI-assisted code audit found that one check could pass without confirming where the visible language switcher actually led.
The audit did not uncover a broken link on the live site. It uncovered a test that wasn't checking the requirement I thought it was.
A passing check for the wrong thing
A successful Astro build means the site was generated, not that every page behaves as intended. To examine the output, I had used Copilot to help create scripts/verify-dist.mjs, a JavaScript verifier that reads the generated HTML in dist/. In other words, the checks examined the built pages, not merely the source templates. The problem wasn't a discrepancy introduced by Astro during the build; it was what the verifier chose to inspect.
The existing check examined links with a hreflang attribute. These links describe alternative language versions of a page for search engines. That's useful metadata to verify, but it is separate from the language switcher visitors click.
The visible switcher was identified by the CSS class .language-link. Its lang attribute described the language of the link text, while its href determined the destination. To test the navigation requirement, the verifier needed to compare that href against the expected destination for the current page. It didn't.
Consider a visitor reading an English article with a German translation. These two links look nearly identical:
Expected destination:
<a class="language-link"
lang="de"
href="/de/writing/example-article/">
Deutsch
</a>
Wrong destination:
<a class="language-link"
lang="de"
href="/de/">
Deutsch
</a>
Both URLs can point to existing pages. But only the first takes the reader to the translated article; the second sends them to the German homepage. Because the original check inspected different language-related links, it could pass in either case. Checking that a link exists, or even that its destination exists, would not establish that it leads to the right page.
Correcting the assertion
After examining the finding, I used Copilot CLI to update the verifier. The corrected check reads the visible switcher's href and compares it with an expected path defined separately from the generated HTML:
const destination = attr(switcher ?? "", "href");
if (destination !== expectedPath)
fail(
page,
`language switcher points to ${destination ?? "nothing"}, expected ${expectedPath}`
);
Simplified excerpt from the updated verification script.
The full correction also checks the switcher's lang attribute and handles articles without a German translation. For those pages, the site has an intentional fallback destination. The expected result therefore depends on the route; it cannot be derived simply by assuming every article has a translated counterpart.
Defining those expectations independently is important. If a test gets its expected destination from the same generated link it is validating, it can confirm that the implementation agrees with itself without confirming that it meets the requirement.
The revised verification passed against the normal build. But a passing result alone was exactly what had misled me before. I wanted evidence that the new assertion would reject the specific error the old one had missed.
Making the test fail on purpose
I asked the agent to run a controlled negative test: take a correctly generated article switcher and replace its destination with the German homepage in a temporary, in-memory copy of the HTML. No source file or deployed page was changed.
When the agent ran the corrected logic against that modified HTML, the assertion failed as expected. It rejected the homepage destination even though the URL itself was valid.
![Diagram showing a correct language-switcher destination, an intentionally incorrect destination, and the verification rejecting the incorrect one.]

The controlled incorrect destination was rejected by the updated check.
This confirmed that the updated check could detect the specific error we introduced. It didn't establish that every possible language-switching scenario was covered.
What this is changing in my approach
More than 2,000 passing assertions may sound excessive for a personal website, but many were repeated checks across generated pages. I don't think the count itself tells me much about the quality of verification anymore. In this case, one missing comparison mattered more than all the passing results around it.
I had relied heavily on AI to write and run the checks. A separate AI-assisted audit caught the omission, and the agent also ran the negative test that confirmed the correction. Both were useful, but neither replaced my responsibility to understand what the tests actually proved. I had reviewed the results without looking closely enough at this particular assertion.
What I'm beginning to question is not only an individual test, but how I organize verification work. I had accumulated checks for the site as a whole. For future changes, I want to try a more gradual approach: agree on the expected behavior for a small piece of work, check that behavior before moving on, and use the broader suite to catch regressions. A common verifier can still be part of that approach; it just shouldn't be the only place where I discover whether a requirement was understood correctly.
What I'm taking from this
- A passing count isn't the same as coverage. I need to look at what a critical check asserts, not just how many checks passed.
- A wrong outcome is worth testing deliberately. Seeing the updated verifier reject an incorrect but valid URL gave me more useful evidence than another successful run.
- The workflow needs attention as well as the code. I want to define expected outcomes earlier, verify smaller changes as I go, and introduce my own checkpoints for important behavior. That's an approach I'm still working out, not a process I had in place during this modernization.
For this project, the concrete result was modest but useful: the verifier now distinguishes a translated article destination from an existing but incorrect homepage destination. The broader lesson I'm taking into future projects is to treat passing tests as evidence to examine, not as proof that the requirement was tested.
This experience also changed how I think about using GitHub Copilot CLI. I had focused on what I could delegate and automate. I'm now beginning to pay more attention to how I define the work, review the evidence, and decide when a result is good enough to accept.
Top comments (2)
A passing test that never checked the href is just a count. The negative test does the real work.
I agree and this is exactly what comes as an improvement in my next project :)