|
| 1 | +# Issue 86 Task Decomposition |
| 2 | + |
| 3 | +> **Source spec:** `docs/plans/2026-04-03-issue-86-design.md` |
| 4 | +> **Generated:** 2026-04-03 |
| 5 | +
|
| 6 | +**Goal:** Refresh this repository's checked-in protobuf artifacts to the latest upstream XMTP proto `main` state while preserving local notification service generation and keeping the repository green. |
| 7 | + |
| 8 | +**Phases:** |
| 9 | +1. Regenerate Protos — refresh upstream and local generated artifacts from the existing Buf workflow |
| 10 | +2. Compatibility Fixes — repair any compile or test fallout caused by regenerated APIs |
| 11 | +3. Verification — run repo validation and confirm no manual drift remains |
| 12 | + |
| 13 | +### Task 1: Regenerate checked-in proto artifacts |
| 14 | + |
| 15 | +**Files:** |
| 16 | +- Modify: `pkg/proto/**` |
| 17 | +- Modify: `swift/**` |
| 18 | +- Modify: `integration/src/gen/**` |
| 19 | +- Modify: `go.mod` |
| 20 | +- Modify: `go.sum` |
| 21 | + |
| 22 | +- [ ] **Step 1: Write failing test** |
| 23 | + ```sh |
| 24 | + ./dev/gen-proto |
| 25 | + buf generate |
| 26 | + git diff --exit-code -- pkg/proto swift integration/src/gen go.mod go.sum |
| 27 | + ``` |
| 28 | + Expected: FAIL — `git diff --exit-code` exits non-zero because checked-in generated files are stale relative to the required generation entrypoints. |
| 29 | + |
| 30 | +- [ ] **Step 2: Verify test fails** |
| 31 | + Run: `git diff --stat -- pkg/proto swift integration/src/gen go.mod go.sum` |
| 32 | + Expected: Non-empty diff showing generated artifact updates from `./dev/gen-proto` and `buf generate`. |
| 33 | + |
| 34 | +- [ ] **Step 3: Implement minimal code** |
| 35 | + ```sh |
| 36 | + ./dev/gen-proto |
| 37 | + buf generate |
| 38 | + ``` |
| 39 | + Keep the generated outputs from those commands as the implementation. Do not hand-edit generated files. If generation updates `go.mod` or `go.sum`, keep those reproducible changes. |
| 40 | + |
| 41 | +- [ ] **Step 4: Verify test passes** |
| 42 | + ```sh |
| 43 | + ./dev/gen-proto |
| 44 | + buf generate |
| 45 | + git diff --exit-code -- pkg/proto swift integration/src/gen go.mod go.sum |
| 46 | + ``` |
| 47 | + Expected: PASS for reproducibility after the generated changes are committed in the worktree context. Re-running the entrypoints should not create additional drift beyond the checked-in update set. |
| 48 | + |
| 49 | +- [ ] **Step 5: Commit** |
| 50 | + `git add pkg/proto swift integration/src/gen go.mod go.sum && git commit -m "chore: regenerate protobuf artifacts"` |
| 51 | + |
| 52 | +### Task 2: Restore compatibility with regenerated APIs |
| 53 | + |
| 54 | +**Files:** |
| 55 | +- Modify: `pkg/**/*.go` |
| 56 | +- Modify: `mocks/*.go` |
| 57 | +- Test: `pkg/**/*_test.go` |
| 58 | + |
| 59 | +- [ ] **Step 1: Write failing test** |
| 60 | + ```go |
| 61 | + // Example focused red test command for the first broken package: |
| 62 | + // go test ./pkg/xmtp -run TestDecodeGroupMessage |
| 63 | + ``` |
| 64 | + Run: `go test -p 1 ./...` |
| 65 | + Expected: FAIL with the first compile or API mismatch introduced by regenerated protos. |
| 66 | + |
| 67 | +- [ ] **Step 2: Verify test fails** |
| 68 | + Run: `go test -p 1 ./...` |
| 69 | + Expected: The same failure reproduces consistently until the affected code is updated. |
| 70 | + |
| 71 | +- [ ] **Step 3: Implement minimal code** |
| 72 | + ```go |
| 73 | + // Update only the smallest affected application and test sites to use the |
| 74 | + // regenerated proto APIs while preserving existing notification behavior. |
| 75 | + ``` |
| 76 | + Apply the minimal compatibility edits in application or test code. Do not change notification service semantics. |
| 77 | + |
| 78 | +- [ ] **Step 4: Verify test passes** |
| 79 | + Run: `go test -p 1 ./...` |
| 80 | + Expected: PASS |
| 81 | + |
| 82 | +- [ ] **Step 5: Commit** |
| 83 | + `git add pkg mocks go.mod go.sum && git commit -m "fix: adapt code to regenerated protos"` |
| 84 | + |
| 85 | +### Task 3: Run final verification |
| 86 | + |
| 87 | +**Files:** |
| 88 | +- Modify: none expected |
| 89 | +- Test: repository verification commands |
| 90 | + |
| 91 | +- [ ] **Step 1: Write failing test** |
| 92 | + Run: `buf lint proto` |
| 93 | + Expected: PASS. Any failure becomes required remediation. |
| 94 | + |
| 95 | +- [ ] **Step 2: Verify test fails** |
| 96 | + Run: `golangci-lint run --timeout=5m --config dev/.golangci.yaml && ./dev/lint-shellcheck && buf breaking --against \"https://github.com/xmtp/example-notification-server-go.git#branch=main,subdir=proto\" proto` |
| 97 | + Expected: PASS. Any failure becomes required remediation. |
| 98 | + |
| 99 | +- [ ] **Step 3: Implement minimal code** |
| 100 | + Apply the smallest fixes required to satisfy verification while keeping generated outputs reproducible from the checked-in Buf configuration. |
| 101 | + |
| 102 | +- [ ] **Step 4: Verify test passes** |
| 103 | + Run: `buf lint proto && golangci-lint run --timeout=5m --config dev/.golangci.yaml && ./dev/lint-shellcheck && buf breaking --against "https://github.com/xmtp/example-notification-server-go.git#branch=main,subdir=proto" proto && go test -p 1 ./... && ./dev/integration` |
| 104 | + Expected: PASS |
| 105 | + |
| 106 | +- [ ] **Step 5: Commit** |
| 107 | + `git add -A && git commit -m "test: finalize proto refresh verification"` |
| 108 | + |
| 109 | +## Requirement Coverage Matrix |
| 110 | + |
| 111 | +| # | EARS Requirement | Task(s) | |
| 112 | +|---|------------------|---------| |
| 113 | +| 1 | WHEN the repository proto refresh workflow is run against the latest `buf.build/xmtp/proto` module THE SYSTEM SHALL regenerate checked-in upstream XMTP proto artifacts under `pkg/proto` and `swift` to match the latest upstream schema. | Task 1 | |
| 114 | +| 2 | WHEN proto regeneration completes THE SYSTEM SHALL preserve generation of the local notification service artifacts under `pkg/proto/notifications/v1`, `swift/notifications/v1`, and `integration/src/gen/notifications/v1`. | Task 1, Task 3 | |
| 115 | +| 3 | WHEN regenerated proto outputs introduce compile-time API changes THE SYSTEM SHALL update the minimal affected application code so the repository builds successfully without changing notification service behavior. | Task 2 | |
| 116 | +| 4 | THE SYSTEM SHALL NOT include manual edits to generated protobuf files that cannot be reproduced by the repository's Buf generation configuration. | Task 1, Task 3 | |
| 117 | +| 5 | WHEN verification commands are run after regeneration THE SYSTEM SHALL pass the repository's unit test and lint-relevant checks required for a reviewable PR. | Task 2, Task 3 | |
| 118 | +| 6 | `dev/gen-proto` SHALL remain the entrypoint for upstream proto regeneration. | Task 1 | |
| 119 | +| 7 | Root `buf.gen.yaml` SHALL remain the source of truth for cross-language generation targets. | Task 1, Task 3 | |
| 120 | +| 8 | `proto/buf.gen.yaml` SHALL remain the source of truth for local notification service generation targets. | Task 1, Task 3 | |
0 commit comments