Skip to content

Conversation

@atheendre130505
Copy link

Description

This PR enhances the robustness of the process_libyear_dependency_metrics task by implementing strict validation for dependency metadata.
It adds logic to verify that packages and their specific versions exist in external registries (PyPI/NPM) and contain valid release dates before attempting calculations.
Instead of failing the entire background job when encountering non-standard dependencies (like the python runtime requirement or malformed version strings), the system now logs a warning and skips the problematic entry.
This PR fixes #3606
PR also references previous pr #3607.

Notes for Reviewers

The fix primarily targets
augur/tasks/git/dependency_libyear_tasks/libyear_util/util.py
.
The main challenge was that modern lockfiles (Poetry/Pipfile) often list environment requirements that are not standard PyPI packages. Previously, looking these up would cause the task to fail with a KeyError or return invalid default versions.
I've replaced logger.error calls with logger.warning for these scenarios to prevent task crashes while still providing visibility into why a dependency was skipped.
Manual verification was performed using a mock-registry script to ensure the skipping logic correctly filters out invalid data while still processing valid dependencies (like requests).
Signed commits

atheendre130505-atheendreramesh@gmail.com
Yes, I signed my commits.

The variable 's' (sqlalchemy) was undefined in start_tasks.py, causing a NameError in cleanup tasks. Imported 'sqlalchemy as s' to fix.

Signed-off-by: atheendre130505 <atheendreramesh@gmail.com>
The process_libyear_dependency_metrics task was failing when encountering
dependencies that couldn't be resolved on PyPI or NPM (e.g., the 'python'
runtime requirement or versions like '2.9.0.0' not found in release history).

This fix adds validation checks in get_deps_libyear_data:
- Skips dependencies if the package cannot be found on the registry.
- Skips dependencies if the current version requirement cannot be resolved.
- Skips dependencies if release date information is missing for the
  current or latest version.

These encountered issues are logged as warnings instead of causing task
failures, ensuring the overall collection process remains robust even when
some metadata is unavailable.

Signed-off-by: atheendre130505 <atheendreramesh@gmail.com>
Copy link
Contributor

@MoralCode MoralCode left a comment

Choose a reason for hiding this comment

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

Overall I like the shift in patterns used in this PR! i.e. using continue rather than storing the failure and repeatedly checking it later.

Will review in more depth after CHAOSScon (i.e. in early-mid feb).

In the meantime feel free to join the CHAOSS Slack in the #wg-augur-8knot channel if you'd like to interact with other maintainers/contributors

@sgoggins sgoggins assigned andrew and ABrain7710 and unassigned andrew Jan 20, 2026
@sgoggins sgoggins added add-feature Adds new features dependencies Pull requests that update a dependency file labels Jan 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

add-feature Adds new features dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Undefined variable 's' in start_tasks.py causes NameError

5 participants