Build1 publisher3 min readPublished
A test-migration harness gates every agent commit behind a real Playwright run
Migrating a legacy suite with a coding agent turns on proof, so this harness runs the migrated Playwright test itself, checks the required assertions, hashes the report, and only then lets the work commit.
The Engineer · Build desk

What happened
- An engineer writing on dev.to describes an agent harness that migrates a legacy test suite hands-free, planning each unit, writing the migration, exploring the running application, verifying and recording evidence.
- The model works inside the loop while the harness keeps scope, retries, verification, evidence and the final decision, so the agent never certifies its own migration.
- The verify step runs the migrated test with Playwright and confirms the required assertions pass, and the result is recorded as evidence attached to the change request.
- The unit of work is one test with its own cursor, evidence and commit, adopted after an earlier design that delegated whole files made failures ambiguous and retries wasteful.
Compiled by The EngineerSomething wrong?How this is made
Why it matters
- constraint A per-test verdict requires per-test independence, so a suite that shares browser state across ordered tests needs fixture work before this harness can drive it.
- decision Where a test runner already emits an authoritative pass/fail, the effort that would have gone into an eval framework goes into harness plumbing instead.
- capability An unattended run becomes resumable after a crash without re-migrating the tests that already passed verification.
- exposure The hash certifies the report, so anyone reviewing the evidence trail is trusting the assertion mapping for coverage.
Ground truth is why this design can skip an evaluation framework. The old test states the behavior to preserve, the running application can confirm whether the migrated test works, the assertions can be checked for coverage, and the test runner emits an authoritative pass/fail [4]. All of that is checkable without a second model's opinion on whether the output looks good [5]. The author states the goal as a Playwright test that demonstrably preserves the behavior of the legacy one [20].
The scaffolding sits in the per-phase context. In the original harness each phase had its own Markdown job card, plan.md, implement.md, verify.md, review.md and close.md, and each card gave the agent one responsibility, the allowed tools, the expected output and the rules relevant to that phase [11]. The fresh contexts are deliberate: the verifier inspects the implementer's files and evidence instead of inheriting the implementer's reasoning [12]. Those five cards are five prompt assemblies, and each has to stay current as the codebase moves [16].
That loop assumes a terminal coding agent that can inspect a repository, edit files, run commands and use tools; the author names Claude Code and Codex, and says he would not use a chat prompt to migrate a large suite today [17]. The underlying rule is credited to an Anthropic engineer: do not make the human continually prompt the agent, define the task and build a system capable of prompting itself as the work unfolds [13]. Nobody sits beside the run sending "now verify that" or "now fix the selector" [14]. The author wrote, "A model may propose a migration. It never gets to declare that migration complete."[6]
For the pattern to carry to another suite, the per-test cursor has to be real. The harness selects one independently verifiable test per unit of work [3]. A suite that logs in once and then depends on the order of the tests that follow lacks that cursor, so the verifiable unit slides back up to the file. File-level delegation is what the author tried first, and it made failures ambiguous, retries wasteful and progress fragile [10]. The application under test also has to be reachable, since the agent explores the live app when the legacy test is underspecified [1].
The evidence record has the same dependency. A hash pins the report that Playwright produced; the assertion mapping is the part that claims the report covered what the old test specified, and the old test is the behavioral specification here [7][15]. The post does not report how many tests the harness migrated, how often a first attempt failed verification, or what the runs cost [18]. The original harness ran a Ruby Watir suite to Playwright in a private codebase, and the public reference repository recreates the pattern on a bundled Protractor-to-Playwright example [8]. The author writes that "The framework names differ; the design problem does not."[19]
What to watch
- Whether the public reference repository moves past the bundled Protractor example to a suite with shared login state and order-dependent tests.
- Any published figures from the private Watir migration: tests attempted, first-attempt verification failure rate, agent cost per test.
- Whether the five job cards stay in sync as phases are added, or the verifier starts inheriting the implementer's context again.