ReviewOS

also looking at this

stacks/buddy

fix: read composer.json from the project path, and drop groups the strategy filter emptied

#1444
Merged glennmichael123 wants to merge fix/read-where-you-checked into main
3 files +13 -12
src/buddy.tsmodified+9-8
Changes to src/buddy.ts
@@ -2187,15 +2187,16 @@ export class Buddy {
21872187 }
21882188 }
21892189
2190 if (groupUpdates.length > 0) {
2191 // Apply group-specific strategy if defined
2192 let filteredUpdates = groupUpdates
2193 if (groupConfig.strategy) {
2194 filteredUpdates = this.filterUpdatesByStrategy(groupUpdates, groupConfig.strategy)
2195 }
2190 // Apply group-specific strategy if defined
2191 let filteredUpdates = groupUpdates
2192 if (groupConfig.strategy) {
2193 filteredUpdates = this.filterUpdatesByStrategy(groupUpdates, groupConfig.strategy)
2194 }
21962195
2197 // Note: Minimum release age filtering is already applied globally before grouping,
2198 // so we don't need to apply it again here
2196 // Note: minimum release age filtering is already applied globally before
2197 // grouping. Push only when something survives the group's strategy filter —
2198 // an empty group would otherwise reach the PR loop as a no-op entry.
2199 if (filteredUpdates.length > 0) {
21992200
22002201 groups.push({
22012202 name: groupConfig.name,
src/registry/registry-client.tsmodified+1-1
Changes to src/registry/registry-client.ts
@@ -952,7 +952,7 @@ export class RegistryClient {
952952 }
953953
954954 // First, let's log what composer.json contains
955 const composerJsonPath = path.join(process.cwd(), 'composer.json')
955 const composerJsonPath = path.join(this.projectPath, 'composer.json')
956956 this.logger.info(`🔍 Reading composer.json from: ${composerJsonPath}`)
957957
958958 if (!fs.existsSync(composerJsonPath)) {
test/buddy-orchestration.test.tsmodified+3-3
Changes to test/buddy-orchestration.test.ts
@@ -749,9 +749,9 @@ describe('buddy orchestration', () => {
749749 expect(fooTypes?.updates.map((update: PackageUpdate) => update.name)).toEqual(['@types/bun-foo'])
750750
751751 // '@types/node' is claimed by the Types group but its minor update is
752 // filtered out by the group's patch strategy.
753 const types = groups.find((group: { name: string }) => group.name === 'Types')
754 expect(types?.updates).toEqual([])
752 // filtered out by the group's patch strategy — and a group left empty
753 // by its own strategy filter is not emitted at all.
754 expect(groups.find((group: { name: string }) => group.name === 'Types')).toBeUndefined()
755755
756756 const nonMajor = groups.find((group: { name: string }) => group.name === 'Non-Major Updates')
757757 expect(nonMajor?.updates.map((update: PackageUpdate) => update.name)).toEqual(['react'])