Skip to content

Phase 2: Expand reusedCode detection to federal npm and PyPI dependencies#126

Open
haseebmalik18 wants to merge 2 commits into
DSACMS:devfrom
haseebmalik18:DSACMS/haseeb/add-gov-dependencies
Open

Phase 2: Expand reusedCode detection to federal npm and PyPI dependencies#126
haseebmalik18 wants to merge 2 commits into
DSACMS:devfrom
haseebmalik18:DSACMS/haseeb/add-gov-dependencies

Conversation

@haseebmalik18

@haseebmalik18 haseebmalik18 commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Auto-fills code.json's reusedCode field with the federal dependencies detected in a repository's manifests. Phase 2 of #124.

Changes

  • Curated federal npm + PyPI package → agency mapping in src/gov-dependencies.data.ts.
  • Detects npm deps from package.json and PyPI deps from requirements.txt, each through its own lookup since PyPI normalizes names differently.
  • Exact package names map 1:1 to their own entry with the repository URL. Unlisted packages under a known org fall back to a scope-level entry so they still get picked up.
  • Refactor: agency constants and maps moved to src/gov-dependencies.data.ts. src/gov-dependencies.ts keeps the lookup logic only.

@haseebmalik18
haseebmalik18 force-pushed the DSACMS/haseeb/add-gov-dependencies branch from 944d244 to bc2a3b3 Compare July 15, 2026 15:55
@haseebmalik18 haseebmalik18 changed the title Dsacms/haseeb/add gov dependencies Phase 2: Expand reusedCode detection to federal npm and PyPI dependencies Jul 15, 2026
@haseebmalik18

Copy link
Copy Markdown
Collaborator Author

Not ready for review yet

@haseebmalik18
haseebmalik18 force-pushed the DSACMS/haseeb/add-gov-dependencies branch from bc2a3b3 to 4170e82 Compare July 16, 2026 15:08
@haseebmalik18
haseebmalik18 marked this pull request as ready for review July 16, 2026 15:35
@haseebmalik18

Copy link
Copy Markdown
Collaborator Author

@natalialuzuriaga Ready for review

@sachin-panayil sachin-panayil left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this is a great start. i left some general comments but before approving, i want to see this actually work and populate the reusedCode field in a repo. can you use testing-repo or any test repo to use this branch and actually show the reusedCode being detected and added?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

how was the file created? if it was manually created, i think there needs to be some documentation within the file with who made it, and an explainer and the date it was created so then if it needs to be updated in the future, we can follow a lineage. there is also a bigger question of what do we need to do if we need to regenerate/update this file but i think we can get away with it since its government repos

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This file was manually created, I am currently in talks with Natalia on the best way to automatically updating the list with new fed gov packages.

});
});

describe("GOV_DEPENDENCIES integrity", () => {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

we should have an integrity test for the pypi dependecies as well

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.

2 participants