Multi-File Refactor Safety Check
Описание и применение
Проверка зависимостей в CI предотвращает пропущенные импорты при многофайловых рефакторингах, выполненных AI‑агентом.
Задача
AI coding agents often miss updating imports in files outside their context window, causing silent failures that surface only during CI or production.
Результат
The CI pipeline now fails early when an AI agent misses an import, ensuring that all renamed symbols are consistently updated across the codebase.
Рабочий процесс
- 1. Identify the set of files the agent will edit and the mapping of old to new symbols.
- 2. Run the Python dependency‑graph script to build an import map for the project.
- 3. Execute the Bash wrapper, passing the project root, edited‑files CSV, and renames CSV.
- 4. If the script reports stale references, abort the CI and review the missed files.
- 5. Optionally split large refactors into smaller passes and repeat the check after each pass.
Доказательства
This function walks every Python file under root, builds a mapping from each file to the (module, name) pairs it imports, and then checks any file that was not edited for imports of renamed symbols.
Adding this step to your CI ensures that a missed import fails the build before it reaches production.
- Дата записи: 2026-09-16T14:30:35.173Z