Checkly, a monitoring platform that runs synthetic checks and uptime checks, recently rewrote its Results Daemon component from Node.js to Go using AI agents. The Results Daemon processes approximately 92 million messages every day, making it a critical component of the platform. The rewrite was motivated by the need to improve the component's performance and reduce the number of incidents.

The team at Checkly designed a test harness to ensure the new application's behavior matched the legacy system. The harness tests the component as a black box, with zero coupling between the code or language of the system under test and the harness itself. Every test case provides an input and expects a deterministic output, with all outputs recorded in "golden files." These files are generated against the legacy system and later used by the rewrite to assert byte-to-byte parity.

The test harness was built using Playwright, a testing framework built for reliability, with strong tooling for network interception and parallel test execution. Docker Compose was used to start and tear down containers for the boundaries, both locally and in CI. Toxiproxy, a TCP proxy, was used to emulate network conditions and test how the system behaves when surrounding infrastructure fails.

With the test harness in place, the team dispatched an instance of Claude Code, an AI agent, to rewrite the Results Daemon in Go. The agent produced a deployable service of about 13,000 lines of application code, architecturally mirroring the legacy implementation. The new application was then deployed to every environment except production, where it was tested and refined before being rolled out to customers.

The migration strategy was deliberately cautious, with the new daemon being deployed to internal accounts first, followed by free accounts, paid accounts, and finally enterprise accounts. The team monitored the rollout closely, fixing minor bugs and issues as they arose. The end result was a successful migration with no major incidents, and the legacy workload was decommissioned.The rewrite resulted in significant improvements, including a 70% reduction in running pods, improved database performance, and increased efficiency and operability. The new application also freed up around 15 vCPU and 45GB of memory, and the additional observability built into the new application helps with triaging during any alerts or incidents.

The success of the rewrite was attributed to the robust test harness, which guaranteed consistent behavior before any rollout. The team was able to ship agent-written code faster than before, trusting the harness to catch regressions instead of relying on manual review alone. The experience demonstrated the potential of AI agents in rewriting legacy applications, and the importance of rigorous testing and strict boundary definition in ensuring the success of such projects.

Este artículo fue escrito con la asistencia de IA.
News Factory APP - noticias agénticas para impulsar tu SEO y AEO.