diff --git a/agent-roadmap/phase/messaging-runtime/PHASE.md b/agent-roadmap/phase/messaging-runtime/PHASE.md index 4581dada..5a42a52f 100644 --- a/agent-roadmap/phase/messaging-runtime/PHASE.md +++ b/agent-roadmap/phase/messaging-runtime/PHASE.md @@ -52,6 +52,9 @@ Mattermost server/webapp/push-proxy는 upstream-followable runtime으로 두고, - [계획] Linux 알림 테스트 - 경로: `agent-roadmap/phase/messaging-runtime/milestones/linux-notification-test.md` - 요약: 선행 정리 후 Linux를 공통 플러그인의 지원 대상으로 두고 배포판, desktop environment, notification daemon, packaging/test 조건을 검증한다. +- [스케치] Full Web Push platform 계약 + - 경로: `agent-roadmap/phase/messaging-runtime/milestones/full-web-push-platform-contract.md` + - 요약: 브라우저가 닫힌 상태에서도 수신되는 Web Push를 위해 service worker, VAPID, `web_rn-v2` token, core/push-proxy platform 분기 계약을 정리한다. - [스케치] 멀티앱 채널 모델 - 경로: `agent-roadmap/phase/messaging-runtime/milestones/multi-app-channel.md` - 요약: 추가 앱이 생길 때 사용 채널만 늘려 분기할 수 있는 서비스 모델을 검토한다. diff --git a/agent-roadmap/phase/messaging-runtime/milestones/flutter-web-notification.md b/agent-roadmap/phase/messaging-runtime/milestones/flutter-web-notification.md index 1ade7611..2bb7c929 100644 --- a/agent-roadmap/phase/messaging-runtime/milestones/flutter-web-notification.md +++ b/agent-roadmap/phase/messaging-runtime/milestones/flutter-web-notification.md @@ -45,7 +45,7 @@ Flutter Web을 패키지 지원 플랫폼으로 올릴 때 기존 Android-first 웹앱이 열려 있는 상태에서 Chrome browser notification을 패키지 책임으로 표시하고 routing event를 재사용한다. - [x] [permission] Web notification 지원 여부와 permission 상태를 조회/요청하는 API를 제공한다. -- [ ] [display] foreground payload를 browser notification으로 표시하고 click 이벤트를 `NotificationOpenedEvent`와 host navigation callback으로 변환한다. +- [x] [display] foreground payload를 browser notification으로 표시하고 click 이벤트를 `NotificationOpenedEvent`와 host navigation callback으로 변환한다. - [x] [event-map] Firebase foreground message 또는 host-injected payload를 기존 `PushNotificationType` map으로 정규화한다. ### Epic: [smoke] Web Smoke @@ -53,8 +53,8 @@ Flutter Web을 패키지 지원 플랫폼으로 올릴 때 기존 Android-first 민감값 없이 반복 가능한 검증 기준을 만들고, Full Web Push는 별도 설계 항목으로 남긴다. - [ ] [test-host] `apps/flutter-test`에서 Flutter Web smoke scaffold와 permission/display/click 상태 표시를 제공한다. -- [ ] [auto-test] web interop을 직접 띄우지 않는 Dart API/mapper 단위 테스트를 추가한다. 검증: `bin/test` -- [ ] [push-follow-up] service worker, VAPID, `web_rn-v2` device token, core/push-proxy platform 분기 설계를 후속 Milestone 후보로 정리한다. +- [x] [auto-test] web interop을 직접 띄우지 않는 Dart API/mapper 단위 테스트를 추가한다. 검증: `bin/test` +- [x] [push-follow-up] service worker, VAPID, `web_rn-v2` device token, core/push-proxy platform 분기 설계를 후속 Milestone 후보로 정리한다. ## 완료 리뷰 diff --git a/agent-roadmap/phase/messaging-runtime/milestones/full-web-push-platform-contract.md b/agent-roadmap/phase/messaging-runtime/milestones/full-web-push-platform-contract.md new file mode 100644 index 00000000..c01886e2 --- /dev/null +++ b/agent-roadmap/phase/messaging-runtime/milestones/full-web-push-platform-contract.md @@ -0,0 +1,69 @@ +# Milestone: Full Web Push platform 계약 + +## 위치 + +- Roadmap: `agent-roadmap/ROADMAP.md` +- Phase: `agent-roadmap/phase/messaging-runtime/PHASE.md` + +## 목표 + +브라우저가 닫힌 상태에서도 수신되는 Full Web Push를 구현하기 전에, Flutter Web 앱, service worker, Mattermost core, push-proxy가 공유할 platform 계약을 정리한다. +`web_rn-v2` device token, VAPID/Firebase web config, service worker ownership, server/push-proxy platform 분기 범위를 민감값 없이 문서화한다. + +## 상태 + +[스케치] + +## 승격 조건 + +- [ ] service worker 소유 경계가 `packages/messaging_flutter`, host app, 또는 별도 web scaffold 중 어디에 있는지 정리한다. +- [ ] VAPID/Firebase web config는 tracked 문서에 원문 값을 남기지 않고 어떤 local/host 책임으로 주입할지 정리한다. +- [ ] `web_rn-v2` token 저장과 core/push-proxy platform 분기에서 Android/iOS/macOS token 계약을 깨지 않는 범위를 정리한다. +- [ ] 구현 가능한 기능 Task와 검증 명령을 Milestone 문서에 확정한다. + +## 구현 잠금 + +- 상태: 잠금 +- 결정 필요: + - service worker ownership과 host app integration 책임 경계를 정해야 한다. + - VAPID/Firebase web config를 어느 환경 책임으로 주입할지 정해야 한다. + +## 범위 + +- Full Web Push service worker 등록과 notification click/open routing 계약 +- `web_rn-v2` device token format, 저장, server registration 경계 +- Mattermost core push platform 상수와 push-proxy web target 후보 +- 민감값 없는 local/remote smoke evidence 기준 + +## 기능 + +### Epic: [contract] Web Push 계약 스케치 + +브라우저 foreground 알림과 Full Web Push 구현 경계를 분리하고 후속 구현 계획으로 승격할 수 있는 계약 후보를 만든다. + +- [ ] [sw-boundary] service worker 소유권, 등록 위치, click/open routing 책임을 정리한다. +- [ ] [token-platform] `web_rn-v2` token format과 core/push-proxy platform 분기 후보를 정리한다. +- [ ] [config-evidence] VAPID/Firebase web config 주입 방식과 민감값 없는 smoke evidence 기준을 정리한다. + +## 완료 리뷰 + +- 상태: 없음 +- 요청일: 없음 +- 완료 근거: 없음 +- 리뷰 필요: + - [ ] 사용자가 완료 결과를 확인했다 + - [ ] archive 이동을 승인했다 +- 리뷰 코멘트: 없음 + +## 범위 제외 + +- Full Web Push 구현 +- 실제 VAPID key, Firebase web config, private host 값 기록 +- Mattermost webapp UI/Redux 알림 구현 복제 +- 제품 앱 UI 또는 앱별 메시징 화면 구현 + +## 작업 컨텍스트 + +- 선행 작업: Flutter Web 알림 +- 관련 경로: `packages/messaging_flutter/`, `apps/flutter-test/`, `services/core/`, `services/push-proxy/` +- 표준선(선택): foreground browser notification은 현 Milestone의 완료 범위로 두고, 브라우저 종료 상태 수신은 이 후보 Milestone에서 별도 계약으로 승격한다. diff --git a/agent-task/m-flutter-web-notification/CODE_REVIEW-local-G04.md b/agent-task/m-flutter-web-notification/CODE_REVIEW-local-G04.md new file mode 100644 index 00000000..e0f6b40a --- /dev/null +++ b/agent-task/m-flutter-web-notification/CODE_REVIEW-local-G04.md @@ -0,0 +1,152 @@ + + +# Code Review Reference - TEST_HOST + +> **[IMPLEMENTING AGENT — READ FIRST] Filling in this file is the mandatory final step of implementation.** +> The task is NOT complete until every implementation-owned section below is filled in. +> Complete the `구현 체크리스트`; the final checklist item is mandatory before saving. +> Fill implementation-owned sections, then stop with active files in place and report ready for review. +> If implementation is blocked by a user-only decision, user-owned external environment prerequisite, or scope conflict, fill `사용자 리뷰 요청` with evidence and stop with active files in place; code-review decides whether to write `USER_REVIEW.md`. Evidence gaps that a follow-up agent can close by rerunning commands or collecting artifacts are normal follow-up issues, not user-review blockers by themselves. +> Do not ask the user directly, present choices in chat, or call `request_user_input` during implementation; record the needed decision in `사용자 리뷰 요청` and stop for code-review. +> Finalization (`코드리뷰 결과`, log rename, `complete.log`, archive moves, `코드리뷰 전용 체크리스트`) is review-agent-only, even after compaction/resume. +> Follow the ownership table at the bottom of this file for which sections you own. + +## 개요 + +date=2026-06-07 +task=m-flutter-web-notification, plan=1, tag=TEST_HOST + +## Roadmap Targets + +- Milestone: `agent-roadmap/phase/messaging-runtime/milestones/flutter-web-notification.md` +- Task ids: + - `test-host`: `apps/flutter-test`에서 Flutter Web smoke scaffold와 permission/display/click 상태 표시를 제공한다. +- Completion mode: check-on-pass + +## 이 파일을 읽는 리뷰 에이전트에게 + +> **[REVIEW AGENT ONLY]** 아래 종결 절차는 코드리뷰 에이전트 전용이다. 구현 에이전트는 이 섹션을 실행하지 않는다. + +각 항목의 구현을 실제 소스 파일과 대조하고, `검증 결과` 섹션의 출력이 코드와 일치하는지 확인하세요. +리뷰 완료는 아래 순서까지 끝난 상태를 의미합니다. + +1. 판정을 append한다. +2. `CODE_REVIEW-local-G04.md` -> `code_review_local_G04_N.log`, `PLAN-local-G04.md` -> `plan_local_G04_M.log`로 아카이브한다. +3. PASS이면 `complete.log` 작성 후 active task 디렉터리를 `agent-task/archive/YYYY/MM/m-flutter-web-notification/`로 이동한다. WARN/FAIL이면 user-review gate를 확인한 뒤 다음 active plan/review 파일 또는 `USER_REVIEW.md`를 작성한다. `USER_REVIEW.md`가 사용자 결정으로 완료/PASS 해소되면 code-review가 `USER_REVIEW.md`를 해소 상태로 갱신하고 `complete.log` 작성 후 archive 이동한다. +4. PASS이고 task group이 `m-`이면 완료 이벤트 메타데이터를 보고한다. roadmap 상태 체크와 `update-roadmap` 호출은 런타임 책임이다. +5. 적용 가능한 `코드리뷰 전용 체크리스트` 항목을 최종 `.log` 위치에서 체크한 뒤 보고한다. + +--- + +## 구현 항목별 완료 여부 + +| 항목 | 완료 여부 | +|------|---------| +| [TEST_HOST-1] Web smoke host UI | [ ] | +| [TEST_HOST-2] Widget test contract update | [ ] | + +## 구현 체크리스트 + +- [ ] `apps/flutter-test/lib/main.dart`에 web notification permission refresh/request, sample foreground display, display result, opened/click routing 상태 표시를 추가한다. +- [ ] `apps/flutter-test/test/widget_test.dart`를 새 smoke scaffold에 맞춰 갱신하고 permission/display 버튼과 opened routing 표시를 검증한다. 중간 검증: `cd apps/flutter-test && flutter test` +- [ ] 최종 검증으로 `bin/test`와 `bin/lint`를 실행한다. +- [ ] CODE_REVIEW-*-G??.md의 구현 에이전트 소유 섹션을 실제 구현 내용과 검증 출력으로 채운다. 이 항목이 완료되기 전에는 구현이 완료된 것이 아니다. + +## 코드리뷰 전용 체크리스트 + +> **[REVIEW AGENT ONLY]** 이 체크리스트는 코드리뷰 에이전트만 사용한다. +> 구현 에이전트는 이 섹션을 수정하거나 체크하지 않는다. + +- [ ] `코드리뷰 결과`에 `PASS`, `WARN`, `FAIL` 중 하나의 판정을 append한다. +- [ ] 판정과 `차원별 평가`, Required/Suggested/Nit 분류가 서로 일치한다. +- [ ] active `CODE_REVIEW-*-G??.md`를 `code_review_local_G04_N.log`로 아카이브한다. +- [ ] active `PLAN-*-G??.md`를 `plan_local_G04_M.log`로 아카이브한다. +- [ ] `.gitignore`의 Agent-Ops 관리 block이 `agent-task/**/*.md`와 `agent-task/**/*.log`를 unignore하고 `agent-roadmap/current.md`를 ignore하는지 확인한다. +- [ ] PASS이면 `agent-ops/skills/common/code-review/templates/complete-log-template.md` 기준으로 `complete.log`를 작성하고 active `.md` 파일을 남기지 않는다. +- [ ] PASS이면 active task 디렉터리 `agent-task/m-flutter-web-notification/`를 `agent-task/archive/YYYY/MM/m-flutter-web-notification/`로 이동하고 최종 archive 경로에서 이 체크리스트를 갱신한다. +- [ ] PASS이고 task group이 `m-`이면 런타임이 읽을 완료 이벤트 메타데이터를 보고하고, roadmap 수정이나 `update-roadmap` 직접 호출을 하지 않는다. +- [ ] PASS split 작업이면 이동 후 빈 active parent `agent-task/m-flutter-web-notification/`를 제거하거나, 남은 sibling/file이 있어 유지했다고 확인한다. +- [ ] WARN/FAIL이고 user-review gate가 트리거되지 않았으면 다음 active `PLAN-local-G04.md`와 `CODE_REVIEW-local-G04.md`를 작성하고 `complete.log`를 작성하지 않는다. +- [ ] USER_REVIEW이면 `agent-ops/skills/common/code-review/templates/user-review-template.md` 기준으로 `USER_REVIEW.md`를 작성하고 active `PLAN-*.md`, `CODE_REVIEW-*.md`, `complete.log`를 남기지 않는다. +- [ ] USER_REVIEW가 사용자 결정으로 완료/PASS 해소되면 `USER_REVIEW.md`를 해소 상태로 갱신하고 `complete.log`를 작성한 뒤 task directory를 archive로 이동한다. + +## 계획 대비 변경 사항 + +_구현 에이전트가 계획과 다르게 구현한 부분을 이유와 함께 기록한다._ + +## 주요 설계 결정 + +_구현 에이전트가 주요 설계 결정 사항을 기록한다._ + +## 사용자 리뷰 요청 + +_기본값은 `없음`이다. 구현 중 사용자 결정, 사용자 소유 외부 환경/secret/서비스 준비, 또는 계획 범위 변경 없이는 안전하게 진행할 수 없으면 아래 항목을 실제 내용으로 교체하고, 구현을 중단한 뒤 active 파일을 그대로 둔 채 리뷰를 요청한다. 구현 에이전트는 사용자에게 직접 질문하거나 선택지를 제시하거나 `request_user_input`을 호출하지 않는다. 후속 에이전트가 명령 재실행이나 산출물 수집으로 해소할 수 있는 검증 증거 공백만으로는 사용자 리뷰 요청을 작성하지 않는다._ + +- 상태: 없음 +- 사유 유형: 없음 +- 결정 필요: 없음 +- 차단 근거: 없음 +- 실행한 검증/명령: 없음 +- 자동 후속 불가 이유: 없음 +- 재개 조건: 없음 + +## 리뷰어를 위한 체크포인트 + +- `apps/flutter-test`가 public `nexo_messaging` API만 사용하고 plugin 내부 push 처리 logic을 복제하지 않는지 확인한다. +- 기존 token, notification, opened, navigation 상태 표시와 integration-test-friendly labels가 유지되는지 확인한다. +- widget tests가 web smoke controls와 unsupported VM display result를 검증하는지 확인한다. + +## 검증 결과 + +_구현 에이전트가 각 중간 검증 및 최종 검증 명령 실행 후 출력을 여기에 붙여 넣는다._ + +필수 규칙: +- 검증 명령은 고정된 계약이다. 임의로 대체하지 않는다. +- 대체가 필요하면 `계획 대비 변경 사항`에 이유와 대체 명령을 기록한다. +- `검증 결과`에는 실제 stdout/stderr를 붙여 넣는다. +- 사용자 리뷰 요청으로 명령을 끝까지 실행하지 못했다면 `사용자 리뷰 요청`에 실행한 명령, 실제 출력, 미실행 명령의 사유를 기록한다. +- mobile/UI hang, timeout, 또는 2분 무진행은 blind retry를 중단하고 focused rerun 명령과 screenshot/window/UI-tree evidence path를 남기며, 불가능하면 정확한 사유를 남긴다. + +### TEST_HOST-1 중간 검증 +```bash +$ cd apps/flutter-test && flutter test +(output) +``` + +### TEST_HOST-2 중간 검증 +```bash +$ cd apps/flutter-test && flutter test +(output) +``` + +### 최종 검증 +```bash +$ bin/test +(output) +``` + +```bash +$ bin/lint +(output) +``` + +--- + +> **[IMPLEMENTING AGENT — BEFORE SAVING] Have you filled in every implementation-owned section: completion table, implementation checklist, changes from plan, design decisions, and verification output?** +> If anything is blank, go back and fill it in before saving this file. +> Leave review-agent-only sections unchanged. + +Sections and their ownership: + +| Section | Owner | Note | +|---------|-------|------| +| Header comment, 개요, 리뷰 에이전트 지시 | Fixed at stub creation | Implementing agent must not modify or execute these (archive, complete.log, and task-directory archive move are review-agent only) | +| Roadmap Targets | Fixed at stub creation from plan when present | Implementing agent must not modify; code-review copies it into `complete.log` as `Roadmap Completion` only on PASS | +| 구현 항목별 완료 여부 (item names) | Fixed at stub creation | Implementing agent checks `[ ]` -> `[x]` only | +| 구현 체크리스트 (item text/order) | Fixed at stub creation from plan | Implementing agent checks `[ ]` -> `[x]` only; final checkbox is mandatory before saving | +| 코드리뷰 전용 체크리스트 | Review agent only | Implementing agent must not modify or check this section | +| 계획 대비 변경 사항, 주요 설계 결정 | Implementing agent | Replace placeholder text with actual content | +| 사용자 리뷰 요청 | Implementing agent | Keep `상태: 없음` unless user input is required to proceed; do not ask the user directly during implementation; when filled, include exact decision, evidence, commands/output, why automatic follow-up cannot resolve it, and resume condition | +| 리뷰어를 위한 체크포인트 | Fixed at stub creation | Pre-filled from plan | +| 검증 결과 (section headings + commands) | Fixed at stub creation | Implementing agent fills in command output only; command changes require a `계획 대비 변경 사항` entry | +| 코드리뷰 결과 | Review agent appends | Not included in stub | diff --git a/agent-task/m-flutter-web-notification/PLAN-local-G04.md b/agent-task/m-flutter-web-notification/PLAN-local-G04.md new file mode 100644 index 00000000..daf615bc --- /dev/null +++ b/agent-task/m-flutter-web-notification/PLAN-local-G04.md @@ -0,0 +1,248 @@ + + +# Plan - TEST_HOST + +## 이 파일을 읽는 구현 에이전트에게 + +`CODE_REVIEW-local-G04.md`의 구현 에이전트 소유 섹션을 실제 구현 내용과 검증 출력으로 채우는 것이 마지막 필수 단계다. +구현 후 검증 명령을 실행하고, active 파일은 그대로 둔 채 리뷰 준비 상태를 보고한다. +종결 처리, log rename, `complete.log` 작성, archive 이동은 code-review skill 전용이다. +구현 중 사용자 결정, 사용자 소유 외부 환경 prerequisite, 범위 충돌 없이는 안전하게 진행할 수 없으면 review stub의 `사용자 리뷰 요청` 섹션에 정확한 근거를 적고 멈춘다. +구현 에이전트는 사용자에게 직접 질문하거나 선택지를 제시하거나 `request_user_input`을 호출하거나 `USER_REVIEW.md`, archive log, `complete.log`를 만들지 않는다. +후속 에이전트가 명령 재실행이나 산출물 수집으로 해소할 수 있는 검증 증거 공백만으로는 사용자 리뷰 요청을 만들지 않는다. + +## 배경 + +현 Milestone의 `smoke` Epic에서 `auto-test`와 `push-follow-up`은 직접 처리되었고, `test-host`만 남았다. +현재 `apps/flutter-test` host는 plugin event, opened event, navigation, token만 표시하므로 Flutter Web permission/display/click smoke를 반복 확인할 UI가 없다. +이 작업은 제품 앱 UI가 아니라 plugin 검증 host에 web notification smoke controls와 상태 표시를 추가한다. + +## 사용자 리뷰 요청 흐름 + +구현 중 blocker는 active `CODE_REVIEW-local-G04.md`의 `사용자 리뷰 요청` 섹션에 기록한다. +이 섹션은 `agent-ops/skills/common/_templates/implementation-user-review-request-section.md`를 따른다. +구현 중 직접 사용자 prompt는 금지하며, code-review가 사용자 리뷰 요청의 타당성을 검증하고 실제 `USER_REVIEW.md` 작성 여부를 결정한다. + +## Roadmap Targets + +- Milestone: `agent-roadmap/phase/messaging-runtime/milestones/flutter-web-notification.md` +- Task ids: + - `test-host`: `apps/flutter-test`에서 Flutter Web smoke scaffold와 permission/display/click 상태 표시를 제공한다. +- Completion mode: check-on-pass + +## 분석 결과 + +### 읽은 파일 + +- `agent-roadmap/current.md` +- `agent-roadmap/phase/messaging-runtime/PHASE.md` +- `agent-roadmap/phase/messaging-runtime/milestones/flutter-web-notification.md` +- `agent-ops/rules/project/domain/workspace-ops/rules.md` +- `agent-ops/rules/project/domain/messaging-flutter/rules.md` +- `agent-ops/rules/project/domain/client-app/rules.md` +- `agent-test/local/rules.md` +- `agent-test/local/messaging-flutter-smoke.md` +- `agent-test/local/client-app-smoke.md` +- `apps/flutter-test/pubspec.yaml` +- `apps/flutter-test/lib/main.dart` +- `apps/flutter-test/test/widget_test.dart` +- `packages/messaging_flutter/lib/nexo_messaging.dart` +- `packages/messaging_flutter/lib/src/nexo_messaging_plugin.dart` +- `packages/messaging_flutter/lib/src/web_notification_permission.dart` + +### 테스트 환경 규칙 + +- test_env: `local`; `agent-test/local/rules.md` 존재 및 읽음. +- 적용 profile: `agent-test/local/client-app-smoke.md`, `agent-test/local/messaging-flutter-smoke.md`. +- 적용 명령: Dart/widget 변경은 `cd apps/flutter-test && flutter test`; workspace 통합 영향은 `bin/test`, lint-sensitive 변경은 `bin/lint`. +- `<확인 필요>` 값: 실제 Chrome smoke용 Firebase web config, VAPID key, private host 값은 tracked 파일에 기록하지 않는다. +- fallback: 없음. local agent-test 규칙이 충분하다. + +### 테스트 커버리지 공백 + +- `apps/flutter-test/lib/main.dart:102-114`는 web permission/display/click 상태 UI가 없으므로 기존 widget tests가 해당 smoke controls를 덮지 않는다. +- `apps/flutter-test/test/widget_test.dart:7-28`은 status Text 4개와 버튼 없음만 검증하므로 새 smoke scaffold에 맞춰 갱신해야 한다. +- 실제 browser notification click은 local widget test에서 발생시키기 어렵다. host는 기존 `onNotificationOpened`/navigation 상태를 click 결과 표시로 재사용하고, widget test는 opened event injection으로 같은 표시 경로를 검증한다. + +### 심볼 참조 + +- none. Rename/remove 대상 없음. + +### 분할 판단 + +- split decision policy를 적용했다. +- 단일 plan을 사용한다. 변경은 `apps/flutter-test` host UI와 widget test 한 ownership boundary에 머문다. +- public plugin API 변경, server/push-proxy 변경, service worker/VAPID 계약 변경은 없다. +- 검증은 같은 local Flutter test와 workspace helper로 묶여 있어 sibling subtask를 만들면 coordination 비용만 늘어난다. + +### 범위 결정 근거 + +- 포함: `apps/flutter-test/lib/main.dart`, `apps/flutter-test/test/widget_test.dart`. +- 제외: `packages/messaging_flutter/**`는 public web API가 이미 존재하므로 수정하지 않는다. +- 제외: `services/core/**`, `services/push-proxy/**`, service worker, VAPID, `web_rn-v2` token 구현은 후속 스케치 Milestone 범위다. +- 제외: 제품 앱 UI와 앱별 business logic은 client-app 도메인 금지 사항이다. + +### 빌드 등급 + +- build: `local-G04`; review: `local-G04`. +- 근거: 단일 Flutter test host UI와 widget tests로 검증 가능한 bounded client-app 변경이다. + +## 구현 체크리스트 + +- [ ] `apps/flutter-test/lib/main.dart`에 web notification permission refresh/request, sample foreground display, display result, opened/click routing 상태 표시를 추가한다. +- [ ] `apps/flutter-test/test/widget_test.dart`를 새 smoke scaffold에 맞춰 갱신하고 permission/display 버튼과 opened routing 표시를 검증한다. 중간 검증: `cd apps/flutter-test && flutter test` +- [ ] 최종 검증으로 `bin/test`와 `bin/lint`를 실행한다. +- [ ] CODE_REVIEW-*-G??.md의 구현 에이전트 소유 섹션을 실제 구현 내용과 검증 출력으로 채운다. 이 항목이 완료되기 전에는 구현이 완료된 것이 아니다. + +### [TEST_HOST-1] Web smoke host UI + +#### 문제 + +`apps/flutter-test/lib/main.dart:102-114`의 host body는 device token, last notification, last opened, last navigation만 표시한다. +Milestone의 `test-host` Task는 Flutter Web permission/display/click 상태 표시를 요구하지만 현재 UI에는 `getWebNotificationPermissionStatus()`, `requestWebNotificationPermission()`, `showWebForegroundNotification()`을 호출할 scaffold가 없다. + +#### 해결 방법 + +Before: + +```dart +102 @override +103 Widget build(BuildContext context) { +104 return MaterialApp( +105 home: Scaffold( +106 appBar: AppBar(title: const Text('Nexo client')), +107 body: ListView( +108 padding: const EdgeInsets.all(16), +109 children: [ +110 Text('Device token: ${_deviceToken ?? 'pending'}'), +111 Text('Last notification: ${_lastNotification ?? 'none'}'), +112 Text('Last opened: ${_lastOpened ?? 'none'}'), +113 Text('Last navigation: ${_lastNavigation ?? 'none'}'), +114 ], +``` + +After: + +```dart +Text('Web notification support: ${_formatWebSupport()}'), +Text('Web notification permission: ${_formatWebPermission()}'), +Text('Last web display: ${_formatWebDisplay()}'), +ElevatedButton( + onPressed: () => unawaited(_refreshWebNotificationStatus(plugin)), + child: const Text('Refresh web permission'), +), +ElevatedButton( + onPressed: () => unawaited(_requestWebNotificationPermission(plugin)), + child: const Text('Request web permission'), +), +ElevatedButton( + onPressed: () => _showWebSmokeNotification(plugin), + child: const Text('Show web smoke notification'), +), +``` + +Implementation notes: + +- Add `NexoMessagingWebNotificationStatus? _webNotificationStatus`, `NexoMessagingWebNotificationDisplayResult? _lastWebDisplay`, and optional `_webSmokeError`. +- Add helper methods for permission status formatting and display result formatting. +- The sample payload must be synthetic and secret-free: title/body plus `server_url`, `channel_id`, optional `root_id`, `is_crt_enabled`. +- Use the existing `onNotificationOpened` and navigation callbacks to show browser click/open routing; do not add duplicate plugin routing logic in the app. + +#### 수정 파일 및 체크리스트 + +- [ ] `apps/flutter-test/lib/main.dart`: add web permission/display state fields. +- [ ] `apps/flutter-test/lib/main.dart`: add refresh/request/show handlers using public `nexo_messaging` API only. +- [ ] `apps/flutter-test/lib/main.dart`: add stable widget keys for web permission and display status rows. +- [ ] `apps/flutter-test/lib/main.dart`: keep existing token, notification, opened, navigation labels so existing integration tests remain meaningful. + +#### 테스트 작성 + +- `apps/flutter-test/test/widget_test.dart`에서 widget tests를 작성한다. +- Test names: `renders web smoke controls`, `updates web permission status from request`, `updates web display result on unsupported VM`, `opened event still drives click routing status`. +- Assertions: buttons exist, status rows update, unsupported VM display result is shown, opened/navigation labels still update. + +#### 중간 검증 + +```bash +cd apps/flutter-test && flutter test +``` + +Expected: exit code 0. + +### [TEST_HOST-2] Widget test contract update + +#### 문제 + +`apps/flutter-test/test/widget_test.dart:15-25` asserts exactly 4 status `Text` widgets and no `ElevatedButton`. +That assertion intentionally prevents product UI drift, but it will reject the required smoke scaffold controls. + +#### 해결 방법 + +Before: + +```dart +15 // Thin host contract: body contains exactly 4 status Text widgets +16 // and no product UI controls. +17 final listViewFinder = find.byType(ListView); +18 expect(listViewFinder, findsOneWidget); +19 final statusTexts = find.descendant( +20 of: listViewFinder, +21 matching: find.byType(Text), +22 ); +23 expect(statusTexts, findsNWidgets(4)); +24 expect(find.byType(ElevatedButton), findsNothing); +25 expect(find.byType(TextField), findsNothing); +``` + +After: + +```dart +expect(find.byKey(const Key('web-permission-status')), findsOneWidget); +expect(find.byKey(const Key('web-display-status')), findsOneWidget); +expect(find.widgetWithText(ElevatedButton, 'Refresh web permission'), findsOneWidget); +expect(find.widgetWithText(ElevatedButton, 'Request web permission'), findsOneWidget); +expect(find.widgetWithText(ElevatedButton, 'Show web smoke notification'), findsOneWidget); +expect(find.byType(TextField), findsNothing); +``` + +#### 수정 파일 및 체크리스트 + +- [ ] `apps/flutter-test/test/widget_test.dart`: replace exact status count/no-button assertion with smoke-control assertions. +- [ ] `apps/flutter-test/test/widget_test.dart`: add button tap tests for public API outcomes on non-web test runtime. +- [ ] `apps/flutter-test/test/widget_test.dart`: keep existing opened/navigation event tests passing. + +#### 테스트 작성 + +- Update existing widget tests and add focused tests in `apps/flutter-test/test/widget_test.dart`. +- No integration test change is planned because actual browser permission prompts and notification clicks require a Chrome/manual runtime; the widget tests cover the host display path without secrets. + +#### 중간 검증 + +```bash +cd apps/flutter-test && flutter test +``` + +Expected: exit code 0. + +## 수정 파일 요약 + +| File | Items | +|------|-------| +| `apps/flutter-test/lib/main.dart` | `TEST_HOST-1` | +| `apps/flutter-test/test/widget_test.dart` | `TEST_HOST-1`, `TEST_HOST-2` | + +## 최종 검증 + +```bash +bin/test +``` + +Expected: exit code 0. Flutter package and client widget tests pass; optional Go test remains skipped unless `NEXO_CORE_GO_TEST=1` is set. + +```bash +bin/lint +``` + +Expected: exit code 0 or documented tool skip from existing helper behavior. + +모든 코드 변경 완료 후 반드시 `CODE_REVIEW-*-G??.md`의 구현 에이전트 소유 섹션을 채운다. 이 파일 작성이 구현의 마지막 단계다. diff --git a/packages/messaging_flutter/test/nexo_messaging_test.dart b/packages/messaging_flutter/test/nexo_messaging_test.dart index f8c12ddd..8297b9c2 100644 --- a/packages/messaging_flutter/test/nexo_messaging_test.dart +++ b/packages/messaging_flutter/test/nexo_messaging_test.dart @@ -11,8 +11,8 @@ class FakeBrowserNotificationInterop implements BrowserNotificationInterop { FakeBrowserNotificationInterop({ this.isSupportedParam = true, this.permissionParam = 'granted', - }) : _isSupported = isSupportedParam, - _permission = permissionParam; + }) : _isSupported = isSupportedParam, + _permission = permissionParam; final bool _isSupported; final String _permission; @@ -406,6 +406,66 @@ void main() { ); }); + group('NexoMessagingWebNotificationStatus', () { + test('normalizes browser permission values', () { + final granted = NexoMessagingWebNotificationStatus.fromBrowserPermission( + 'granted', + ); + final denied = NexoMessagingWebNotificationStatus.fromBrowserPermission( + 'denied', + ); + final defaultPermission = + NexoMessagingWebNotificationStatus.fromBrowserPermission('default'); + + expect(granted.isSupported, isTrue); + expect( + granted.permission, + NexoMessagingWebNotificationPermission.granted, + ); + expect(granted.rawPermission, 'granted'); + expect(granted.isGranted, isTrue); + expect(denied.permission, NexoMessagingWebNotificationPermission.denied); + expect(denied.isGranted, isFalse); + expect( + defaultPermission.permission, + NexoMessagingWebNotificationPermission.defaultPermission, + ); + }); + + test('trims and preserves unknown browser permission values', () { + final status = NexoMessagingWebNotificationStatus.fromBrowserPermission( + ' prompt ', + ); + + expect(status.isSupported, isTrue); + expect(status.permission, NexoMessagingWebNotificationPermission.unknown); + expect(status.rawPermission, ' prompt '); + expect(status.isGranted, isFalse); + }); + + test('unsupported status is not granted', () { + const status = NexoMessagingWebNotificationStatus.unsupported(); + + expect(status.isSupported, isFalse); + expect( + status.permission, + NexoMessagingWebNotificationPermission.unsupported, + ); + expect(status.rawPermission, isNull); + expect(status.isGranted, isFalse); + }); + }); + + group('NexoMessagingWebNotificationDisplayResult', () { + test('unsupported display result is a no-op failure', () { + const result = NexoMessagingWebNotificationDisplayResult.unsupported(); + + expect(result.success, isFalse); + expect(result.isSupported, isFalse); + expect(result.permissionGranted, isFalse); + }); + }); + group('NexoMessagingTokenPrefix', () { test('androidV2 has the expected value', () { expect(NexoMessagingTokenPrefix.androidV2, 'android_rn-v2'); @@ -444,35 +504,40 @@ void main() { expect(result['userInteraction'], isFalse); }); - test('userInteraction parameter is applied when payload does not set it', () { - final result = normalizeWebForegroundMessage({}, userInteraction: true); + test( + 'userInteraction parameter is applied when payload does not set it', + () { + final result = normalizeWebForegroundMessage({}, userInteraction: true); - expect(result['userInteraction'], isTrue); - }); + expect(result['userInteraction'], isTrue); + }, + ); test('userInteraction in payload overrides parameter', () { - final result = normalizeWebForegroundMessage( - {'userInteraction': true}, - userInteraction: false, - ); + final result = normalizeWebForegroundMessage({ + 'userInteraction': true, + }, userInteraction: false); expect(result['userInteraction'], isTrue); }); - test('routing fields are preserved for NotificationOpenedEvent.fromMap', () { - final result = normalizeWebForegroundMessage({ - 'server_url': 'https://nexo.example.com', - 'channel_id': 'ch-1', - 'root_id': 'root-99', - 'is_crt_enabled': 'true', - }); + test( + 'routing fields are preserved for NotificationOpenedEvent.fromMap', + () { + final result = normalizeWebForegroundMessage({ + 'server_url': 'https://nexo.example.com', + 'channel_id': 'ch-1', + 'root_id': 'root-99', + 'is_crt_enabled': 'true', + }); - final event = NotificationOpenedEvent.fromMap(result); - expect(event.serverUrl, 'https://nexo.example.com'); - expect(event.channelId, 'ch-1'); - expect(event.rootId, 'root-99'); - expect(event.isCRTEnabled, isTrue); - }); + final event = NotificationOpenedEvent.fromMap(result); + expect(event.serverUrl, 'https://nexo.example.com'); + expect(event.channelId, 'ch-1'); + expect(event.rootId, 'root-99'); + expect(event.isCRTEnabled, isTrue); + }, + ); test('null routing field values are not included in result', () { final result = normalizeWebForegroundMessage({ @@ -485,7 +550,9 @@ void main() { }); test('absent routing fields are not included in result', () { - final result = normalizeWebForegroundMessage({'type': PushNotificationType.message}); + final result = normalizeWebForegroundMessage({ + 'type': PushNotificationType.message, + }); expect(result.containsKey('server_url'), isFalse); expect(result.containsKey('channel_id'), isFalse); @@ -572,7 +639,9 @@ void main() { test('granted triggers interop.show()', () { setUpWith(isSupported: true, perm: 'granted'); final r = plugin.showWebForegroundNotification({ - 'title': 'T', 'body': 'B', 'tag': 'X', + 'title': 'T', + 'body': 'B', + 'tag': 'X', }); expect(r.success, isTrue); expect(fake.showCalled, isTrue); @@ -583,8 +652,11 @@ void main() { test('interop.show() receives routing fields', () { setUpWith(); plugin.showWebForegroundNotification({ - 'title': 'T', 'server_url': 'https://x.com', - 'channel_id': 'c1', 'root_id': 'r1', 'is_crt_enabled': 'true', + 'title': 'T', + 'server_url': 'https://x.com', + 'channel_id': 'c1', + 'root_id': 'r1', + 'is_crt_enabled': 'true', }); final opts = fake.lastShowOptions!; expect(opts['server_url'], 'https://x.com'); @@ -596,14 +668,16 @@ void main() { test('click routes onNotificationOpened + onNavigateToChannel', () { setUpWith(); String? srv, ch; - plugin.onNavigateToChannel = (s, c) { srv = s; ch = c; }; + plugin.onNavigateToChannel = (s, c) { + srv = s; + ch = c; + }; plugin.showWebForegroundNotification({ - 'title': 'C', 'server_url': 'https://x.com', + 'title': 'C', + 'server_url': 'https://x.com', 'channel_id': 'abc', }); - fake.triggerClick({ - 'server_url': 'https://x.com', 'channel_id': 'abc', - }); + fake.triggerClick({'server_url': 'https://x.com', 'channel_id': 'abc'}); expect(srv, 'https://x.com'); expect(ch, 'abc'); }); @@ -611,14 +685,22 @@ void main() { test('click routes onNavigateToThread when CRT', () { setUpWith(); String? srv, rt; - plugin.onNavigateToThread = (s, r) { srv = s; rt = r; }; + plugin.onNavigateToThread = (s, r) { + srv = s; + rt = r; + }; plugin.showWebForegroundNotification({ - 'title': 'CRT', 'server_url': 'https://x.com', - 'channel_id': 'ch1', 'root_id': 'root-99', 'is_crt_enabled': 'true', + 'title': 'CRT', + 'server_url': 'https://x.com', + 'channel_id': 'ch1', + 'root_id': 'root-99', + 'is_crt_enabled': 'true', }); fake.triggerClick({ - 'server_url': 'https://x.com', 'channel_id': 'ch1', - 'root_id': 'root-99', 'is_crt_enabled': 'true', + 'server_url': 'https://x.com', + 'channel_id': 'ch1', + 'root_id': 'root-99', + 'is_crt_enabled': 'true', }); expect(srv, 'https://x.com'); expect(rt, 'root-99'); @@ -628,11 +710,13 @@ void main() { setUpWith(); final fut = plugin.onNotificationOpened.first; plugin.showWebForegroundNotification({ - 'title': 'S', 'server_url': 'https://x.com', + 'title': 'S', + 'server_url': 'https://x.com', 'channel_id': 'cstream', }); fake.triggerClick({ - 'server_url': 'https://x.com', 'channel_id': 'cstream', + 'server_url': 'https://x.com', + 'channel_id': 'cstream', }); final e = await fut; expect(e.serverUrl, 'https://x.com'); @@ -643,7 +727,8 @@ void main() { setUpWith(); final fut = plugin.onNotification.first; plugin.showWebForegroundNotification({ - 'title': 'P', 'custom_field': 'cv', + 'title': 'P', + 'custom_field': 'cv', }); final raw = await fut; expect(raw['type'], PushNotificationType.message);