Skip to content

Commit 70b86c8

Browse files
andy31415Copilot
andauthored
[Doc] Better documentation on the rename PR for ember cluster conversions (project-chip#43580)
* Doc clarity on rename PR * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent fa956ce commit 70b86c8

1 file changed

Lines changed: 34 additions & 6 deletions

File tree

docs/guides/migrating_ember_cluster_to_code_driven.md

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,44 @@ smaller pull requests. This approach significantly simplifies the review
1919
process, allowing reviewers to approve preliminary changes quickly. We recommend
2020
the following sequence of PRs:
2121

22-
- [ ] **PR 1: File Renames Only.**
22+
- [ ] **PR 1: File Renames and Moves Only.**
2323

2424
- If your migration involves renaming files, submit a PR containing _only_
25-
the renames. A typical rename is from `<name>-server.cpp` to
26-
`<Name>Cluster.cpp`.
27-
- **Note:** For backward compatibility with code generation, it is often
28-
best to **not** rename the header file.
25+
the renames and file moves. This helps to isolate structural changes
26+
from logic changes, making the review process easier.
27+
28+
- **`.cpp` file rename:**
29+
30+
- Rename `<name>-server.cpp` to `<Name>Cluster.cpp`. This is often a
31+
good starting point as much of the implementation can be reused.
32+
Renaming allows `git diff` to track changes more effectively than a
33+
delete/add operation.
34+
35+
- **`.h` file renames and refactoring:**
36+
37+
- The legacy header (`<name>-server.h`) often contains a mix of legacy
38+
API functions, delegate classes, and other definitions. To maintain
39+
backward compatibility while moving to a code-driven model, we
40+
recommend the following:
41+
- Create a new `CodegenIntegration.h` header and move the
42+
implementation portions of `<name>-server.h` into it. This new file
43+
will be responsible for maintaining the legacy API integration logic
44+
that interacts with the generated code.
45+
- If `<name>-server.h` contains delegate classes or other distinct
46+
components (e.g., `class FooDelegate`), move them into their own
47+
header files (e.g., `FooDelegate.h`). A good rule of thumb is that
48+
`class Bar` should live in `Bar.h`.
49+
- After moving the implementation out of `<name>-server.h`, update
50+
`<name>-server.h` itself to be a wrapper that simply includes the
51+
new headers (`CodegenIntegration.h`, `FooDelegate.h`, etc.). This
52+
preserves the include paths for existing code while allowing the
53+
implementation to evolve.
54+
2955
- **Why:** This prevents `git diff` from becoming confused and showing the
3056
entire file as deleted and recreated, making the actual code changes
31-
impossible to review.
57+
impossible to review. Separating file moves from logic changes is a
58+
critical step for an efficient code review.
59+
3260
- _This type of PR can be reviewed and merged very quickly._
3361

3462
- [ ] **PR 2: Code Movement Only.**

0 commit comments

Comments
 (0)