Commit Graph
9 Commits
Author SHA1 Message Date
DongHyeonka 9ebd0856a1 fix(ci): provider job에 sandbox runner 요구를 적고 시작 때 namespace를 점검한다
frontend-quality-gates / FE-GATE-022 / runbook-chunk-mismatch (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-018 / field-web-vitals (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-017 / diagram-review (pull_request) Canceled after 0s
frontend-quality-gates / main / self-tests and removal drills (pull_request) Canceled after 0s
frontend-quality-gates / merge / static checks (pull_request) Canceled after 0s
frontend-quality-gates / merge / tests (pull_request) Canceled after 0s
frontend-quality-gates / merge / browser tests (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-014 / config-compatibility (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-026 / lab-performance (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-028 / manual-accessibility-review (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-015 / immutable-release-candidate (pull_request) Canceled after 0s
frontend-quality-gates / external-vulnerability-provider (pull_request) Canceled after 0s
frontend-quality-gates / external-provenance-provider (pull_request) Canceled after 0s
frontend-quality-gates / promote-verified-immutable-candidate (pull_request) Canceled after 0s
frontend-quality-gates / deploy-promoted-release (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-019 / hosting-header (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-021 / runbook-boot-config (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-023 / runbook-api-degradation (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-024 / runbook-telemetry (pull_request) Canceled after 0s
frontend-quality-gates / FE-GATE-025 / runbook-release-rollback (pull_request) Canceled after 0s
문제: release의 provider job 둘(vulnerability·provenance)은 FE-GATE-013과
같은 provider sandbox(systemd-run scope, bwrap --unshare-pid/ipc/uts/net)를
돈다. 그런데 생성 workflow의 runner 요구 주석은 게이트의
hostRequirements에서 나와 merge_test에만 붙고, provider job에는 없다.
provider 감독 스크립트의 시작 점검도 실행 파일이 있는지만 봐서, 비특권
user namespace를 막는 runner에서는 나중에 bwrap 원문 오류로 끝난다.

고른 방법:
- 계약 job에 선택 칸 `hostRequirements`를 두고 provider job 둘에
  FE-GATE-013과 같은 요구를 적는다. 계약이 provider job의 요구가
  FE-GATE-013과 같은지 보고(갈라지면 거절), provider 밖 job은 이 칸을 못
  쓴다. 생성기가 그 job의 runs-on 옆에 주석을 쓴다.
- `check-system-test-prerequisites.ts`에서 namespace 점검만 함수로 내보내고
  (`findProviderSandboxNamespaceFailure`), `run-and-validate-provider.ts`가
  provider를 띄우기 전에 부른다. 실패하면 test:system 사전 점검과 같은
  문구(제한 이름, bwrap stderr, host 설정, 고치는 법)로 멈춘다.
- 버린 대안: 생성기가 hostEnvironment 게이트의 요구를 provider job에
  저절로 붙이기. 연결이 계약에 보이지 않는다.

위험·한계: provider job은 release 단계라 PR run에서 돌지 않는다. 새
점검은 desktop FE-GATE-013의 provider 시스템 시험(감독 스크립트를 실제로
띄움)으로 본다. 「provider 없이 배포할 때」 문서 절은 소유자 결정이라
이 커밋에 없다.

검증(desktop): 구현을 main으로 되돌리고 새 시험만 둔 상태에서 4개 실패
(RED), 고친 뒤 system-test-prerequisites·ci-workflow-generation 445개 통과,
generate:ci-workflow·스냅샷 갱신, check:ci·check:types·eslint rc=0,
verify:documentation PASS_SCOPED. desktop `scripts/verify.sh gate FE-GATE-013`
rc=0 226초(시스템 컨테이너, system 시험 115개 통과 — provider 감독
스크립트를 실제로 띄워 새 점검을 거친다). 로그 /tmp/claude-gates/w2fe2-prov1/,
w2fe2-prov013/.

Refs: 1101/13-03
2026-11-13 05:02:16 +09:00
DongHyeonka 9655958bda fix(ci): test:system 사전 점검이 bwrap namespace를 실제로 만들어 본다
문제: FE-GATE-013의 provider sandbox는 bwrap을 --unshare-pid
--unshare-ipc --unshare-uts --unshare-net으로 띄운다. bwrap이 setuid가
아니므로 비특권 user namespace가 있어야 한다. 사전 점검
(scripts/check-system-test-prerequisites.ts)은 실행 파일·cgroup·systemd
bus만 보고 bwrap을 한 번도 실행하지 않는다. 그래서 이 제한이 있는 호스트
(Ubuntu 24.04, kernel.apparmor_restrict_unprivileged_userns=1)에서 PASS를
낸 뒤 provider 테스트 114건 중 18건이 "bwrap: loopback: Failed
RTM_NEWADDR: Operation not permitted" 또는 그 provider를 기다린 시간
초과로 실패한다. 이 조건은 runner 요구 목록, gate 정의, workflow 어디에도
없고 운영 원장의 일회성 메모에만 있다.

고른 방법:
- 사전 점검이 provider와 같은 namespace 옵션으로 bwrap에서 /bin/true를 한
  번 띄운다. 실패하면 "this host does not allow unprivileged user and
  network namespaces", bwrap stderr(최대 4줄), user namespace sysctl 값,
  고치는 방법 셋(AppArmor profile, sysctl, 다른 runner)을 적고 exit 1.
  기존 검사(실행 파일 3개, cgroup v2, systemd bus)는 그대로 둔다.
- 옵션 목록을 scripts/lib/provider-sandbox-namespaces.ts로 옮기고
  run-and-validate-provider.ts와 사전 점검이 같은 상수를 쓴다. 둘이
  갈라지면 점검이 다른 것을 시험하게 된다.
- 점검을 findSystemTestPrerequisiteFailures(host)로 내보내고 access·
  readFile·spawn을 주입받는다. CLI 동작(출력·exit 코드)은 같다.
- config/ci/gates.json의 FE-GATE-013에 hostRequirements 두 줄을 둔다.
  gate schema에 선택 필드를 더하고, generator가 그 gate를 도는 job의
  runs-on 바로 위에 "# FE-GATE-013 runner requirement: ..." 주석으로
  그린다. runner를 고르는 사람이 보는 자리다. 줄바꿈은 기존 nonEmpty
  규칙이 막으므로 주석 밖으로 나갈 수 없다. 이 필드는 gate의 명령·증거가
  아니라 runner 설명이라 기준선 gate shape 해시에는 넣지 않았다(기준선
  재기록 불필요).
- 요구 목록 세 곳(docs/operations/ci-quality-gates.md,
  docs/security/supply-chain.md, docs/testing/taxonomy.md)과 README merge
  게이트 절에 조건을 적었다. ci-quality-gates.md에 AppArmor profile 예시를
  두었다.

버린 대안:
- namespace가 없으면 provider 테스트를 skip: 거짓 초록이다.
- FE-GATE-013을 release 단계로 옮김: PR마다 sandbox 검사를 잃는다.
- probe를 systemd-run --user --scope 안에서 돌림: 리뷰 11-R10에서 scope
  안과 밖의 결과가 같았다. 직접 실행이 더 단순하다.
- workflow에 요구 사항을 runs-on label로 표현: runner label 체계가 아직
  없다. 주석이 지금 가능한 가장 작은 표시다.

위험·한계:
- probe는 bwrap에 --ro-bind / /만 준다. --size 같은 provider의 다른
  옵션 지원은 여기서 보지 않는다(기존과 같다). probe가 다른 이유로
  실패해도 namespace 문구가 나오지만 bwrap stderr를 같이 적는다.
- 호스트를 고칠지는 호스트 소유자가 정한다. 이 커밋은 조건을 적고 알리기만
  한다. 이 desktop에서 FE-GATE-013은 여전히 실패하고, 이제 첫 단계에서
  이유와 함께 실패한다.
- gate schema에 선택 필드 hostRequirements가 생겼다. 기존 gates.json과
  제품 overlay는 그대로 통과한다.

검증: desktop batch에서 확인
- node scripts/run-vitest.ts run tests/unit/system-test-prerequisites.test.ts tests/unit/ci-workflow-generation.test.ts
- corepack pnpm check:ci, check:types, lint, verify:documentation
- desktop에서 node scripts/check-system-test-prerequisites.ts가 exit 1과
  namespace 문구를 내는지, FE-GATE-013이 그 단계에서 멈추는지

Refs: 1105/12-01, 1105/11-02
2026-11-05 22:06:59 +09:00
DongHyeonka 0edc3fc90a fix(provider): worktree의 .git 파일을 샌드박스에서 가리고 다른 checkout은 복사하지 않는다
문제
scripts/run-and-validate-provider.ts는 작업 폴더에 .git이 있으면 그 자리에
--tmpfs를 건다. git worktree나 서브모듈 checkout에서는 .git이 디렉터리가
아니라 "gitdir:" 한 줄짜리 파일이라 bubblewrap이 "Can't mkdir …/.git: Not a
directory"로 끝난다. 그래서 worktree에서 test:system을 돌리면 사전 점검은
PASS인데 provider 테스트 16개가 샌드박스 회귀처럼 실패한다. 또 provider 기반
fixture는 현재 폴더를 통째로 복사해, checkout 안의 .claude/worktrees/*나
.tmp/* 같은 다른 checkout·드릴 fixture와 그 node_modules까지
/tmp/ci-provider-upload-*에 복사했다(시간 초과, ENOTEMPTY).

고른 방법
- .git이 디렉터리면 지금처럼 tmpfs로 가린다. 디렉터리가 아니면 /dev/null을
  --ro-bind로 겹친다. bubblewrap은 bind를 nodev로 걸어서 provider는 그 줄을
  읽지도 그 경로에 쓰지도 못한다. 파일이 가리키는 실제 git 디렉터리는 작업
  폴더 밖이라 원래 샌드박스에 들어오지 않는다.
- 리뷰 최소 개선 (1)(사전 점검이 worktree를 거부) 대신 (2)를 골랐다. 이
  repo의 리뷰·수정 절차가 영역마다 worktree를 쓰므로, worktree에서
  샌드박스 경계 테스트를 돌릴 수 있어야 한다. 비용도 몇 줄로 비슷하다.
- 기반 fixture 복사에서 .claude, .worktrees, .tmp, graphify-out을 뺀다. 모두
  추적하지 않는 폴더라 후보의 추적 파일 목록에는 영향이 없다.
- 새 system 테스트 2건이 .git이 디렉터리일 때와 파일일 때 provider가 그
  내용을 보지도 바꾸지도 못함을 확인한다.
- 버린 대안: --dev-bind /dev/null. 읽으면 빈 내용이지만 쓰기를 받는다.
  --remount-ro를 더하면 nodev가 다시 걸려 --ro-bind와 같아진다. 빈 일반 파일을
  호스트에 만들어 bind. 임시 파일의 수명·정리 경로가 하나 는다.

위험·한계
- .git 파일 자리에서 provider는 빈 파일이 아니라 열 수 없는 문자 장치를
  본다(EACCES). 작업 폴더를 훑는 provider가 그 오류를 실패로 다루면 거기서
  드러난다.
- 마스크를 지우는 변이 확인은 부하(load 24) 때문에 systemd unit 수거가 늦어
  결론을 내지 못했다(두 경우 모두 "provider unit remained loaded").

검증
- RED: worktree에서 test:system 16 failed / 96 passed(모두 provider 묶음,
  같은 bwrap 오류). 새 테스트는 수정 전 "file" 경우만 실패.
- 수정 뒤 새 테스트 2건 통과(-t "hides repository metadata").
- eslint 통과.

Refs: docs/reviews/2026-11-03-maturity-review/11-tests-browser-release-scale.md 11-04
2026-11-04 21:04:53 +09:00
DongHyeonka 0536891c05 feat(provider): 실행 단계가 자기 PID와 argv를 실행 기록에 남긴다 (11-01)
문제: tests/system의 cgroup 테스트는 provider 실행 중 /proc을 5 ms마다
표본으로 읽어 어떤 프로세스가 어떤 argv로 돌았는지 판정한다.
systemd-run --scope는 scope로 옮긴 뒤 같은 PID에서 sh 게이트와 scope
wrapper로 exec하고, 갓 fork된 자식은 exec 전까지 부모 argv를 보인다.
표본은 PID마다 처음 본 argv만 남겨 이 짧은 단계를 자주 놓친다. 운영
코드에는 테스트가 결정적으로 읽을 실행 증거가 없다.

고른 방법: scripts/lib/provider-process-trace.ts를 추가한다.
PROVIDER_PROCESS_TRACE_PATH가 있을 때만 각 단계가 JSON 한 줄을
덧붙인다.
- 자기 기록: supervisor와 scope wrapper가 /proc/self/cmdline과
  /proc/self/cgroup을 남긴다(커널이 본 값).
- 자식 기록: supervisor가 systemd-run, guardian client가 guardian,
  wrapper가 bwrap을 spawn에 넘긴 argv 배열 그대로 남긴다. spawn과 기록이
  같은 배열을 쓴다.
- 필드는 role, pid, ppid, argv, (자기 기록만) cgroup. 환경변수는 담지
  않는다. credential과 provider 명령이 지나가는 곳이기 때문이다.
- systemd-run 환경은 허용 목록으로 다시 만들어지므로
  providerProcessTraceEnvironment()로 기록 경로만 넘긴다. bwrap은
  --clearenv라 sandbox 안의 provider는 경로를 받지 않는다. guardian은
  빈 환경을 그대로 두고 client가 spawn 지점에서 기록한다.

테스트용 opt-in으로 두고 운영 감사 증거로 쓰지 않는다. 운영에서 켜면
argv가 두 번째로 남는 곳이 생긴다. 나중에 credential이나 provider
명령이 argv에 들어가는 회귀가 생기면, 지금은 /proc에 잠깐 보이는 값이
파일로 남아 CI 산출물이 될 수 있다. 감사 증거로 쓰려면 봉인 보고서와
같은 경로 안전·크기 상한·스키마·보존 정책이 필요하고 이번 범위가
아니다. CI 워크플로는 이 변수를 설정하지 않는다.

버린 대안:
- /proc 표본 보강(부모와 같은 argv 무시, PID별 argv 이력 보존): 리뷰
  README 13.1에서 시도하고 되돌렸다. 이력 보존은 prlimit -> sh로 바뀌는
  PID 이력에 provider 명령이 섞여 "인프라 argv에 명령 없음" 단언의
  뜻이 바뀐다.
- spawn 직후 /proc/<pid>/cmdline 읽기: libuv는 exec 뒤에 반환하지만
  systemd-run은 곧 wrapper로 다시 exec하므로 경쟁이 남는다.
- guardian 자기 기록: guardian이 빈 환경으로 뜨는 것이 보장이라 기록
  경로를 넘기지 않는다.

위험·한계:
- 기록은 각 단계가 스스로 남긴다. 새 spawn 지점이 기록을 빠뜨리면
  테스트에서 보이지 않는다. 모듈 주석에 적었다.
- 기록 실패는 run 결과를 바꾸지 않고 stderr에 한 줄 남긴다. wrapper의
  stderr는 provider 출력으로 버려지므로 빠진 줄은 기록을 읽는 쪽에서
  드러난다.
- 변수가 없으면 spawn 인자와 환경은 이전과 같다.

검증:
- node scripts/run-vitest.ts run tests/unit/provider-process-trace.test.ts
  2건 통과. 자식 기록에 env 필드를 넣는 변이를 넣으면 실패한다.
- 관련 테스트 6파일 44건 통과(provider-process-trace, task3-selective-
  integration, provider-output-limiter, security-provider-evidence,
  provider-guardian-transaction, provider-process-group).
- pnpm 없는 하네스(운영 encoder로 systemd-run -> sh -> wrapper -> bwrap
  -> prlimit -> provider 실행)에서 실행 기록 20회 중 20회 완전.
- tsc(tsconfig.node.json, tsconfig.test.json), eslint 통과.
2026-11-01 20:50:00 +09:00
DongHyeonkaandClaude Opus 5 9ca5c3f668 fix: say why a sandbox failed to launch, and observe a run instead of an instant
The cgroup test read the live process tree with one `ps` per pid and asserted
while the provider was running. That was a race it used to win only because the
sandbox was slow; now a whole run finishes in a few hundred milliseconds and
`systemctl show` alone costs longer than the thing it describes. It records the
tree from `/proc` every 5ms and asserts on the recording once the run is over,
because the assertions were always about what the run contained.

That restructuring immediately paid for itself: the supervisor had been failing
to launch the sandbox at all, and the test was dying on the observation before
it ever checked the exit code.

It could not say why, because the supervisor consumed the child's output solely
to enforce a byte cap and then discarded it — `exit=1` and nothing else. It now
keeps the lines the sandbox tooling itself emits (`bwrap:`, `prlimit:`,
`systemd-run:`, `systemctl:`), which cannot carry provider credentials because
the provider command and its secrets travel in the args file. The failure now
reads:

  sandboxed external provider failed: exit=1; sandbox reported:
  bwrap: loopback: Failed RTM_NEWADDR: Operation not permitted

which is a host restriction — `kernel.apparmor_restrict_unprivileged_userns=1`
— reproducible in two lines of shell containing none of this repository's code,
and recorded in the ledger as such rather than carried as a product defect.

Suites that spawn processes, build archives and sign evidence were given a 30s
budget. The 10s default is sized for pure-JS unit tests; raising it globally
would hide a genuinely hung test.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-15 21:12:06 +09:00
DongHyeonkaandClaude Opus 5 dfb7734674 fix: run the provider sandbox and admit a release to a named environment
The provider sandbox never ran. bubblewrap 0.9.0 stops parsing an `--args`
file at the first non-option and never hands the remainder back, so the
command written into that file was silently dropped: bwrap printed its usage
text, exited 1, and the provider produced no evidence at all. The options
still travel in the args file — that is what keeps host paths and credentials
out of `/proc/<pid>/cmdline` — but the command now rides on real argv, and
`encodeProviderBwrapInput` refuses a `--` so the drop cannot come back.

The scope wrapper then could not exit. It read the supervisor's liveness pipe
through `fs`, which runs a blocking `read(2)` on a threadpool thread; the
supervisor holds that pipe open for the scope's whole life, so the read never
returned and closing the descriptor did not interrupt it. Once bubblewrap
finished the wrapper deadlocked in `process.exit`, the scope outlived the
provider, and a completed run was reported as a timeout kill. The channel is
now read through the event loop, so teardown is observable and terminal.

Creation modes were left to the ambient umask. `mkdir(mode)` and `open(mode)`
are requests the kernel subtracts the umask from, so a runner exporting a
restrictive umask produced directories it could not enter and handed `tar` a
file it could not re-open. Private modes are pinned instead of inherited.

Promotion cleanup deleted before it checked. Removals run through a pinned
descriptor, so a leaf substituted after validation had this promotion's exact
five destroyed first and the substitution reported afterwards, leaving a
half-emptied directory a retry could not tell from a completed one. The name
is re-bound to the inode before anything is removed, so the failure is total.

Separately, release coherence proved the artifacts agreed with each other but
never that they belonged where they were going: a build whose runtime document
said `APP_ENV: local`, `AUTH_MODE: demo` and a loopback API is coherent with
itself and passed every gate. `public/` is copied verbatim into `dist/`, so
that local document shipped with every build regardless of what the build was
for. Runtime configuration now comes from a declared profile, and FE-GATE-027
refuses to admit an artifact to an environment it does not match — including
refusing an undeclared destination, so nothing is admitted by omission.

`REQUEST_TIMEOUT_MS` and `VITE_ROUTER_BASE_PATH` were validated and then
dropped: the V3 executor ran every operation on its contract's own deadline,
and Vite emitted root-absolute assets for a sub-path deployment. The timeout is
now a ceiling that may tighten a contract but never loosen one, and one base
path feeds the router, the Service Worker scope and the asset base together.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-15 16:38:19 +09:00
DongHyeonka 4dc033cf33 refactor: adapter 구현중.. 2026-08-13 16:02:21 +09:00
DongHyeonka 30ceac23c1 fix: harden provider and promotion evidence 2026-08-02 16:28:24 +09:00
DongHyeonka 1bb2cc4a20 refactor: generate CI workflow from gate contracts 2026-08-02 13:53:25 +09:00