Skip to content

Keep pane zoom responsive and send only changed state - #1074

Merged
yansfil merged 16 commits into
mainfrom
perf/responsive-state
Oct 13, 2026
Merged

yansfil merged 16 commits into
mainfrom
perf/responsive-state

Conversation

@yansfil

@yansfil yansfil commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • 저장소 경로 조회가 늦어도 pane 확대·축소와 Herdr가 확인한 레이아웃을 바로 반영합니다.
  • 바뀐 상태 영역만 보내며, 그대로인 프로젝트·에이전트·연결 기기 목록은 다시 보내지 않습니다.
  • 내부 소비자는 불변 상태를 공유하고, 화면 전송용 JSON은 Runtime 잠금 밖에서 한 번 직렬화합니다.
  • 초기 연결·재연결·삭제 의미와 기존 클라이언트의 전체 상태 수신 계약을 보존합니다.

운영 규모 측정 fixture

43개 프로젝트와 화면의 pane 5개를 둔 브라우저 fixture입니다. 이 캡처 자체가 paint 시간의 증거는 아닙니다.

격리한 macOS 후보 창의 한국어 Sessions 상태

실제 후보 창에 synthetic 상태를 표시한 화면입니다. 실제 휴대폰·OS 알림 전달은 확인하지 않았습니다.

Review

  • 판단할 부분: 구조 개선과 운영 규모 개선은 확인했으나, 소규모 입력의 일관된 비회귀는 입증하지 못했습니다.
  • 잠금·수명: session_sync/coordinator.rs의 오래된 응답 거절, 최신 레이아웃 적용과 조회 종료를 봐주세요.
  • 전송 계약: model/rest.rs, hided/src/server.rs, web/src/store.ts의 생략·삭제·재연결 경계입니다.
  • 소비자 범위: hided/src/lib.rs, watch.rs, mobile/projection.rs의 독립 상태와 파일 접근 범위입니다.
  • 비용: 기존 조회 worker에 실행 1개·최신 대기 1개를 유지하고, 바뀐 결과만 기존 알림 경로로 보냅니다.
  • 남은 한도: 경로 전체 크기는 경로 수에 비례합니다. 호출 기한이 실행 중인 host 작업을 중단하지는 않습니다.

Evidence

  • 같은 경로 응답을 500ms 보류해도 개선 버전은 응답 전에 확대를 반영했고, 기존 버전은 응답을 기다렸습니다.
  • 운영 규모의 출력 중 연속 확대에서 상태 전송량이 189.5MB → 7.46MB로 줄었습니다.
  • 출력 부하 없는 확대 DOM p50은 55.6ms → 28.55ms입니다. 버전별 두 회차 p50의 중앙값입니다.
  • 소규모·운영 규모 총 14회 유효 비교에서 확대·축소와 입력 순서를 확인했습니다.
  • 로컬 web 흐름 271개와 desktop 흐름 67개가 통과했습니다. desktop 9개는 환경 미충족으로 미검증입니다.
  • PR CI도 통과했습니다. Linux web 271개, Windows web 36개, macOS desktop 73개, Windows desktop 7개입니다.
  • 머지 후 main CI도 통과했습니다. History 준비 단계 재시도 1건은 #1075에 남아 있습니다.
  • 소규모 최초 입력 p50은 9.31% 늘었고, 추가 교차 비교에서는 반대였습니다. 마지막 쌍의 p95는 1.1ms 늘었습니다.
  • 머신 부하가 동일하지 않고 계측 전체 비용을 분리하지 못해, 모든 지연·자원 수치의 비회귀를 주장하지 않습니다.
  • 물리 paint 시간, 실기기 휴대폰·실제 OS 알림 전달, 장시간 메모리 증가는 확인하지 않았습니다.
측정 조건과 남은 불확실성

기본 비교는 소규모와 운영 규모 각각 ABBA 4회이며, 아래 값은 두 회차 통계의 중앙값입니다.
운영 규모는 43개 workspace·62개 tab·66개 pane·화면의 5개 pane·31개 agent와 격리 원격 fixture입니다.
브라우저는 1280×900, DPR 1이며 동일한 release 제품·출력 설정·입력 순서를 사용했습니다.
회차마다 Core 100회, 출력 없는/있는 확대 각 40회, 입력 echo 각 50회, 순서 검사 1,000자를 관찰했습니다.
idle은 20초, 빈 페이지에서 출력만 계속하는 구간은 10초로 나누었고, 실제 자원 표본 수와 머신 부하는 각 기록에 남겼습니다.
Core 데이터 가공, DOM 반영, Herdr 확인 후 terminal grid 반영은 별도 관측 경계이며 물리 paint를 뜻하지 않습니다.

운영 규모 관측 기존 개선
Core capture·encode p50 20.699ms 0.140ms
Core 관측 payload 1,590,134B 15,539B
출력 없는 확대 DOM p50 / p95 55.6 / 86.3ms 28.55 / 43.05ms
출력 중 확대 DOM p50 / p95 56.6 / 97.5ms 39.4 / 63.7ms
출력 없는 grid p50 / p95 149.5 / 177.15ms 100.4 / 138.95ms
출력 중 grid p50 / p95 150.7 / 211.25ms 115.15 / 144.20ms
출력 중 연속 확대 상태 전송량 189.501MB 7.456MB

소규모 입력 결과는 전체를 보존했으며, 유리한 결과만 합치거나 새 허용 오차를 만들지 않았습니다.
최초 ABBA의 출력 중 입력 p50/p95는 64.45/75.60ms → 70.45/77.65ms로 각각 9.31%/2.71% 악화됐습니다.
별도 BAAB의 두 회차 중앙값은 72.30/78.35ms → 66.60/76.25ms로 방향이 바뀌었습니다.
동일 marker를 추적한 마지막 별도 쌍은 p50/p95/max 74.4/76.3/77.7ms → 73.7/77.4/77.7ms였습니다.
이 쌍의 수신부터 원래 xterm write 완료까지 p95는 0.3ms → 1.4ms였고, 중앙값은 두 빌드 모두 약 0.2ms였습니다.
전송부터 수신까지의 구간에는 각 50개 중 46개에서 브라우저 long task가 겹쳤으나, daemon·PTY·전송의 개별 기여를 분리하지 못했습니다.
소규모 DOM 중앙값과 브라우저 CPU 꼬리도 일부 증가했고, 호스트 부하와 추가 parser 계측의 전체 비용은 동일하게 통제하지 못했습니다.
추가 비교에는 두 빌드 모두 1초 이상의 확인된 grid 꼬리가 있어, 빠른 DOM만으로 terminal geometry 완료를 판단하지 않았습니다.

검토자는 B13의 엄격한 비회귀를 독립적으로 입증하지 못했다고 명시했습니다.
전달 판단은 그 결론을 보존한 채, 확인된 구조 개선과 운영 규모 이득을 근거로 남은 성능 불확실성을 수용한 것입니다.
worker는 경로를 한 번에 4,096개, 응답을 16MiB 이내로 읽고 chunk 사이에서 취소를 확인합니다.
종료 시 Runtime 잠금 밖에서 현재 조회를 join하며, 기존 local host의 64개 실행 한도와 호출 기한 이후 작업 잔존 한계를 유지합니다.
입력마다 새 조회나 타이머를 만들지 않고, 독립 소비자의 cursor와 reset 상태를 보존합니다.
실제 daemon의 구독자 수 0→1→0→1→0을 관찰했으며, 빈 페이지에서 frame이 없다는 사실과 구별했습니다.
원격 상태·휴대폰·알림 투영의 동등성 검사는 synthetic production API fixture이며 실제 휴대폰이나 OS 전달의 증거는 아닙니다.
원래 실패한 계측 초기화 두 건과 테스트 fixture 두 건은 원인·수정·재검증 기록에 보존했습니다.

Verification record
  • PRD: agents/prd/responsive-state/prd.md (sha256 ac631a57ee23a71b62057dfa99f69ed5910dee2b6b4424e36286023f2ae87d21)

  • Base 28500eb → head 1b1514a, verified 2026-10-13T21:14:28.210Z: PASS

  • Verification report: agents/runs/responsive-state/verification-report.json and agents/runs/responsive-state/verification-report.md; source fingerprint ca476b5bc8718bcfb30e39445610a77de5d0c6e2060eb0675b4e9fa008523efd

  • Suites:

    • S1: GREEN bash scripts/verify-cargo.sh test (exit 0)
    • S2: GREEN bash scripts/verify-cargo.sh lint (exit 0)
  • Workspace test: 4,527 passed, zero failed, 97 ignored; lint exit 0.

  • PR CI: verify and Design contract passed on the reviewed head.

    • Linux web shards: 68 + 69 + 68 + 66 = 271 passed; Windows web: 36 passed.
    • macOS desktop: 73 passed, 9 prerequisites skipped; Windows desktop: 7 passed.
    • All 13 test-report steps explicitly reported no flaky test in this run.
    • Rust, Windows, remote mailbox and all three OS contracts passed.
    • Packaging was not planned in the PR or main push run: the workflow reserves it for package-input changes or nightly/release runs. No package result is claimed.
    • The Windows desktop workflow retained actual window captures; the attached pane and shortcut sheet captures were inspected.
  • Merged commit: 7993a102bf19be82c332fe288ad7a1600a677caa, 2026-10-13T21:45:50Z, pinned to the reviewed head.

  • Current-main premerge check passed against 8446940a490ff5e6c0b93f67c6677bfabdbe06f7.

  • The first main push containing the merge passed: verify, completed 2026-10-13T22:06:51Z, and Design contract.

    • Linux web: 270 first-attempt passes and one retry-only pass; Windows web: 36; macOS desktop: 73 with 9 prerequisite skips; Windows desktop: 7.
    • Twelve test-report steps explicitly reported no flaky test. The remaining step filed #1075.
    • That first failure stopped in unchanged showProjectRow while waiting for a closed No agents fold, before History assertions. The captured DOM already contained the registered project and both agents.
    • The retry passed, but the first attempt remains a failed setup and is not counted as a clean flow.
    • Read-only triage correlated the failed daemon log: registration finished in 25ms. The helper/test/sidebar files are byte-identical in baseline, candidate and merged main. This supports a pre-existing helper state race; whether this PR exposed its timing window remains unproven. with-hide/hide-private#270 stays open as a separate helper follow-up, with no concrete product-regression evidence or product rollback warranted by this failure.
  • Code review: 1b1514a9c, no remaining concrete source Fix now; receipt-to-write tail and attribution limits retained.

  • Fidelity review: 1b1514a9c, 362 evidence consistency checks with zero discrepancy; strict B13 remains unproven.

  • Security review: 1b1514a9c, no remaining blocker in ownership, scope, authentication or retained-data boundaries.

  • All three completed one continuity follow-up on the seven changed/added acceptance and prior-PASS materials.

  • Follow-up disposition: final workspace PASS closes the mechanical item; residual performance uncertainty remains explicit.

  • The two failing path-fact fixtures were corrected with their original pane/focus assertions preserved.

  • Evidence: 431 registered (62 log, 9 screenshot, 1 browser, 359 file).

    • Full manifest and hashes remain in the local verification report; artifacts are not committed.
    • Coverage: fixed trial plans and all 14 valid runs; invalid attempts and calibration; browser/native captures; subscriber lifecycle; projection/worker regressions; independent reviews and finite-acceptance provenance.
    • Empty logs are inventoried without treating emptiness as success.
  • Changed paths: 54 (see Files changed)

  • Delivery: mode pr, branch perf/responsive-state, base main

  • Verification report sha256: 7b857f141396caa007d61ac33db476f0c6aea40fc077d2dbe5b79b8913014bc9.

  • Measured candidate: 564093560b587c2c0fb148877372b4316faece5c; delivery changes after measurement are docs and two test fixtures only.

  • Frozen original ABBA plan sha256: 8d0f0c5b4f7d9fc5a4c3c2845501dad0ba03fac3cac6b54d63935ea6a241c2fd.

  • Final same-marker plan sha256: 896ffc9aedcdc4e6721c8f3c8598122e1364b5fce31e1c155f8cea8c281d41ec.

@yansfil
yansfil merged commit 7993a10 into main Oct 13, 2026
21 checks passed
@yansfil
yansfil deleted the perf/responsive-state branch October 13, 2026 21:45
yansfil added a commit that referenced this pull request Oct 15, 2026
## Summary

CI는 PR이 바꾼 경로로 돌릴 레인을 고르는데, 규칙에 없는 경로가 하나라도 있으면 모든 레인을 돌립니다.
10-13 이후 머지된 PR 58개 중 13개가 그랬고, 원인은 테스트가 읽는 계약 파일, 레인이 부르는 workflow, 디자인
스크립트, `web/vite.config.ts`였습니다.
이제 이 경로들은 실제로 읽는 레인과 크레이트만 돌립니다. 같은 58개를 다시 계산하면 전체 레인 PR 13 → 1, 잡 855
→ 823, macOS 잡 58 → 45입니다.

- **계약 5개** (`hided-ws.schema.json`, `snapshot-wire-enums.json`,
`agent-adapters.json`, `hide-cli.json`, `usage-coverage.json`): 읽는 테스트의
크레이트만 `rust`로, 웹 테스트가 읽으면 `checks`, 셸이 import하면 `web-e2e`도.
- **레인 workflow 4개** (`web-e2e.yml`, `desktop-e2e.yml`,
`os-contract.yml`, `remote-mailbox.yml`): 그 workflow를 부르는 레인만.
- **`web/vite.config.ts`**: 셸을 빌드하거나 웹 단위 테스트를 돌리는 레인 전부. Rust만 도는 레인은
뺍니다.
- **디자인 생성기, 토큰 맵, 디자인 검사**: `policy`만. `design-contract.yml`이 모든 PR에서
따로 검사합니다.
- **`Cargo.lock`은 전체 그대로**: 거의 모든 크레이트가 `workspace-hack`에 의존해 lock 변경이
모든 크레이트에 닿습니다.
- **따라가다 찾은 누락** (두 번째 커밋): `docs/UI_BEHAVIOR.md`,
`docs/AI_PROVIDERS.md`, 에이전트 로고 manifest는 테스트가 읽는데 그 레인을 돌리지 않았습니다. 이제
돌립니다.

## Review

- **판단해 주세요**: `agent-adapters.json`은 웹 셸 파일 규칙(`checks`, `web-e2e`)을 따라
데스크톱 e2e를 돌리지 않습니다. `agentAdapters.ts` 변경도 지금 그렇고, 데스크톱에서만 깨지면 nightly가
잡습니다.
- **판단해 주세요**: brief 목록 밖인 `web-e2e.yml`, `desktop-e2e.yml`,
`os-contract.yml`과 디자인 검사 6개도 같은 규칙이라 넣었습니다. workflow는 테스트가 `pr.yml`의
`uses:`에서 부르는 레인을 읽어 맞춥니다.
- **조심해서 볼 파일**: `scripts/ci-plan.py` `classify` - 다른 규칙이 없는 경로는 이제
READERS가 전부 정합니다. 기존 READERS 경로는 다른 규칙이 먼저 잡아 그대로입니다.
- **조심해서 볼 파일**: `scripts/ci-plan.py` READERS - 크레이트는 그 크레이트 테스트만 돌립니다.
테스트가 아닌 코드가 계약을 읽게 되면 크레이트 변경 규칙으로 옮겨야 합니다.

## Evidence

- **확인한 것**: `python3 -m unittest discover -s scripts/tests -p
'test_*.py'` 343개 통과.
- **확인한 것**: 계약 테스트는 기대값을 소스에서 얻습니다. 주석을 뺀 코드에서 파일 이름을 부르는 크레이트와 웹 파일이
계획된 크레이트와 레인과 같아야 합니다.
- **확인한 것**: 레인 하나를 빼는 변조 3개(계약, vite 설정, `os-contract.yml`)가 각각 테스트를
실패시킵니다.
- **확인한 것**: 재현 스크립트로 PR 58개의 merge commit diff를 변경 전후 planner에 넣었습니다.
spec은 merge commit 시점 내용으로 읽었습니다. 표는 아래.
- **확인하지 못한 것**: 머지 뒤 실제 PR 런의 잡 수와 대기 시간. 이 PR은 `scripts/ci-plan.py`를
바꿔 자기 런은 전체 레인입니다.
- **확인하지 못한 것**: 리더 스캔은 파일 이름 문자열로 찾아, 경로를 조각으로 이어 붙여 읽는 코드는 놓칠 수 있습니다.

<details><summary>PR별 전/후 (전체 레인이던 13개)</summary>

잡 수는 `plan`, `verify`와 레인별 잡(`web-e2e` 5, `os-contract` 2, `package` 3,
나머지 1)의 합입니다.
Rust 크레이트는 `rust` 레인이 lint와 테스트를 도는 범위입니다(전체 레인이면 workspace 전체).

| PR | Unclassified paths before | Full after | Jobs | macOS jobs | Rust
crates | Lanes dropped |
| --- | --- | --- | --- | --- | --- | --- |
| #1108 | `contracts/hided-ws.schema.json` | no | 18 -> 16 | 2 -> 0 |
workspace -> 11 of 16 | os-contract-macos, desktop-e2e |
| #1085 | `contracts/hide-cli.json` | no | 21 -> 20 | 3 -> 2 | workspace
-> 8 of 16 | os-contract-macos |
| #1083 | `.github/workflows/remote-mailbox.yml` | no | 21 -> 21 | 3 ->
3 | workspace -> 14 of 16 | - |
| #1076 | `scripts/gen-tokens.mjs` | no | 18 -> 10 | 2 -> 0 | workspace
-> 1 of 16 | os-contract, os-contract-macos, windows-check, windows-e2e,
windows-desktop, remote-mailbox, desktop-e2e |
| #1074 | `contracts/hided-ws.schema.json` | no | 18 -> 17 | 2 -> 1 |
workspace -> 3 of 16 | os-contract-macos |
| #1070 | `scripts/gen-screens.mjs`, `web/vite.config.ts` | no | 18 ->
17 | 2 -> 1 | workspace -> 8 of 16 | os-contract-macos |
| #1056 | `contracts/snapshot-wire-enums.json` | no | 21 -> 20 | 3 -> 2
| workspace -> 10 of 16 | os-contract-macos |
| #1051 | `contracts/hided-ws.schema.json` | no | 21 -> 20 | 3 -> 2 |
workspace -> 3 of 16 | os-contract-macos |
| #1049 | `scripts/pen-token-map.json` | no | 18 -> 3 | 2 -> 0 |
workspace -> not run | rust, checks, os-contract, os-contract-macos,
windows-check, windows-e2e, windows-desktop, web-e2e, remote-mailbox,
desktop-e2e |
| #1044 | `.github/workflows/remote-mailbox.yml`,
`contracts/agent-adapters.json`, `contracts/hided-ws.schema.json`,
`contracts/usage-coverage.json` | no | 21 -> 21 | 3 -> 3 | workspace ->
15 of 16 | - |
| #1037 | `contracts/hided-ws.schema.json` | no | 18 -> 17 | 2 -> 1 |
workspace -> 3 of 16 | os-contract-macos |
| #1030 | `Cargo.lock`, `contracts/agent-adapters.json`,
`contracts/hided-ws.schema.json`, `contracts/usage-coverage.json` | yes
| 18 -> 18 | 2 -> 2 | workspace -> workspace | - |
| #1017 | `contracts/snapshot-wire-enums.json` | no | 18 -> 17 | 2 -> 1
| workspace -> 9 of 16 | os-contract-macos |

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