Skip to content

Build the e2e fixtures' C programs once at the entry point - #474

Merged
yansfil merged 4 commits into
mainfrom
ci/e2e-prebuilt-shims
Oct 5, 2026
Merged

yansfil merged 4 commits into
mainfrom
ci/e2e-prebuilt-shims

Conversation

@yansfil

@yansfil yansfil commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Related: #470(이 원인으로 생긴 flaky issue), #432. desktop/e2e/fixture-cleanup.unit.ts가 #466과 같은 파일을 만져서 #466이 머지되면 main을 한 번 merge한다.

Summary

e2e fixture의 C 프로그램을 test 안에서 컴파일하지 않고 진입점에서 한 번 빌드한다. 같은 결정(test 안 컴파일 20초 bound)을 두 번째로 고치는 것이라 bound가 아닌 상태(빌드 산출물)로 옮겼다.

  • 원인(main e38f935 Windows, job 111628184913): 첫 컴파일이 cold라 20초를 넘겼고, 죽인 clang의 자식이 남아 worker가 5분 동안 끝나지 않았다.
  • Playwright globalSetup(web/e2e/global-setup.ts, web과 desktop 설정이 같이 씀)이 web/e2e/shims/*.c를 한 번 컴파일해 web/.e2e-shims/<이름>-<소스 해시>(gitignore)에 둔다. test는 완성된 프로그램을 복사만 한다(copyFixtureShim).
  • 산출물이 없거나 컴파일이 실패하면 컴파일러 이름과 그 출력(컴파일러가 못 뜨면 그 오류)으로 즉시 실패한다. 기본값이나 건너뛰기는 없다.
  • spawn provider는 실행마다 달라지는 값(Herdr 경로, 완료 파일, 명령)을 소스에 박던 것을 $HIDE_E2E_ROOT/provider.config로 읽게 바꿨다. HIDE_E2E_ROOT는 fixture의 Herdr 서버 env에 있어 서버가 만드는 모든 pane(hided가 만든 자식 pane 포함)이 받는다.
  • C 소스는 TS 문자열에서 .c 파일로 옮겼다(내용 동일; 옛 hide-open 겸용 분기만 별도 noop.c로 분리).

Review

  • 조심해서 볼 파일: web/e2e/shims/build.ts - 해시 이름, 부분 파일(.pid.partial) 정리, 동시 빌드(web과 desktop globalSetup) 처리.
  • 조심해서 볼 파일: web/e2e/shims/spawn-provider.c의 load_config - 새로 쓴 부분은 이것뿐이고 나머지는 이동이다.
  • 질문: 없음.

Evidence

  • 지워진 것: compileFixtureC, worker별 캐시, 프로세스 종료 시 정리(exit hook), 20초 bound, test 안 컴파일러 호출.
  • 크기(D3, 파일/줄): fixture 3개(platform-fixture.ts 250→168, herdr-fixture.ts 894→732, agent-spawn-fixture.ts 352→119) 1,496줄 → 1,019줄. 새로 생긴 것: shims/build.ts 60, global-setup.ts 7, C 5개 475줄(이동 약 400 + 설정 읽기 약 40). 파일 3개 → 11개, 줄 합계 1,496 → 1,561(+65, 거의 이동). 새 장치는 진입점 하나(globalSetup)다.
  • 확인한 것: web·desktop typecheck, lint(크기 상한 기준선 그대로), fixture-cleanup.unit.ts 5개(복사 대상 noop과 위치 단언 포함). macOS에서 build 진입점 동작: 첫 빌드 369 ms, 둘째 1 ms, 부재 시 안내 메시지, 복사 후 실행 권한. 로컬에서 playwright test e2e/shell.spec.ts:137을 돌려 globalSetup이 실제로 .e2e-shims를 만드는 것을 확인했다.
  • 확인하지 못한 것: Windows 실행(clang 컴파일, launcher/hide-children 복사). 로컬 e2e는 이 worktree에 hided 빌드가 없어(로컬 cargo 빌드 금지) test 본문까지는 못 돌렸다. 이 PR의 Linux/macOS/Windows PR lane이 확인한다. Windows web e2e는 @platform 일부만 PR lane에서 돌아, 전체 효과는 머지 뒤 첫 nightly에서 본다.
  • 리뷰 subagent의 Fix now 3건(자식 pane에 HIDE_E2E_ROOT 없음, 다른 빌드의 부분 파일 삭제, 컴파일러 시작 실패 사유 누락)을 반영했다. Follow-up 중 getenv가 Windows ANSI(비ASCII 임시 경로)이고 cwd 상대 경로 가정이 남았다.

… compiling in tests

Each worker compiled its shims inside the first test, under a 20-second
bound that a cold Windows runner exceeded; the killed compiler left children
behind, and the worker did not exit for five minutes. Playwright's
globalSetup now builds every program in e2e/shims once into web/.e2e-shims,
named by a hash of its source, for both the web and desktop configs, and a
test only copies a finished one. The spawn provider reads its per-run values
from a config file, so it is built once as well.
@yansfil
yansfil merged commit f757d0a into main Oct 5, 2026
28 checks passed
@yansfil
yansfil deleted the ci/e2e-prebuilt-shims branch October 5, 2026 07:05
yansfil added a commit that referenced this pull request Oct 5, 2026
…ult (#490)

Related: the unclassified-paths table (reviewer decision), #486
(separate branch; both touch `ci-plan.py`'s neighbours, the second to
merge resolves a small conflict in `test_ci_plan.py` and `TESTING.md`)

## Summary

`ci-plan.py` sent every path no rule claimed to every lane, so 42 of the
last 80 merged pull requests (52%) ran all ten.
This names the paths whose readers are known and leaves every other path
on "every lane": `POLICY_ONLY` (no lane reads it: `agents/`, `site/`,
`tools/`, `spikes/`, `.gitignore` files, PR template, workflows `pr.yml`
does not call, `scripts/tests/`, the policy, design, release and
measurement scripts, Markdown below an unclaimed folder) plans `policy`
alone, and `NAMED_LANES` (fixtures, Playwright, eslint and vitest
configs, `web/scripts`, `desktop/scripts`) plans the lanes that read it.
A path that is not named, including any new one, still plans every lane.

## Review

- **판단해 주세요**: `web/e2e` files that are not specs plan `web-checks`,
`web-e2e`, `web-e2e-platform`, `windows-e2e`, `desktop-checks`,
`desktop-e2e`, `windows-check` (desktop suites import them,
`desktop/e2e` unit tests run in `windows-check`); they drop `rust` and
`os-contract` only.
- **판단해 주세요**: `scripts/ci-plan.py` stays on every lane although the
table listed it as `policy`: it decides the plan for every later pull
request, and `policy` runs its tests but not what a wrong rule would
skip.
- **판단해 주세요**: lockfiles, `package.json`, `Cargo.lock`, `contracts/`,
`verify-*.sh`, `ci-flaky-report.py` and the three workflows lanes use
stay full (the table's class where full is right).
- **조심해서 볼 파일**: `scripts/ci-plan.py` (`POLICY_ONLY`, `NAMED_LANES`,
`named_lanes`) and `scripts/tests/test_ci_plan.py` (`NamedPaths`,
including a check that no `POLICY_ONLY` script is named by a lane's
workflow job or the scripts those jobs run).

## Evidence

- **확인한 것**: `scripts/tests` suite passes (27 plan tests; a case per
named path, one that every unnamed and shared path is still full, one
that a named path does not narrow a plan with another reason, and the
reader check).
- **확인한 것**: the changed plan run on the file lists of the last 80
merged pull requests (#355-#483) against main's plan:

| | before | after |
| --- | --- | --- |
| pull requests planning every lane | 42 | 19 |
| pull requests whose plan changed | | 20 |
| lane runs (sum over the 80) | 683 | 585 (-14%) |

| lane | PRs running it before -> after |
| --- | --- |
| policy | 80 -> 80 |
| rust | 76 -> 59 |
| web-checks | 63 -> 51 |
| desktop-checks | 47 -> 39 |
| os-contract | 65 -> 48 |
| windows-check | 65 -> 58 |
| windows-e2e | 71 -> 61 |
| web-e2e | 78 -> 68 |
| web-e2e-platform | 71 -> 61 |
| desktop-e2e | 67 -> 60 |

No pull request gained a lane.

- **확인한 것**: lanes that caught a failure keep it. Of the 300 most recent
`pr.yml` pull-request runs, 73 failed; 72 had a failing lane (the other
failed in `verify` only).
Each run's failing lane was checked against the new plan for that pull
request's file list (the run's own diff where the pull request is still
open, the final file list for merged ones, so earlier pushes can
differ).
The lane stays planned in 68 of 72. The four that would not run it, and
why they are not catches:
- #466 (2 runs): `windows-e2e` failed on `s2.spec.ts:55` and `less`, a
main failure (#475, #424) that the pull request, which touched four
`desktop/e2e` files, did not cause. The new plan runs `desktop-checks`,
`desktop-e2e`, `windows-check`.
- #366: `rust` and `windows-check` failed in `hided` and disk tests
before nextest retries (#463) on a pull request that changed release
scripts and docs only.
- #369: README and SECURITY only; `windows-check` failed before path
selection existed, and the current plan does not run it for those files
either.
The failures that were this pull request's own (#474 desktop-e2e, #436
windows-e2e, #439 web-e2e-platform, #385, #364) keep their lane.
- **확인하지 못한 것**: the narrowing is judged on file lists, not by
re-running CI; a pull request that changes a named file in a way that
needs a lane left out is caught by main's full run, as before.

<details><summary>CI 크기 (D3)</summary>

`ci-plan.py` +77 lines (two tables and `named_lanes`), `test_ci_plan.py`
+97, `TESTING.md` +5; no workflow changed.

</details>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant