Skip to content

Commit c49ae2e

Browse files
committed
Fix generateAllFileUpdates to prevent cross-contamination between update groups and add debug logging for grouping
1 parent b813faa commit c49ae2e

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/buddy.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,16 @@ export class Buddy {
8484
? this.groupUpdatesByConfig(updates)
8585
: groupUpdates(updates)
8686

87-
const duration = Date.now() - startTime
87+
// Debug logging for group composition
88+
console.log(`🐛 DEBUG: Created ${groups.length} update groups:`)
89+
groups.forEach(group => {
90+
console.log(`🐛 Group: "${group.name}" (${group.updateType}) - ${group.updates.length} updates`)
91+
group.updates.forEach(update => {
92+
console.log(`🐛 - ${update.name}: ${update.currentVersion} -> ${update.newVersion} (${update.file})`)
93+
})
94+
})
95+
96+
const scanDuration = Date.now() - startTime
8897

8998
const result: UpdateScanResult = {
9099
totalPackages,
@@ -194,16 +203,6 @@ export class Buddy {
194203
// Update package.json with new versions
195204
const packageJsonUpdates = await this.generateAllFileUpdates(group.updates)
196205

197-
// Debug logging to understand what files are being processed
198-
console.log(`🐛 DEBUG: Processing group "${group.name}" with ${group.updates.length} updates:`)
199-
group.updates.forEach(update => {
200-
console.log(`🐛 - ${update.name}: ${update.currentVersion} -> ${update.newVersion} (${update.file}, ${update.updateType})`)
201-
})
202-
console.log(`🐛 DEBUG: Generated ${packageJsonUpdates.length} file updates:`)
203-
packageJsonUpdates.forEach(fileUpdate => {
204-
console.log(`🐛 - File: ${fileUpdate.path}`)
205-
})
206-
207206
// Commit changes
208207
await gitProvider.commitChanges(branchName, group.title, packageJsonUpdates)
209208

@@ -460,6 +459,7 @@ export class Buddy {
460459
if (dependencyFileUpdates.length > 0) {
461460
try {
462461
const { generateDependencyFileUpdates } = await import('./utils/dependency-file-parser')
462+
// Pass only the dependency file updates to avoid cross-contamination
463463
const depFileUpdates = await generateDependencyFileUpdates(dependencyFileUpdates)
464464
fileUpdates.push(...depFileUpdates)
465465
}
@@ -477,6 +477,7 @@ export class Buddy {
477477
if (composerUpdates.length > 0) {
478478
try {
479479
const { generateComposerUpdates } = await import('./utils/composer-parser')
480+
// Pass only the composer updates for this specific group to prevent cross-contamination
480481
const compUpdates = await generateComposerUpdates(composerUpdates)
481482
fileUpdates.push(...compUpdates)
482483
}
@@ -494,6 +495,7 @@ export class Buddy {
494495
if (githubActionsUpdates.length > 0) {
495496
try {
496497
const { generateGitHubActionsUpdates } = await import('./utils/github-actions-parser')
498+
// Pass only the GitHub Actions updates for this specific group
497499
const ghActionsUpdates = await generateGitHubActionsUpdates(githubActionsUpdates)
498500
fileUpdates.push(...ghActionsUpdates)
499501
}

0 commit comments

Comments
 (0)