refactor(container): /workspace/app 을 한 곳에서만 적는다 — 흩어진 사본 26개 정리 - #316
Merged
Conversation
같은 경로 문자열이 일곱 파일에 흩어져 있었다. 세 파일이 각자 APP_DIR 상수를 따로 선언하고,
나머지는 명령 문자열에 그대로 박아 넣었다("cd /workspace/app && ..." 를 손으로 잇는 자리가
열 곳).
값이 흩어져 있으면 "이 경로를 쓰는 곳이 어디인가" 에 답이 안 나오고, 그 약속이 깨졌을 때
무엇이 함께 깨지는지도 안 보인다. 실제로 두 번 연달아 터졌다:
- #303 — 프레임워크 없는 프로젝트는 스캐폴더가 안 돌아 코드가 /workspace 루트에 쌓였다.
저장소 push 가 "can't cd to /workspace/app" 으로 죽었는데, 프리뷰는 index.html 을 찾아다니는
폴백이 있어 화면은 멀쩡히 동작했다 — 승인 단계에 와서야 드러났다.
- #307 — 같은 계열. 배포 워크플로가 Node 프로젝트를 전제해 정적 사이트에서 죽었다.
- ContainerPaths.APP_DIR 하나로 모으고, "cd APP_DIR && X" 손 조립은 inApp(X) 로 바꿨다.
그 손 조립이 사본이 늘어나던 주된 경로였다.
- 둘 곳은 agent.infrastructure.docker 다 — 여섯 파일 모두 이미 그 패키지(DockerContainerService)
를 import 하고 있어 새 결합이 생기지 않는다.
- 코드 리터럴은 이제 ContainerPaths 한 줄뿐이다(나머지는 주석과 LLM 프롬프트).
프롬프트는 손대지 않았다 — 모델이 읽는 텍스트 블록이라 상수를 끼워 넣으면 읽기 나빠진다.
대신 CodeAgentPromptPathContractTest 가 프롬프트와 상수가 갈라지는 것을 잡는다. 사람이 두 곳을
같이 고치는 것에 기대지 않는다. 이번 정리의 요지가 "약속을 한 곳에 적는다" 인데, 프롬프트만
예외로 두면 그 자리가 다시 사각지대가 된다.
검증: CodeAgentPromptPathContractTest 1개 신규, 전체 1330개 통과. 동작 변경 없음.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013y8USoCXTsRTATAhy88M93
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
왜
같은 경로 문자열이 일곱 파일에 흩어져 있었다. 세 파일이 각자
APP_DIR상수를 따로 선언하고, 나머지는 명령 문자열에 그대로 박아 넣었다 —"cd /workspace/app && ..."를 손으로 잇는 자리가 열 곳.PreviewBranchPushServiceCodeAgentService(프롬프트)BackendSourceClone·PreviewWorkspaceServiceChangeService·DeployAgentService·PreviewRuntimeDetector값이 흩어져 있으면 "이 경로를 쓰는 곳이 어디인가" 에 답이 안 나오고, 그 약속이 깨졌을 때 무엇이 함께 깨지는지도 안 보인다. 실제로 두 번 연달아 터졌다:
/workspace루트에 쌓였다. push 가can't cd to /workspace/app으로 죽었는데, 프리뷰는 index.html 폴백이 있어 화면은 멀쩡히 동작해 승인 단계에 와서야 드러났다.무엇을
ContainerPaths.APP_DIR하나로 모으고,"cd APP_DIR && X"손 조립은inApp(X)로 바꿨다. 그 손 조립이 사본이 늘어나던 주된 경로였다.agent.infrastructure.docker— 여섯 파일 모두 이미 그 패키지를 import 하고 있어(DockerContainerService) 새 결합이 생기지 않는다.ContainerPaths한 줄뿐이다(나머지는 주석과 LLM 프롬프트).프롬프트는 손대지 않았다
모델이 읽는 텍스트 블록이라 상수를 끼워 넣으면 읽기 나빠진다. 대신
CodeAgentPromptPathContractTest가 프롬프트와 상수가 갈라지는 것을 잡는다.사람이 두 곳을 같이 고치는 것에 기대지 않는다 — 이번 정리의 요지가 "약속을 한 곳에 적는다" 인데, 프롬프트만 예외로 두면 그 자리가 다시 사각지대가 된다.
검증
전체 1330개 통과. 동작 변경 없음 — 값과 생성되는 명령 문자열이 모두 이전과 동일하다.
🤖 Generated with Claude Code
https://claude.ai/code/session_013y8USoCXTsRTATAhy88M93