@@ -213,13 +213,26 @@ async function parseServerChanges() {
213213}
214214
215215async function getServerChangeFileData ( ) {
216- const liveFileData = await getLiveServerChangeFileData ( ) ;
217- if ( liveFileData . length > 0 ) return liveFileData ;
218-
219216 // The changesets version command deletes .server-changes before this script
220- // enhances the release PR body. Recover those consumed files from the release
221- // branch diff so they still make it into the release notes handoff.
222- return getDeletedServerChangeFileDataFromReleaseBranch ( ) ;
217+ // enhances the release PR body. We combine files still live on disk with the
218+ // ones recovered from the release branch diff, deduped by filename, rather
219+ // than picking one source or the other. This is additive so a partial cleanup
220+ // (some files deleted, some still live) can't silently drop entries. Live
221+ // files win on collision since they are the current on-disk truth.
222+ const [ live , deleted ] = await Promise . all ( [
223+ getLiveServerChangeFileData ( ) ,
224+ getDeletedServerChangeFileDataFromReleaseBranch ( ) ,
225+ ] ) ;
226+
227+ const byName = new Map ( ) ;
228+ for ( const fileData of deleted ) {
229+ byName . set ( fileData . filePath . split ( "/" ) . pop ( ) , fileData ) ;
230+ }
231+ for ( const fileData of live ) {
232+ byName . set ( fileData . filePath . split ( "/" ) . pop ( ) , fileData ) ;
233+ }
234+
235+ return [ ...byName . values ( ) ] . sort ( ( a , b ) => a . filePath . localeCompare ( b . filePath ) ) ;
223236}
224237
225238async function getLiveServerChangeFileData ( ) {
0 commit comments