Legacy test framework modernization with AI tooling
Challenge
A legacy test automation framework had grown hard to maintain: inconsistent style, uneven coverage from existing quality gates, and slow test development for new features.
Approach
The framework was refactored for structure and maintainability. The use and coverage of the existing linters and pre-commit hooks were expanded to make them more efficient and consistent. Reusable AI-agent skills and workflows were created together with other teams, supported by cross-team knowledge sharing. AI-assisted tools were built to accelerate test development, new-feature tests were added, and peers' merge requests were actively reviewed.
Outcome
A cleaner framework with consistently enforced checks, faster test development for new features, and shared AI practices adopted beyond a single team.
Case: a pre-commit gate that blocked correct commits
Challenge. One of the pre-commit gates checked the staged diff for the damage that scripted bulk edits leave behind: lost Windows line endings, broken encodings. It had become the gate that people skipped. Replayed against the whole history of the repository, about 1,200 commits, it had blocked 16 commits, and 14 of them were ordinary work: guides translated line by line, such as docs/ru/install-guide.html into docs/en/install-guide.html, a regenerated reports/site-map.xml with new dates, an asset folder renamed in every link. Each one needed a manual audit and a documented skip. At the same time real damage passed: a move of example scripts from samples/legacy/runner.js to samples/js/runner.js that silently lost their line endings, files with non-Latin names, and changes that were not staged yet.
Approach. The rules were rebuilt around one principle: block only the damage nobody makes on purpose, judged byte by byte against the previous version of the file. That means line endings lost together with an edit, flipped or mixed, replacement characters, mojibake (text garbled by reading it in the wrong encoding), a file saved in a legacy encoding, a byte-order mark. A file whose only change is a conversion to LF line endings passes, so the repository can move to one line-ending style in commits that only convert. Whitespace-only edits became notes that do not block, and large 1:1 rewrites pass. A mode that audits any existing commit was added and used to replay the whole history with the old and the new version, and every finding was reviewed. The mojibake rule was calibrated on all tracked files, the self-test grew from 5 to 32 cases in throwaway repositories, and the work per file was cut so that typical commits are checked up to five times faster.
Outcome. On the full history the new gate blocks none of the 14 false positives, still catches both real incidents and finds one the old gate had missed. Routine skips are no longer needed, the move to a single line-ending style no longer needs a skip either, the gate passes its own change, and the team documentation describes how to fix a hit instead of how to skip it.
Article author: Andrei Olegovich