Skip to content

ci: repeat the tests a pull request adds or changes - #2377

Merged
yansfil merged 7 commits into
mainfrom
ci/repeat-changed-tests
Nov 10, 2026
Merged

yansfil merged 7 commits into
mainfrom
ci/repeat-changed-tests

Conversation

@yansfil

@yansfil yansfil commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

새 테스트가 열 번에 한 번 실패해도 자기 PR은 아홉 번 통과합니다. 재시도는 그 실패를 가립니다.
PR이 추가하거나 바꾼 테스트를 재시도 없이 여러 번 돌리는 repeat 레인(repeat.yml)을 더했고, 한 번이라도 실패하면 verify가 실패합니다.
같은 repeat.yml을 손으로 돌리면(workflow_dispatch) 이름 붙인 spec이나 Rust 모듈을 Linux, macOS, Windows에서 N번 반복해, 임시 반복 커밋 없이 고침을 보여 줄 수 있습니다.
화면 변경 없음 (CI와 문서만).

gh workflow run repeat.yml --ref <branch> -f runner=windows -f web='s3.spec.ts' -f repeat=10
gh workflow run repeat.yml --ref <branch> -f rust='hided:handshake' -f repeat=10

Review

  • 판단해 주세요: 바뀐 테스트는 파일 단위입니다(web은 바뀐 *.spec.ts 전체, Rust는 바뀐 tests/it 모듈 전체). diff 줄만으로는 헬퍼, 훅, 루프로 만든 테스트가 어느 테스트에 닿는지 믿을 수 없고, TypeScript를 읽어 가려내는 장치는 레인이 버는 것보다 큽니다.
  • 판단해 주세요: 예산식의 N은 파일 수가 아니라 실제로 도는 테스트 수입니다. web은 playwright --list, Rust는 count 잡이 cargo nextest list(JSON, 필터가 matches인 것만, #[ignore]는 제외)로 셉니다. 소스 속성 세기는 쓰지 않습니다.
  • 판단해 주세요: Rust는 모듈별로 whole-binary fallback을 정합니다. tests/it/support나 main.rs가 바뀌거나, 고른 모듈 하나라도 목록이 0개(stand_ins.rs 같은 보조 파일)이면 그 크레이트의 it 전체를 돌립니다. 보조 파일이 어디에 닿는지 diff로 알 수 없어서이고, 같은 PR에서 다른 모듈이 함께 바뀌어도 범위가 줄지 않습니다.
  • 판단해 주세요: 한 PR 전체에 200회 예산(clamp(floor(200 / N), 3, 10))이라서 N이 66을 넘으면 200을 넘깁니다(100개는 300회). 데스크톱 spec은 macOS 러너가 필요해 고르지 않습니다.
  • 판단해 주세요: 한 번에 시작하는 잡 상한을 51에서 54로 올렸습니다. repeat는 count, web, rust 3개이고 web과 rust는 바뀐 테스트가 있을 때만 시작합니다. 테스트를 바꾸는 PR만 늘고, 다른 PR은 그대로입니다.
  • 조심해서 볼 파일: scripts/ci-plan.py - repeat는 FULL_LANES에 없습니다(main push와 nightly에는 diff가 없음). CI 정의를 바꾸는 PR은 바뀐 테스트가 없어도 이 레인을 계획하고 count 잡만 도는 no-op으로 끝납니다.
  • 조심해서 볼 파일: .github/workflows/web-e2e.yml - specs가 있으면 샤드 1개, --retries=0 --repeat-each=N, flaky 이슈 파일링 단계 생략. 없으면 기존 흐름 그대로입니다.
  • 조심해서 볼 파일: .github/workflows/repeat.yml - Rust 레그는 rust 레인의 캐시와 셸 설치를 재사용하고 --retries 0 --stress-count N으로 돕니다. PR에서는 count 잡의 목록이 0개면 Rust 잡을 시작하지 않고, 손으로 돌릴 때 없는 모듈은 계획 단계에서 거절합니다.
  • 후속(이 PR에서 고치지 않음): docs/TESTING.md의 몇 줄이 최종 동작과 어긋납니다(517행 근처의 support/main 제외 설명, 963행 근처의 all-ignored 경고 설명, 973행 근처의 hide-core:seat 예시). 후속 PR에서 고칩니다.
  • 질문: 새 워크플로 파일은 main에 들어가기 전에는 gh workflow run이 404를 냅니다. 머지 후에 문서의 명령이 동작해야 하는데, 괜찮은가요? (이 PR의 증거는 임시 push 트리거를 한 커밋으로 넣었다가 되돌려 얻었습니다.)

Evidence

  • 확인한 것: PR 실행 1: 임시 PR 하나가 spec 1개를 바꾸면 count가 total=1, repeat=10을 고르고 repeat 잡이 Running 10 tests 후 10 passed, verify 성공 (https://github.com/with-hide/hide/actions/runs/42794240948).
  • 확인한 것: PR 실행 2: 같은 spec에 반복 3번째만 실패하는 단언을 심으면 10회 중 9 passed, 1 failed, 재시도 없이 repeat 잡과 verify 실패 (https://github.com/with-hide/hide/actions/runs/42799049312). 심은 단언은 임시 PR에만 있었고 이 브랜치에는 없습니다. 임시 PR #2374는 닫고 브랜치를 지웠습니다.
  • 확인한 것: Windows 손 실행: pane-focus-ordering.spec.ts를 windows-latest에서 10번, 10 passed (https://github.com/with-hide/hide/actions/runs/42792399064).
  • 확인한 것: scripts/tests/test_ci_repeat.py가 예산 5->10, 20->10, 50->4, 100->3, 12개->10(120회)과 바뀐 테스트 선택(추가/수정만, 삭제·데스크톱 spec 제외, support/main.rs/목록 0개 모듈은 whole-binary), nextest 목록 집계를 검사합니다. scripts/tests 전체 894개 중 이 PR과 무관한 1개를 뺀 나머지 통과.
  • 확인하지 못한 것: 이 Mac의 bash 3.2에서 test_web_shard_discovers_twice_and_prepares_phone_once가 실패합니다("${args[@]}"가 빈 배열이면 unbound). main에도 같은 식이 있고 Linux CI의 bash 5에서는 통과합니다. 고치지 않았습니다.
  • 확인하지 못한 것: macOS 러너의 손 실행은 돌려 보지 못했습니다. 최종 head의 nextest 목록 집계는 임시 PR로 직접 보지 못했고, 최종 리뷰와 이 PR의 CI 통과로 갈음합니다(Linux Rust 레그의 손 실행 결과는 아래 접힌 블록). actionlint는 이 저장소의 게이트가 아니고 설치돼 있지 않아 쓰지 않았습니다.
추가 증거

@yansfil yansfil left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review round 1: FAIL at 8f6849ee47ef350abf59e59bd914b0325f9ed315, full diff against origin/main.

Blocking finding:

  1. Serious, correctness - scripts/ci-repeat.py:49,111-119, together with .github/workflows/repeat.yml:125-131,155,215: source attributes are not a reliable inventory of the selected Rust tests, and a zero count makes valid PRs fail before repetition starts.
    Two existing-tree reproductions exercise the actual selection, budget command and workflow shell blocks:
    • Change only hide-relay-protocol/tests/it/admission.rs: the module contains five real native tests declared through #[cfg_attr(not(target_arch = "wasm32"), test)], but the script counts zero.
    • Change only hide-platform/tests/it/stand_ins.rs: this helper module has no tests, but it is selected because only support and main are excluded.
      Both selections plan repeat, the count step succeeds with repeat=0, and the Rust step exits 1 with repeat must be a positive number, not '0'.
      The no-tests warning cannot help because that guard fails before the test command runs.
      A mixed PR also computes its shared budget from the wrong N; macros, parameterized tests and conditional attributes are further instances of this same inventory problem.
      Use the real discovered Rust test inventory for N and distinguish an empty selection from failed discovery, rather than adding syntax exceptions or inventing a positive count for an unknown result.
      Add coverage through the workflow path for the existing conditional-attribute module, a helper-only change and a mixed web/Rust budget boundary.
      This follows engineering principles 4 and 13: report an invalid result where it arises and fix the shared decision rather than each spelling.

Nonblocking findings:

  • Minor, tests/documentation - docs/TESTING.md:972-975 and .github/workflows/repeat.yml:11 show hide-core:seat, but that crate has no tests/it target; seat is in hided.
    Use an existing module in the runnable example.
    The text also says a nonexistent module fails before anything runs, while the dispatcher validates identifier syntax and discovers an absent module only in the later Rust job.

Evidence checked:

  • Successful real PR run: tested merge b700806, with the reviewed head as its base; selection reports total=1, repeat=10, and the repeat job reports ten passed with retries disabled.
    Its final verification job succeeded.
  • Planted-failure PR run: tested merge 5262cd0, again based on the reviewed head; the repeat job reports one failed and nine passed.
    The final verification log explicitly fails because the planned repeat lane failed.
  • Windows manual run: a real manual-dispatch event at aad565ed, ten executions of the named spec, ten passed.
    Comparing its repeat workflow, shared web workflow and selection script with the reviewed head shows only removal of the temporary push trigger.
  • Linux Rust manual run: the reviewed head, nine resident tests over three iterations, all 27 passed with retries disabled.
    This exercises manual dispatch; it does not test PR-side Rust counting.
  • Independent local checks: 35 repeat tests, 94 lane-plan tests, two new workflow-entrypoint tests and two cache-contract tests passed.
    The budget examples, including 12 tests producing 120 executions, are covered.
  • Lane planning and final aggregation include the repeat lane.
    The maximum of 54 executing jobs is consistent with the previous 51 plus count, one web repetition job and one Rust repetition job; the web build jobs are skipped for its single shard.
  • The shared web workflow and dependency caches are reused.
    The repetition shard builds its own current candidate; it does not consume the regular web shards' compiled artifacts.
    Normal web shard commands retain their earlier behavior.
  • The candidate PR's full verification was still pending when inspected.
    No macOS manual-run evidence was supplied; no claim is made for that execution path.

All six review perspectives were considered.
No source changes, pushes, merges or operator-app interaction were performed.
The author reported a newer revision while this review was underway; this verdict covers only the requested head, and a subsequent review must inspect the delta from it.

@yansfil yansfil left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review round 2: FAIL at 7c83ddb1bdca6373785a833232a013d3d72ddda4.
Only the delta from the previously reviewed 8f6849ee47ef350abf59e59bd914b0325f9ed315 was reviewed.

The earlier serious correctness finding remains open - scripts/ci-repeat.py:122-124.
The two reported zero-repeat failures are avoided: the conditional-attribute module now counts five, and a helper-only selection is assigned one.
However, assigning a test to a helper that declares none corrupts the shared repeat budget.

Concrete reproduction with the existing hide-platform/tests/it/stand_ins.rs helper:

  • Twenty selected web tests plus this changed helper contain twenty runnable tests.
  • rust_test_count invents one Rust test, so the budget command reports total=21, repeat=9.
  • With the actual count, it reports total=20, repeat=10.

The PR therefore runs those changed web tests nine times instead of the ten required by its budget contract.
The added helper-count test asserts the invented value rather than the number of tests the runner can execute.
The new documentation records this exception, but it does not satisfy the agreed definition of N.

Use the actual discovered Rust test inventory for both selection and counting, preserve zero for a module with no runnable tests, and handle an empty selection explicitly in the workflow.
Do not replace an unknown count with one or add further syntax cases to this decision.
Engineering principles 4 and 13 apply: do not hide an invalid result behind a default, and fix the class of failure.

Validation: all 37 focused repeat-script tests pass; the mixed-budget reproduction above fails the intended contract despite that green suite.
The earlier minor documentation finding was not changed in this delta and remains open.
The CI evidence recorded in round 1 is unchanged; no new successful CI result is claimed for this revision.

This is the first re-review; one re-review remains under the mission's limit.
No source changes, pushes or merges were performed.

@yansfil yansfil left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review round 3: PASS at 28ea3b1ac432a0e87f1924e0aa56c6daa6bece30.
Only the delta from the previously reviewed 7c83ddb1bdca6373785a833232a013d3d72ddda4 was reviewed.
No serious or ordinary findings remain in that delta.

Earlier blocking finding closed:

  • Rust counts come from the actual JSON test inventory, and the counted plan is passed to the execution job.
    The source-attribute estimate and the invented minimum of one are removed.
  • A helper that matches no tests selects its crate's whole integration binary.
    The decision is made per module, so adding a changed test module beside the helper no longer narrows coverage.
    Independent reproduction now selects all 293 tests for both the helper alone and the helper plus resident module; resident alone retains its nine-test filter.
  • Empty counts are handled explicitly by job conditions.
    The listing entrypoint retains the checkout's build directory and strips pane handles.

The interim cache-contract failure is fixed by registering the count job as a restore-only user.
The count job's 45-minute cap now accommodates its 25-minute Rust-listing step and setup.
The shared decision and removal of the earlier heuristics satisfy engineering principles 1, 7 and 13.

Verification:

  • Latest full verification completed successfully for the reviewed head.
    Its policy log reports 897 tests with 44 skips.
    Its repeat count job succeeds with no selected web/Rust test files; both execution jobs correctly skip.
  • Independent local checks: all 37 repeat-script tests, both cache-contract tests and the updated entrypoint-isolation test pass.
    The 94 lane-plan tests also passed during this delta's precheck; the latest full CI reran the script suite.
  • The previously inspected real Rust PR proof counted nine tests and ran ten retry-free iterations successfully.
    That proof tested the earlier f0ad28b6e revision; it does not directly execute the final whole-binary fallback.
    The final mixed-module fallback is covered by the focused test and the independent reproduction above.
  • Round 1's real web ten-pass run, planted-failure propagation to final verification and Windows manual-dispatch evidence remain applicable to the unchanged web execution path.
    No new macOS manual-run evidence is claimed.

Minor documentation follow-up, nonblocking:

  • docs/TESTING.md:517 still excludes support/main even though the detailed repeat section now selects the whole binary for them.
    Line 963 still describes an all-ignored module as running none, although the fallback can select its other nonignored siblings.
    Line 973 still names the nonexistent hide-core:seat; the workflow example was corrected to hided:seat.
  • The PR body's Review/Evidence text still describes source-attribute counting and the old helper exclusion.
    Refresh it to describe the final inventory-based plan and its extra listing build.

All six review perspectives were applied to the delta.
This completes the second and final re-review allowed for this node.
No source changes, pushes, approvals or merges were performed.

@yansfil
yansfil added this pull request to the merge queue Nov 10, 2026
Merged via the queue into main with commit 7fb71ce Nov 10, 2026
86 checks passed
@yansfil
yansfil deleted the ci/repeat-changed-tests branch November 10, 2026 13:54
HyunjunJeon pushed a commit to HyunjunJeon/hide that referenced this pull request Nov 12, 2026
## Summary

Fixes the hand run of with-hide#2377, which could pass after skipping every named
test.
Manual runs now select their web and Rust jobs explicitly on the
requested system.
An always-run verdict requires each chosen job to succeed and report
actual completed tests.

## Review

- **Decide**: Preserve with-hide#2377's final rule: a PR helper or all-ignored
module selects its crate's whole `it` binary.
- **Risky files**: `repeat.yml` and `web-e2e.yml` carry completion
outputs into the final failure path.
- **Risky files**: `ci-repeat.py` rejects missing decisions, missing
reports, skipped jobs and zero completed runs.

## Tests

- **Layer**: Python unit and CLI tests cover selection, native report
parsing and the final lane verdict.
- **Catches**: A successful zero-run job; removing that guard caused
four hand/PR and web/Rust regression failures.
- **Repeat**: Eight existing web tests x 10 on
[Linux](https://github.com/with-hide/hide/actions/runs/42833430521).
- **Repeat**: Eight existing web tests x 10 on
[Windows](https://github.com/with-hide/hide/actions/runs/42833437213).
- **Waits**: No test waits added; the verdict and report steps have
bounded CI hang guards.

## Evidence

- **Verified**: 139 focused Python tests pass; PR verify rejects a
failed repeat lane through its existing aggregate.
- **Verified**: [Zero-match
grep](https://github.com/with-hide/hide/actions/runs/42833444239) fails
both web and verdict.
- **Verified**: [Linux
Rust](https://github.com/with-hide/hide/actions/runs/42833450464) ran
one `hided:seat` test x 3.
- **Verified**: [PR policy
checks](https://github.com/with-hide/hide/actions/runs/42835956543)
pass; independent review passed.
- **Not verified**: macOS dispatch and live cancellation were not
exercised; remaining PR CI is pending.

<details><summary>Verification record</summary>

- Candidate: `49ed978e8a2a56f6dbee3306a1f3e139ae565f53`.
- Base: `77315ee1a7c7d6598091346bc7fe60bfd372d4d2`.
- `python3 -m unittest scripts.tests.test_ci_repeat
scripts.tests.test_ci_plan`: 139 tests, exit 0.
- Linux web: https://github.com/with-hide/hide/actions/runs/42833430521
- `80 passed`, `completed=80`, verdict passed.
- Windows web:
https://github.com/with-hide/hide/actions/runs/42833437213 - `80
passed`, `completed=80`, verdict passed.
- Zero-match web:
https://github.com/with-hide/hide/actions/runs/42833444239 - expected
failure, `No tests found`.
- Linux Rust: https://github.com/with-hide/hide/actions/runs/42833450464
- `3/3` iterations passed, `completed=3`.
- Removing zero-run rejection from the verdict produced four expected
regression failures.
- Report parsing is capped at 128 files and 16 MiB; exceeding either cap
fails the job.
- Independent review: round 1 PASS at the candidate head, no findings;
45 unit tests and 72 additional probes passed.
- Initial PR policy checks passed; remaining PR CI:
https://github.com/with-hide/hide/actions/runs/42835956543.
- No local end-to-end or Rust build/test was run.

</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