<!-- task=mattermost_push_plugin_extraction/05+03,04_docs_verify plan=0 tag=REFACTOR -->

# Docs And Final Verification Plan

## 이 파일을 읽는 구현 에이전트에게

구현을 끝내기 전 `CODE_REVIEW-cloud-G07.md`의 구현 에이전트 소유 섹션을 반드시 채운다. 검증 명령을 실제로 실행하고 stdout/stderr를 붙여 넣은 뒤 active 파일을 그대로 둔 채 review ready를 보고한다. 최종 판정, log rename, `complete.log`, archive 이동은 code-review-skill 전용이다.

## 배경

After plugin API, native move, host consumer cleanup, and hardening are implemented, the extraction needs a precise handoff document and a repeatable verification contract. The Milestone requires plugin README, host integration notes, verification commands, and manual smoke criteria. This subtask closes documentation and runs the full cross-repo verification pass without changing product UX scope.

## 분석 결과

### 읽은 파일

- `agent-ops/roadmap/current.md`
- `agent-ops/roadmap/milestones/mattermost-push-plugin-extraction.md`
- `agent-ops/rules/project/domain/mobile/rules.md`
- `agent-ops/rules/project/domain/workspace-ops/rules.md`
- `apps/mobile/README.md`
- `apps/mobile/push-notification-todo.md`
- `apps/mobile/pubspec.yaml`
- `apps/mobile/lib/main.dart`
- `apps/mobile/lib/services/mattermost_auth_service.dart`
- `apps/mobile/test/widget_test.dart`
- `apps/mobile/android/app/src/main/AndroidManifest.xml`
- `apps/mobile/android/app/build.gradle.kts`

### 테스트 커버리지 공백

- Full Android FCM delivery, notification tap routing, inline reply, ACK, signing key verification, and token registration cannot be fully automated in this repo. Document manual smoke criteria and required environment.
- Flutter widget tests cover dashboard rendering only; plugin API/native compile verification must be run in plugin repo and host app.
- Merged manifest correctness should be verified by Android debug build and deterministic source/merged-manifest search.

### 심볼 참조

- `apps/mobile/push-notification-todo.md` still describes app-owned migration and should be rewritten as historical handoff or replaced with plugin extraction notes.
- `apps/mobile/README.md` is generic Flutter starter text and does not document host/plugin ownership.
- Milestone docs require host app integration memo and smoke criteria, but no such doc exists yet.

### 분할 판단

- Split decision policy was evaluated before choosing plan files.
- This subtask depends on `03+01,02_host_consumer` and `04+02_risk_hardening`; both predecessor directories must have `complete.log` before implementation starts.
- Docs/final verification is split because it should describe the final state after all code-moving subtasks have landed, not the transitional state.

### 범위 결정 근거

- Do not change app feature UI or Mattermost auth product UI; this subtask only documents and verifies final extraction.
- Do not archive or mark Milestone checkboxes complete automatically; roadmap status changes require an explicit roadmap update flow.
- Do not alter native implementation except for doc-comment-level corrections found during verification; code fixes should become review follow-up plans if substantial.

### 빌드 등급

- Build lane: `cloud-G07`; review lane: `cloud-G07`. This is mostly docs, but final acceptance depends on cross-repo Flutter and Android build verification plus manifest/static ownership checks.

## 구현 체크리스트

- [ ] [REFACTOR-1] Plugin README에 API, host responsibilities, Android-first scope, no-op platform scope, smoke criteria를 작성한다.
- [ ] [REFACTOR-2] Host app docs를 plugin consumer 상태로 갱신하고 legacy push TODO를 정리한다.
- [ ] [REFACTOR-3] Full cross-repo verification과 ownership searches를 실행하고 결과를 기록한다.
- [ ] 중간 검증과 최종 검증 명령을 모두 실행하고 실제 출력을 `CODE_REVIEW-cloud-G07.md`에 붙여 넣는다.
- [ ] CODE_REVIEW-*-G??.md의 구현 에이전트 소유 섹션을 실제 구현 내용과 검증 출력으로 채운다. 이 항목이 완료되기 전에는 구현이 완료된 것이 아니다.

## 의존 관계 및 구현 순서

- Directory dependency: `05+03,04_docs_verify` depends on `03+01,02_host_consumer` and `04+02_risk_hardening`.
- Start only after both `agent-task/mattermost_push_plugin_extraction/03+01,02_host_consumer/complete.log` and `agent-task/mattermost_push_plugin_extraction/04+02_risk_hardening/complete.log` exist.

### [REFACTOR-1] Plugin README

#### 문제

The new plugin repo needs to explain the API and integration boundary. Milestone completion requires plugin README and platform scope documentation.

Before:

```text
../mattermost-push-plugin/README.md
```

contains only scaffold text or does not exist before plugin scaffold.

After:

```markdown
# mattermost_push_plugin

Android-first Flutter plugin for Mattermost push notification receipt,
system notification display, tap events, inline reply, ACK delivery,
device token storage, auth token storage, and signing key storage.
```

#### 해결 방법

Write concise plugin README sections: responsibilities, public Dart API, host responsibilities, Android manifest/dependency behavior, iOS/macOS no-op scope or future extension, verification commands, manual smoke test checklist.

#### 수정 파일 및 체크리스트

- [ ] `../mattermost-push-plugin/README.md` responsibilities and API examples
- [ ] Android-first support matrix
- [ ] Manual smoke: FCM receipt, system notification, tap event, inline reply, ACK, token registration, signing key
- [ ] Host app responsibilities: Firebase project config, `google-services.json`, Mattermost login/token, routing callbacks

#### 테스트 작성

Skip tests; docs only. Verification commands are `[REFACTOR-3]`.

#### 중간 검증

```bash
cd /config/workspace/nomadcode && rg --sort path "Android-first|Mattermost|ACK|inline reply|google-services.json|iOS|macOS" ../mattermost-push-plugin/README.md
```

Expected: output shows all required concepts.

### [REFACTOR-2] Host App Docs And TODO Cleanup

#### 문제

`apps/mobile/README.md` is generic Flutter starter text, and `apps/mobile/push-notification-todo.md` describes app-owned native migration rather than plugin consumer ownership.

Before (`apps/mobile/README.md`):

```markdown
# nomadcode-app

nomadcode-app Flutter project.
```

After:

```markdown
# nomadcode-app

Flutter-first NomadCode client. Mattermost push notification delivery is provided by the local `mattermost_push_plugin` path dependency.
```

#### 해결 방법

Update host docs to state what remains in `apps/mobile`: Firebase initialization/config, Mattermost auth/credential flow, workspace UI, notification routing callbacks. Rewrite or reduce `push-notification-todo.md` so it no longer instructs future agents to edit app-owned native service/helper files; reference the plugin README for native push work.

#### 수정 파일 및 체크리스트

- [ ] `apps/mobile/README.md` documents plugin dependency and host responsibilities
- [ ] `apps/mobile/push-notification-todo.md` marks app-owned migration notes as historical or points to plugin repo
- [ ] No secrets, tokens, or local absolute user paths are added
- [ ] Roadmap files are not edited in this subtask

#### 테스트 작성

Skip tests; docs only.

#### 중간 검증

```bash
cd /config/workspace/nomadcode && rg --sort path "mattermost_push_plugin|host app|Firebase|Mattermost" apps/mobile/README.md apps/mobile/push-notification-todo.md
```

Expected: output shows host/plugin responsibility language.

### [REFACTOR-3] Full Verification Contract

#### 문제

The Milestone completion criteria require `apps/mobile` tests and Android build or an explicit alternative. Without a final verification pass, extraction can leave stale app-owned native files or duplicate Firebase manifest services.

#### 해결 방법

Run deterministic source ownership searches, plugin tests/build, host tests/build, and merged manifest search if the build produces a merged manifest. Record exact stdout/stderr in `CODE_REVIEW-cloud-G07.md`.

#### 수정 파일 및 체크리스트

- [ ] Run plugin `flutter test`
- [ ] Run plugin example Android build
- [ ] Run host `flutter test`
- [ ] Run host Android debug build
- [ ] Run stale app-owned native source search
- [ ] Run merged manifest service search when build output exists

#### 테스트 작성

No new tests in this subtask unless final verification reveals a docs-induced test failure. Code behavior tests belong to earlier subtasks.

#### 중간 검증

```bash
cd /config/workspace/nomadcode && rg --sort path "MattermostFirebaseMessagingService|NotificationReplyBroadcastReceiver|NotificationDismissService|ReceiptDelivery|PushNotificationDataHelper" apps/mobile/android/app/src/main/java apps/mobile/lib
```

Expected: no output and exit code 1. Record both.

## 수정 파일 요약

| 파일 | 항목 |
|------|------|
| `../mattermost-push-plugin/README.md` | REFACTOR-1 |
| `apps/mobile/README.md` | REFACTOR-2 |
| `apps/mobile/push-notification-todo.md` | REFACTOR-2 |
| `CODE_REVIEW-cloud-G07.md` | REFACTOR-3 |

## 최종 검증

```bash
cd /config/workspace/mattermost-push-plugin && dart format --output=none --set-exit-if-changed lib test
cd /config/workspace/mattermost-push-plugin && flutter analyze --no-fatal-infos
cd /config/workspace/mattermost-push-plugin && flutter test
cd /config/workspace/mattermost-push-plugin/example && flutter build apk --debug
cd /config/workspace/nomadcode/apps/mobile && dart format --output=none --set-exit-if-changed lib test
cd /config/workspace/nomadcode/apps/mobile && flutter analyze --no-fatal-infos
cd /config/workspace/nomadcode/apps/mobile && flutter test
cd /config/workspace/nomadcode/apps/mobile && flutter build apk --debug
cd /config/workspace/nomadcode && rg --sort path "MattermostFirebaseMessagingService|NotificationReplyBroadcastReceiver|NotificationDismissService|ReceiptDelivery|PushNotificationDataHelper|push_notification_service" apps/mobile/android/app/src/main/java apps/mobile/lib apps/mobile/test
cd /config/workspace/nomadcode && rg --sort path "com.google.firebase.MESSAGING_EVENT|MattermostFirebaseMessagingService|FlutterFirebaseMessagingService" apps/mobile/build/app/intermediates/merged_manifest/debug/processDebugMainManifest/AndroidManifest.xml ../mattermost-push-plugin/example/build/app/intermediates/merged_manifest/debug/processDebugMainManifest/AndroidManifest.xml
```

Expected: format/analyze/test/build commands succeed. Stale source `rg` should produce no output and exit code 1. Merged manifest `rg` should show intentional plugin-owned FCM service entries only; if paths differ, record the replacement manifest path and reason in `계획 대비 변경 사항`. Cached Flutter test output is acceptable; Android builds must be freshly run.

모든 코드 변경 완료 후 반드시 `CODE_REVIEW-*-G??.md`의 구현 에이전트 소유 섹션을 채운다. 이 파일 작성이 구현의 마지막 단계다.
