Skip to content

Fix the purpose origin wire value and pin snapshot enums - #125

Merged
yansfil merged 2 commits into
mainfrom
fix/purpose-origin-wire
Sep 21, 2026
Merged

yansfil merged 2 commits into
mainfrom
fix/purpose-origin-wire

Conversation

@yansfil

@yansfil yansfil commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • 설치된 df17cfd 앱에서 상태줄에 Snapshot decode failed가 고정되고 새 pane이 열리지 않으며 전체가 느려지는 문제를 고칩니다.
  • 원인: core는 체크아웃 purpose의 PullRequestTitle origin을 pull_request_title로 내보내고, 셸은 pr_title만 알았습니다 (Redesign checkout rows and persist purpose #122 이후).
  • PR 제목으로 purpose가 정해진 체크아웃이 하나 생기자 스냅샷 전체 디코드가 실패했고, 셸은 마지막 성공 프레임에 멈췄습니다.
  • 셸 값을 고치고, core가 스냅샷에 내보내는 문자열 enum 9개를 contracts/snapshot-wire-enums.json에 고정해 양쪽 suite가 검사합니다.
  • 실패한 디코드는 알림마다 같은 bridgeError 문자열을 다시 publish해 셸 전체를 초당 약 60회 재구성했습니다. 변경이 있을 때만 publish하고, 메시지에 coding path와 값을 담습니다.

Review

  • 판단해 주세요: 계약 파일을 contracts/에 두고 Rust·Swift 테스트가 같은 파일을 읽는 방식이 맞는지 (Herdr API 계약과 같은 자리).
  • 조심해서 볼 파일: macos/Sources/HerdrMacOS/CoreBridge.swift - snapshot wire 채널의 failure path. bridgeError 쓰기 18곳이 change-only publisher 하나로 모였고, 두 곳은 ?? 체인이 인자 안으로 들어갔습니다.
  • 조심해서 볼 파일: herdr-core/src/model.rs - 테스트만 추가. 각 enum의 variant 목록은 exhaustive match로 묶여 있어 variant 추가 시 컴파일이 먼저 실패합니다.

Evidence

  • 확인한 것: 실행 중인 df17cfd 앱에 lldb로 붙어 DecodingError.dataCorrupted 경로 rest.navigator.workspaces[0].checkouts[4].purpose.origin, 값 pull_request_title을 읽었습니다.
  • 확인한 것: 같은 앱의 launch trace 20초에서 reopen_closed.window_menu.installed가 1,236회(= core objectWillChange 횟수), core.snapshot.refresh는 0회였습니다.
  • 확인한 것: Rust wire_enum_tests는 계약을 pr_title로 바꾸면 실패하고, Swift SnapshotWireEnumTests는 셸 값을 pr_title로 되돌리면 두 테스트 모두 실패합니다 (mutation 후 원복).
  • 확인한 것: verify-cargo.sh lint, verify-cargo.sh test -p herdr-core --lib 624 passed, verify-swift.sh test 533 passed, design contract PASS.
  • 확인하지 못한 것: 이 브랜치 빌드를 설치해 같은 상태에서 상태줄이 걷히고 pane이 열리는 것. 운영 중인 앱을 교체해야 해서 설치는 별도로 진행합니다.
  • 확인하지 못한 것: publish 횟수 감소를 baseline/candidate로 재지 않았습니다. 디코드가 성공하면 실패 경로 자체가 사라지므로 이 변경은 다음 계약 불일치 때의 완화입니다.

AI tooling: 대부분 AI 도구. lldb 출력, 두 suite의 mutation 실패, 계약 파일의 값을 손으로 대조했습니다.

The core serialized a PullRequestTitle purpose origin as
pull_request_title while the shell decoded pr_title, so a checkout whose
purpose fell back to its pull request title failed the whole snapshot
decode and the shell froze on its last good frame.

Fix the Swift value and pin every string enum the core emits into the
snapshot in contracts/snapshot-wire-enums.json: model.rs tests that each
variant emits the listed value, SnapshotWireEnumTests that each listed
value decodes and that no Swift case is unpinned.
A snapshot decode failure repeats on every core notification, and each
repeat assigned the same bridgeError string, which republished the bridge
and rebuilt every view observing it at the notification rate (about 60
times a second in the run that found it). Route every bridgeError write
through one change-only publisher.

The generic DecodingError text named no field; describe the coding path
and the offending value so the status line says which wire value the
two sides disagree on, and record it once in the launch trace.
@yansfil
yansfil merged commit c942b95 into main Sep 21, 2026
5 checks passed
@yansfil
yansfil deleted the fix/purpose-origin-wire branch September 21, 2026 01:41
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