You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Format: JSON array of objects with `from` and `by`.
58
58
- Add one rule per changed hunk, using stable and unique snippets.
59
-
- Prefer the smallest safe snippet that is unlikely to change accidentally.
59
+
-**Ensure `from` appears exactly once in the upstream file.** Both sed and perl handlers replace **all** occurrences — if `from` matches multiple places, all will be replaced, which is almost always wrong. Extend the snippet with more surrounding context to make it unique.
60
+
- Prefer the smallest safe snippet that is unlikely to change accidentally, but large enough to be unique in the file.
60
61
- If replacement is multiline, encode using escaped newlines/tabs in JSON consistently with existing files.
61
62
- For multiline `from` snippets, start at the first non-whitespace token (avoid anchoring on leading indentation only).
62
63
- Prefer replacing the whole logical block (`if (...) { ... }`) rather than only an inner line fragment, so closing braces remain structurally correct.
64
+
-**Encode special characters correctly** for the handler used in `rebase.sh`. See the encoding tables below.
**Common pitfall — `&` in sed `by` values:** In sed replacement strings, `&` means "the entire matched text". Writing `&&` in a `by` value produces the matched `from` text repeated twice instead of a literal `&&`. Always escape as `\\&\\&`. This applies to any `&` in `by`, not just `&&`.
**Prefer multiline (perl) for new rules** — simpler encoding, handles all cases, no `&` pitfall.
63
92
64
93
5. Update `rebase.sh` conflict routing
65
94
- Ensure each file that now has a new rebasing rule is routable in `resolve_conflicts`.
@@ -89,13 +118,24 @@ Important:
89
118
- For each changed `.rebase/replace/**/*.json`, verify every `from` exists in the upstream file content before finishing.
90
119
- Example: `git show <upstream-ref>:<path-without-code-prefix>` and compare with the `from` snippet.
91
120
-`path-without-code-prefix` means the same file path but without the leading `code/` (because `upstream-code` stores VS Code sources at repo root).
121
+
- Verify each `from` appears **exactly once** in the upstream file. If it matches multiple times, the rule will silently replace all of them. Extend the `from` snippet with more context until it is unique.
92
122
- Dry-run the generated rule using the same replacement path as `rebase.sh` (Perl-based multiline replace), not a language-native `.replace(...)`.
93
123
- Include at least one test case where `from`/`by` contains `$` (for example template literals like `${key}`) and confirm replacement still succeeds.
94
124
- Re-check exclusions:
95
125
- no rules for `code/extensions/che-*`
96
126
- no rules for `package-lock.json`
97
127
- Ensure every changed rule file is actually referenced by logic in `rebase.sh` when required.
98
128
129
+
8. Verify completeness — no uncovered Che-specific changes
130
+
- For each file that was updated or created in `.rebase/replace/`, simulate the **full** rule application:
131
+
1. Start with the upstream file at `CURRENT_UPSTREAM_VERSION`.
132
+
2. Apply **all** rule entries from the JSON (not just the newly added ones) plus any custom inline replacements from `rebase.sh`.
133
+
3. Diff the result against the che-code working tree file.
134
+
- If the diff is empty → all Che changes are covered. Good.
135
+
- If there is a remaining diff → there are Che-specific changes in the working tree that are **not covered** by any rule. These changes would be silently lost during rebase.
136
+
- If the uncovered changes are from the same commit being processed, add additional rule entries for them.
137
+
- If the uncovered changes are pre-existing (from earlier commits), report them to the user as a warning: "Pre-existing Che-specific changes at lines X-Y have no rebase rule and would be lost during rebase."
138
+
99
139
## Decision notes
100
140
101
141
- Goal is to protect Che-specific behavior during upstream subtree rebases while keeping deltas in upstream files minimal.
0 commit comments