A blank page and a green test: the agent bug
Part four of the series on @relax.js/core explores silent failures where coding agents pass tests despite blank pages.

Stock photo for illustration only, not from the actual event
- Using @relax.js/core with coding agents reveals dangerous silent failures that make no noise.
- An agent's only view of a web page is a passing test, masking visual rendering failures.
- reportError() and captureRelaxErrors() functions help collect and inspect these hidden errors.
- Version 1.8.0 changelog lists multiple issues that previously failed without any notification.
This is the fourth installment in a series covering the use of @relax.js/core alongside a coding agent, focusing specifically on failures that make no noise. The core issue stems from a default behavior that is unsuited for an agent: since the agent's sole perspective of a web page is derived from automated tests, it writes a component, writes the test, executes it, and sees a successful green result even when the rendered output is completely broken.
Every error detected by the library flows through a single function named reportError(), which constructs a RelaxError containing a message and a context object, then hands it over to whatever handler was registered via onError(). Within an application, this handler typically logs errors to a monitoring service or displays a toast notification. If no handler is registered, the error is still preserved in window.relaxErrors, holding the fifty most recent entries while printing a single console line naming the array for the first unhandled occurrence.

Stock photo for illustration only, not from the actual event
To address this visibility gap, captureRelaxErrors() from @relax.js/core/testing swaps in a dedicated handler that collects errors instead of throwing them, providing a restore() method to revert the state. Once this communication channel was established, the author tracked down every scenario that previously failed silently. The version 1.8.0 changelog documents these fixes, with four of them integrated directly into the example application as automated tests.
In modern software engineering workflows involving AI coding agents, silent failures represent a critical blind spot because automated testing frameworks rely on pass/fail assertions rather than perceptual validation. Implementing robust error-interception mechanisms bridges the gap between unit test success and real-world application reliability, ensuring underlying template or rendering flaws do not slip past automated agents.
Additionally, render() evaluates context objects by identity comparison. Mutating an object and rendering it again produces no visible change because the engine perceives no structural difference. Furthermore, the template engine accepts { strict: true }, which causes any reported template error to throw immediately. The author avoids using this in production application code because a single typo should not result in a completely blank page for the user, whereas test capture mechanisms excel by collecting all errors rather than halting on the first failure.
The remaining open question involves ensuring the agent writes tests with the correct models and remembers to invoke the capture utility. The sixth article in the series addresses catching typos before rendering occurs, examining the test seam that allows an agent to bring a page onto the screen without relying on an actual browser.
Source: Dev.to
Found something wrong in this article? Report an issue with this article
Comments
Leave a Comment