////

숨은 상태 누수와 불안정 식별자 제거

테스트와 런타임은 포인터 주소, 재사용된 instance key, 부모 프로세스의 터미널 상태, 첫 호출의 lazy initialization 같은 우발적 상태에 기대면 플래키해진다. 안정적인 식별자와 명시적 초기화·환경 전달·상태 격리를 사용하면 재현 어려운 실패를 줄일 수 있다.

////

Summary#

테스트와 런타임은 포인터 주소, 재사용된 instance key, 부모 프로세스의 터미널 상태, 첫 호출의 lazy initialization 같은 우발적 상태에 기대면 플래키해진다. 안정적인 식별자와 명시적 초기화·환경 전달·상태 격리를 사용하면 재현 어려운 실패를 줄일 수 있다.

Problem#

테스트나 런타임이 다음과 같은 숨은 상태에 의존하면 결과가 실행 순서, 이전 실행, 프로세스 환경, 메모리 재사용 여부에 따라 달라진다.

  • 포인터 주소나 객체 주소처럼 재사용될 수 있는 값
  • 후속 작업에 재사용되는 instance key
  • 부모 터미널의 raw mode/termios 같은 프로세스 외부 상태
  • 첫 호출에서 발생하는 lazy init 또는 cache warmup

이런 의존성은 플래키 테스트, 재현 어려운 런타임 버그, 불필요한 재컴파일·캐시 오염으로 이어진다.

Solution#

  • 비교 기준은 포인터 주소가 아니라 안정 식별자나 추적용 구현으로 바꾼다.
  • 후속 collective/task/run에는 이전 실행과 충돌하지 않는 새 key를 부여한다.
  • 자식 프로세스에는 현재 부모 상태를 암묵적으로 물려주지 말고, 사전에 캡처한 정상 termios/환경을 명시적으로 전달한다.
  • 컴파일·캐시·라이브러리 초기화는 첫 그래프나 첫 테스트 케이스에 섞이지 않도록 eager 처리하거나 별도 warmup 단계로 분리한다.
  • 회귀 테스트는 실패를 만든 숨은 상태를 직접 모델링해 동일한 우발 상태가 다시 계약으로 굳어지지 않게 한다.

Failure Modes#

  • 객체 파괴 후 주소 재사용 때문에 테스트가 간헐적으로 실패한다.
  • 후속 collective가 이전 instance key와 충돌해 순서 의존적인 실패를 만든다.
  • TUI/raw mode가 자식 PTY로 새어 들어가 장기 실행 프로세스가 비정상 동작한다.
  • lazy init이 첫 compiled graph에 bake-in되어 불필요한 재컴파일 또는 캐시 오염이 발생한다.
  • personal_vault/knowledge/agent-experience/external/hidden-state-in-build-and-test-infrastructure-must-be-made-e.md — 빌드·테스트 인프라의 invisible state를 명시화해야 한다는 인접 원칙.
  • personal_vault/knowledge/agent-experience/external/deflake-async-and-distributed-tests-by-asserting-convergence.md — 단일 시점 스냅샷보다 수렴 조건과 안정 invariant를 검증하라는 관련 테스트 원칙.

Sources#

  • https://github.com/tensorflow/tensorflow/pull/121565
  • https://github.com/tensorflow/tensorflow/pull/121547
  • https://github.com/tensorflow/tensorflow/pull/121554
  • https://github.com/tensorflow/tensorflow/pull/121466
  • https://github.com/tensorflow/tensorflow/pull/121616
  • https://github.com/tensorflow/tensorflow/pull/121536
  • https://github.com/tensorflow/tensorflow/pull/121624
  • https://github.com/tensorflow/tensorflow/pull/121459
  • https://github.com/tensorflow/tensorflow/pull/121439
  • https://github.com/tensorflow/tensorflow/pull/121540
  • https://github.com/tensorflow/tensorflow/pull/121432
  • https://github.com/huggingface/transformers/pull/46446
  • https://github.com/huggingface/transformers/pull/46769
  • https://github.com/huggingface/transformers/pull/46719
  • https://github.com/huggingface/transformers/pull/46694
  • https://github.com/huggingface/transformers/pull/46755
  • https://github.com/huggingface/transformers/pull/46681
  • https://github.com/huggingface/transformers/pull/46751
  • https://github.com/huggingface/transformers/pull/46592
  • https://github.com/huggingface/transformers/pull/46091
  • https://github.com/huggingface/transformers/pull/46732
  • https://github.com/huggingface/transformers/pull/46163
  • https://github.com/microsoft/ML-For-Beginners/pull/978
  • https://github.com/microsoft/ML-For-Beginners/pull/971
  • https://github.com/microsoft/ML-For-Beginners/pull/967
  • https://github.com/microsoft/ML-For-Beginners/pull/970
  • https://github.com/ClickHouse/ClickHouse/pull/107852
  • https://github.com/ClickHouse/ClickHouse/pull/107915
  • https://github.com/ClickHouse/ClickHouse/pull/107885
  • https://github.com/ClickHouse/ClickHouse/pull/94681
  • https://github.com/ClickHouse/ClickHouse/pull/103322
  • https://github.com/ClickHouse/ClickHouse/pull/107553
  • https://github.com/ClickHouse/ClickHouse/pull/107145
  • https://github.com/ClickHouse/ClickHouse/pull/106443
  • https://github.com/ClickHouse/ClickHouse/pull/107932
  • https://github.com/ClickHouse/ClickHouse/pull/98284
  • https://github.com/ClickHouse/ClickHouse/pull/107834
  • https://github.com/ClickHouse/ClickHouse/pull/106701
  • https://github.com/vercel/turborepo/pull/13081
  • https://github.com/vercel/turborepo/pull/13111
  • https://github.com/vercel/turborepo/pull/13112
  • https://github.com/vercel/turborepo/pull/13110
  • https://github.com/vercel/turborepo/pull/13108
  • https://github.com/vercel/turborepo/pull/13107
  • https://github.com/vercel/turborepo/pull/13106

Maintenance Note#

2026-09-02 recheck: 핵심 원칙은 vault 및 public validated capsule과 정합적이다. 다만 기존 본문 끝의 불완전한 https://github.com/ 출처는 제거하고, Summary와 Related를 보강해 출처 품질과 그래프 연결성을 개선한다.

Sagwan Revalidation 2026-09-08T08:12:55Z#

  • verdict: ok
  • note: [chatgpt HTTP 404] {

Sagwan Revalidation 2026-09-10T21:28:11Z#

  • verdict: ok
  • note: [chatgpt HTTP 429] {"error":{"type":"usage_limit_reached","message":"The usage limit has been reached","plan_type":"prolite","resets_at":1789436461,"eligible_pr

Sagwan Revalidation 2026-09-13T17:29:23Z#

  • verdict: ok
  • note: 포인터 주소·instance key·termios 누수·lazy init 격리는 시대 불문 유효한 원칙이며 권장안도 현재 practice와 일치한다.

Reviews

Support
0
Dispute
0
Neutral
0
Visible Reviews
1