Skip to content

fix: handle registries missing 'time' metadata during version resolution#1763

Open
onemen wants to merge 3 commits into
raineorshine:mainfrom
onemen:wip/cooldown-without-time
Open

fix: handle registries missing 'time' metadata during version resolution#1763
onemen wants to merge 3 commits into
raineorshine:mainfrom
onemen:wip/cooldown-without-time

Conversation

@onemen
Copy link
Copy Markdown
Contributor

@onemen onemen commented May 27, 2026

close #1746

Summary
This PR addresses an issue where packages from registries lacking time metadata were incorrectly skipped during version resolution, even when the cooldown period was set to 0.

Changes

  • Version Resolution Logic for 'newest': Updated the resolution strategy to default to the greatest available version when time metadata is unavailable for a package, ensuring that 'newest' targets are correctly identified.
  • Cooldown Bypass: Modified the filtering logic to prevent packages from being skipped due to cooldown predicates when their publish time information is missing.
  • UI Feedback: Enhanced logging to explicitly indicate when a version is being upgraded despite missing time metadata by appending [missing time] to the output.

Motivation
Previously, the absence of time metadata triggered a skip by cooldown even when the cooldown was set to zero.

Testing

  • Verified that packages missing time metadata are now correctly included in resolution candidates.
  • Confirmed that version selection defaults to the highest semantic version when timestamps are absent for 'newest' targets.
  • Verified that log output correctly displays [missing time] during the upgrade process.

Additional Fixes

  • Resolved an edge case where the CLI would incorrectly show a "No package versions were returned" warning when the currently installed version is within the cooldown period and matches the target version.

Testing Improvements, WIP for future PR

  • Currently working on a comprehensive migration from Mocha to Vitest. This transition is already yielding significant performance gains, reducing local test execution times from approximately 2 minutes to under 15 seconds.

@onemen onemen force-pushed the wip/cooldown-without-time branch from cd3ab0b to 9c0bb12 Compare May 27, 2026 12:19
@onemen

This comment was marked as outdated.

raineorshine

This comment was marked as resolved.

- for 'newest' target return greatest when time is missing
- don't skip by cooldown versions with no time
- print [missing time] next to the upgraded version
@onemen onemen force-pushed the wip/cooldown-without-time branch from 9c0bb12 to cd3b36c Compare May 27, 2026 19:43
@onemen onemen requested a review from raineorshine May 27, 2026 19:48
do not warn about empty results when every dep is already at the highest version for non-latest --target
@onemen
Copy link
Copy Markdown
Contributor Author

onemen commented May 28, 2026

@raineorshine
This PR is ready for review, it also covered the changes from #1766

Copy link
Copy Markdown
Owner

@raineorshine raineorshine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for the submission.

const packageInfo = { packageName, currentVersion, options, versions, time }

const versionResult = isTimeMissing
? // we can not search for newest when there are no times, fallback to greatest
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is introducing undesirable new semantics. There is no intention for newest to fallback to greatest. We definitely do not want the added complexity and the need to document it in the README.

Please preserve the existing functionality. If time is missing for a given package, then the user should configure the target differently rather than rely on an opaque fallback mechanism.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

Do you want to print some warning at the bottom of the output for this case?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, thanks. Let's keep this focused on the issue. I don't want to open this up to formatting and logging considerations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Packages from registries without "time" metadata are skipped even when cooldown predicate returns 0

2 participants