Skip to content

Commit 4edb42b

Browse files
committed
debug: add logging to Composer constraint filtering
Added debug logs to understand why constraint filtering is excluding all updates: - Log number of outdated packages found - Log each package being processed with versions - Log constraints found in composer.json - Log why packages are being skipped or accepted This will help identify the issue with overly restrictive filtering.
1 parent 6da25d1 commit 4edb42b

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

src/registry/registry-client.ts

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -588,48 +588,62 @@ export class RegistryClient {
588588
this.logger.warn('Failed to read composer.json for dependency type detection:', error)
589589
}
590590

591-
// Parse composer outdated output and filter based on version constraints
591+
// Parse composer outdated output and filter based on version constraints
592592
if (composerData.installed) {
593+
this.logger.info(`Processing ${composerData.installed.length} outdated Composer packages`)
594+
593595
for (const pkg of composerData.installed) {
594596
if (pkg.name && pkg.version && pkg.latest) {
597+
this.logger.info(`Checking ${pkg.name}: ${pkg.version}${pkg.latest}`)
598+
595599
// Get the version constraint from composer.json
596600
const requireConstraint = composerJsonData.require?.[pkg.name]
597601
const requireDevConstraint = composerJsonData['require-dev']?.[pkg.name]
598602
const constraint = requireConstraint || requireDevConstraint
599-
603+
604+
this.logger.info(`Constraint for ${pkg.name}: ${constraint}`)
605+
600606
if (!constraint) {
607+
this.logger.info(`Skipping ${pkg.name}: not found in composer.json`)
601608
continue // Skip packages not found in composer.json
602609
}
603610

604-
// Check if the latest version respects the version constraint
611+
// Check if the latest version respects the version constraint
605612
let newVersion = pkg.latest
606613
const currentMajor = this.getMajorVersion(pkg.version)
607614
const latestMajor = this.getMajorVersion(pkg.latest)
608-
615+
616+
this.logger.info(`Version analysis for ${pkg.name}: current major=${currentMajor}, latest major=${latestMajor}`)
617+
609618
// For caret constraints (^), only allow updates within the same major version
610619
if (constraint.startsWith('^')) {
611620
if (currentMajor !== latestMajor) {
621+
this.logger.info(`Skipping ${pkg.name}: major version change not allowed by ^ constraint`)
612622
continue // Skip major version updates for caret constraints
613623
}
614624
}
615-
625+
616626
// For tilde constraints (~), handle according to the constraint level
617627
if (constraint.startsWith('~')) {
618628
const currentMinor = this.getMinorVersion(pkg.version)
619629
const latestMinor = this.getMinorVersion(pkg.latest)
620-
630+
621631
// ~1.2 allows patch updates within 1.2.x
622632
if (constraint.includes('.')) {
623633
if (currentMajor !== latestMajor || currentMinor !== latestMinor) {
634+
this.logger.info(`Skipping ${pkg.name}: version change not allowed by ~x.y constraint`)
624635
continue // Skip if not within same minor version
625636
}
626637
} else {
627638
// ~1 allows minor and patch updates within 1.x.x
628639
if (currentMajor !== latestMajor) {
640+
this.logger.info(`Skipping ${pkg.name}: major version change not allowed by ~x constraint`)
629641
continue // Skip if not within same major version
630642
}
631643
}
632644
}
645+
646+
this.logger.info(`Accepted ${pkg.name}: ${pkg.version}${newVersion}`)
633647

634648
const updateType = getUpdateType(pkg.version, newVersion)
635649

0 commit comments

Comments
 (0)