ChatPaper.aiChatPaper

AI 코딩 에이전트를 활용한 명세 우선 수렴: 테스트 오라클과 인간 코드 리뷰 없이 717,000줄 코드베이스의 189개 파일에 걸쳐 핵심 아키텍처 불변식을 해체한 사례 연구

Specification-first convergence with an AI coding agent: a case study of dismantling a core architectural invariant across 189 files in a 717k-line codebase with no test oracle and no human code review

August 12, 2026
저자: Joel Abenhaim
cs.AI

초록

본 논문은 명세 우선 프로토콜 하에서 AI 코딩 에이전트가 수행한 대규모 아키텍처 리팩토링에 대한 단일 사례 연구를 보고하며, 생성된 코드에 대한 인간의 검토나 목표 동작을 검증할 사전 오라클 없이 완전한 계측(instrumentation)이 이루어졌다. 대규모 상호의존적 코드베이스에서 핵심 불변식(invariant)을 제거하는 작업은 저자가 평가하기에 점진적 리팩토링으로는 사실상 불가능한, 통상적으로 재작성(rewrite)이 요구되는 유형의 변경이었다. 본 논문에서 기술하는 프로토콜 하에서 에이전트는 이 작업을 성공적으로 완료하였다. 대상 시스템은 3,648개 파일에 걸친 717,725줄 규모의 프로덕션 TypeScript 애플리케이션이다. 작업은 핵심 수명주기 불변식, 즉 AI 요청이 진행되는 동안 UI 패널이 열린 상태로 유지된다는 보장을 제거하는 것이었다. 목표 동작은 스트리밍 생성이 패널 닫힘 이후에도 존속하고, 패널을 다시 열면 손실이나 중복 없이 동일한 라이브 스트림에 재연결될 수 있는 것이었다. 프로토콜은 다음과 같다: 에이전트에 의한 공식 명세 작성, 14회의 정제 주기(refinement cycle)를 통한 소스 코드 대비 명세 감사, 원자적 구현, 컴파일/테스트 피드백 루프, 이후 17회의 검증 주기를 통한 동결된 명세 대비 코드 감사. 총 31회의 감사 패스에 걸쳐 어떤 인간도 프로그램을 실행하기 전에 201개의 결함이 수정되었다. 수렴 기준은 경험적이었는데, 연속된 두 차례의 검증 패스에서 발견 사항이 0건으로 반환되는 것이었다. 이 변경은 189개 파일(신규 31개)에 영향을 미쳤으며, 추출 단계를 포함하면 두 커밋은 총 288개 파일, 34,770줄의 삽입, 16,422줄의 삭제로 구성된다. 첫 번째 세션과 이후 약 30회의 후속 세션에 걸쳐 소프트웨어는 명세대로 동작하였고 관찰된 버그는 없었다. 소요 시간은 3일, 비용은 미화 2,430달러였다. 전체 명세와 원시 세션 로그(프랑스어 1,500페이지 이상)는 증거 자료로 공개되어, 프로세스에 대한 검토와 일관성 확인을 위한 언어 모델 제출이 가능하다.
English
This paper reports a single, fully instrumented case study of a large-scale architectural refactoring by an AI coding agent under a specification-first protocol, with no human review of the generated code and no pre-existing oracle to validate the target behaviour. The task, dismantling a central invariant across a large interdependent codebase, was assessed by the author as effectively infeasible through incremental refactoring, the kind of change that conventionally calls for a rewrite instead. Under the protocol described here, the agent completed it successfully. The system is a 717,725-line production TypeScript application across 3,648 files. The task required dismantling a core lifetime invariant: the guarantee that a UI panel remains open for the duration of an AI request. The target behaviour was that a streaming generation survives the closing of its panel and can be reattached, on reopening, to the same live stream with no loss or duplication. The protocol: formal specification by the agent, 14 refinement cycles auditing that specification against the source code, atomic implementation, a compile/test feedback loop, then 17 verification cycles auditing the code against the frozen specification. Across 31 audit passes, 201 defects were corrected before any human executed the program. The convergence criterion was empirical: two consecutive verification passes returning zero findings. The change touched 189 files (31 new); with the extraction phase, the two commits total 288 files, 34,770 insertions, 16,422 deletions. Across the first and roughly thirty later sessions, the software behaved as specified, no bug observed. Elapsed: three days; cost: USD 2,430. The full specification and raw session logs, 1,500+ pages in French, are published as evidence, allowing inspection of the process and submission to a language model for consistency checking.