Commit b2ae167
fix: Copilot 审查后修复 — 备份排序改用创建时间、修正注释、补全测试断言 (#503)
* fix: address Copilot review feedback on backup PR (#502)
1. GetLatestBackup / CleanDirectories: sort by directory creation time
instead of name. Legacy 'app-{version}' names are not reliably
lexicographically sortable (e.g. app-10.0.0 vs app-2.0.0), and mixing
.backups/ paths with installPath/ dirs breaks path-string ordering.
Fallback to name tiebreaker for deterministic results.
2. ClientStrategy XML doc: corrected to .backups/backup-{yyyyMMddHHmmss}
format (was stale __backups/backup_{...}).
3. CleanBackup_KeepsOnlyRecentVersions test: added missing assertion to
verify legacy app-* directory retention behavior.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix: GetLatestBackup test now creates dirs in creation-time order
The test expected the alphabetically-last directory, but GetLatestBackup
now sorts by CreationTime. The newest (last-created) directory must
match the expected result. Added Thread.Sleep(10) between creates
to ensure distinct timestamps on fast filesystems (e.g. Linux CI).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent d52c666 commit b2ae167
3 files changed
Lines changed: 30 additions & 22 deletions
File tree
- src/c#/GeneralUpdate.Core
- FileSystem
- Strategy
- tests/CoreTest/FileSystem
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
225 | 225 | | |
226 | 226 | | |
227 | 227 | | |
228 | | - | |
229 | | - | |
230 | | - | |
231 | | - | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
237 | | - | |
| 237 | + | |
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
243 | | - | |
| 243 | + | |
| 244 | + | |
244 | 245 | | |
245 | 246 | | |
246 | 247 | | |
247 | | - | |
| 248 | + | |
248 | 249 | | |
249 | 250 | | |
250 | | - | |
251 | | - | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
252 | 254 | | |
253 | 255 | | |
254 | 256 | | |
255 | 257 | | |
256 | 258 | | |
257 | 259 | | |
258 | | - | |
| 260 | + | |
259 | 261 | | |
| 262 | + | |
260 | 263 | | |
261 | 264 | | |
262 | | - | |
| 265 | + | |
263 | 266 | | |
264 | 267 | | |
265 | 268 | | |
| |||
637 | 640 | | |
638 | 641 | | |
639 | 642 | | |
640 | | - | |
641 | | - | |
642 | | - | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
643 | 647 | | |
644 | 648 | | |
645 | 649 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
854 | 854 | | |
855 | 855 | | |
856 | 856 | | |
857 | | - | |
| 857 | + | |
858 | 858 | | |
859 | 859 | | |
860 | 860 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
71 | 72 | | |
72 | 73 | | |
73 | 74 | | |
74 | | - | |
75 | | - | |
76 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
77 | 79 | | |
78 | 80 | | |
79 | 81 | | |
| |||
148 | 150 | | |
149 | 151 | | |
150 | 152 | | |
151 | | - | |
| 153 | + | |
152 | 154 | | |
153 | | - | |
154 | | - | |
| 155 | + | |
| 156 | + | |
155 | 157 | | |
| 158 | + | |
156 | 159 | | |
| 160 | + | |
157 | 161 | | |
158 | 162 | | |
159 | 163 | | |
160 | 164 | | |
161 | | - | |
| 165 | + | |
162 | 166 | | |
163 | 167 | | |
164 | 168 | | |
| |||
0 commit comments