While moving her personal site to Astro, the author built its verification with GitHub Copilot CLI and watched more than 2,000 assertions pass. A separate AI-assisted audit then showed that one check never compared the language switcher's href to the expected destination, so it went green without testing the requirement.
Key points
- hreflang links describe alternate language versions for search engines, not the .language-link switcher visitors click.
- The old check only confirmed a link existed, never that its href equalled the translated article's path.
- A valid URL can still be wrong: /de/ (the German homepage) passed where /de/writing/example-article/ was expected.
- The fix compares the switcher's href against an expected path defined outside the generated HTML, plus its lang attribute.
- The agent mutated an in-memory copy of the HTML to point at the German homepage and the new assertion failed as intended.
- More than 2,000 passing assertions say next to nothing about what the tests actually prove.
Why it matters
On a solo site, one unverified href is a small bug; the same pattern in a team pipeline gets expensive, because assertions an agent writes tend to reuse whatever the implementation produced. What changes in daily work is where the expected values live: a fixture or spec file a reviewer can read beats one derived from the page being checked.
Two habits are worth adopting before the next agent session — keep the assertions for critical requirements outside the generated output, and ask the agent to include a deliberately failing run as part of the deliverable. For teams that already gate builds in CI, the missing step is reviewing what a check asserts, not just whether it is green.
Real-world use
- A verifier script that inspects the static HTML a production build writes into dist/
- A bilingual site whose articles without a translation fall back to a deliberate default destination
- A small project where the agent writes both the implementation and its tests, so assertions risk confirming the code instead of the requirement
This summary was generated by the agent from the original post on DEV: githubcopilot. The full text and all rights belong to its author and publisher. Go to original