Skip to content

feat: add dependency enrichment backends#43

Closed
DevonL wants to merge 1 commit into
mainfrom
split/dependency-health-v2-03-dependency-enrichers
Closed

feat: add dependency enrichment backends#43
DevonL wants to merge 1 commit into
mainfrom
split/dependency-health-v2-03-dependency-enrichers

Conversation

@DevonL
Copy link
Copy Markdown
Collaborator

@DevonL DevonL commented Apr 8, 2026

📄 Summary

Dependency enrichment backend for updates to dependency health view

🔍 Related Issues

Link to any related GitHub issues (e.g., Fixes #12, Closes #34):

🧪 Type of Change

Please check the relevant type tag for this PR title:

  • [FIX] Bug fix
  • [NEW] New thing
  • [REFACTOR] Internal changes such as code restructuring or optimization that does not alter functionality
  • [DOC] Documentation-only changes
  • [CHORE] Maintenance, cleanup, or CI configuration

🧪 How Has This Been Tested?

Describe how you tested your changes. Include CI runs, local tests, manual verification, or screenshots if applicable.

📸 Screenshots (if applicable)

If UI or logs are affected, include before/after screenshots or output.

✅ Checklist

  • I’ve read and followed the CONTRIBUTING.md.
  • I’ve added or updated documentation as needed.
  • I’ve verified the change is tested and works as intended.
  • CI/CD checks pass and do not break existing functionality.
  • My code follows the style guidelines of this project.

@DevonL DevonL marked this pull request as ready for review April 8, 2026 14:48
@DevonL DevonL requested a review from colinmoynes as a code owner April 8, 2026 14:48
Copilot AI review requested due to automatic review settings April 8, 2026 14:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces three new dependency enrichment backends for the Dependency Health V2 feature split (PR 3 of 6). These enrichers extend dependency objects with vulnerability, policy, and license information from the Cloudsmith package index. The PR includes a shared utility module for generating consistent dependency keys and comprehensive test coverage for each enricher.

Changes:

  • Adds vulnerability enrichment with caching, concurrency management, and TTL-based expiration
  • Adds policy enrichment for mapping policy violation flags and status information
  • Adds license enrichment with license classification using an existing LicenseClassifier utility
  • Adds a foundDependencyKey utility for consistent package identification across enrichers

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
util/foundDependencyKey.js Utility function for generating consistent cache keys from dependency objects
util/dependencyVulnEnricher.js Vulnerability enrichment backend with intelligent caching and concurrent API fetching
util/dependencyPolicyEnricher.js Policy enrichment backend mapping Cloudsmith policy data to dependencies
util/dependencyLicenseEnricher.js License enrichment backend using existing LicenseClassifier
test/dependencyVulnEnricher.test.js Comprehensive tests for vulnerability enrichment including cache management
test/dependencyPolicyEnricher.test.js Tests for policy enrichment mapping
test/dependencyLicenseEnricher.test.js Tests for license classification

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread util/dependencyVulnEnricher.js Outdated
Comment on lines +40 to +60
function getCloudsmithPackageKey(packageModel) {
if (!packageModel || typeof packageModel !== "object") {
return null;
}

const workspace = String(packageModel.namespace || "").trim().toLowerCase();
const repo = String(packageModel.repository || "").trim().toLowerCase();
const slug = String(
packageModel.slug_perm
|| packageModel.slugPerm
|| packageModel.slug
|| packageModel.identifier
|| ""
).trim();

if (!workspace || !repo || !slug) {
return null;
}

return `${workspace}:${repo}:${slug}`;
}
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

The getCloudsmithPackageKey function in this file duplicates the logic from getFoundDependencyKey in foundDependencyKey.js. Consider using the shared utility function from foundDependencyKey.js instead to reduce code duplication and improve maintainability.

Copilot uses AI. Check for mistakes.
Comment thread util/dependencyLicenseEnricher.js Outdated

module.exports = {
enrichLicenses,
getFoundDependencyKey,
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

The module exports getFoundDependencyKey which is imported from foundDependencyKey.js, but this function is not used within this module and not used by any consumers. This re-export appears unintended and should be removed to keep the API surface clear. If this function is meant to be available through this module for a specific reason, that should be documented.

Suggested change
getFoundDependencyKey,

Copilot uses AI. Check for mistakes.
Comment on lines +1 to +21
// Copyright 2026 Cloudsmith Ltd. All rights reserved.
function getFoundDependencyKey(dependency) {
if (!dependency || !dependency.cloudsmithPackage) {
return null;
}

const pkg = dependency.cloudsmithPackage;
const workspace = String(pkg.namespace || "").trim().toLowerCase();
const repo = String(pkg.repository || "").trim().toLowerCase();
const slug = String(pkg.slug_perm || pkg.slugPerm || pkg.slug || pkg.identifier || "").trim();

if (!workspace || !repo || !slug) {
return null;
}

return `${workspace}:${repo}:${slug}`;
}

module.exports = {
getFoundDependencyKey,
};
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

This new utility module is not covered by any tests. Since it's a critical utility function used by multiple enrichers, it should have dedicated test coverage to ensure the key generation logic works correctly for edge cases.

Copilot uses AI. Check for mistakes.
@DevonL DevonL force-pushed the split/dependency-health-v2-03-dependency-enrichers branch 3 times, most recently from b67eccf to e26263e Compare April 8, 2026 19:28
@DevonL DevonL force-pushed the split/dependency-health-v2-03-dependency-enrichers branch from e26263e to 8856cfb Compare April 8, 2026 19:39
@DevonL
Copy link
Copy Markdown
Collaborator Author

DevonL commented Apr 9, 2026

Closing this PR because the initial split/stacking strategy was incorrect and produced oversized, overlapping diffs.

A clean stacked PR set will be reopened from the original feature branch.

@DevonL DevonL closed this Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants