Skip to content

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

Open
haseebmalik18 wants to merge 3 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 3 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.

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.

#136 is the follow up PR that automates the list by crawling through Fed Gov Github orgs

Comment thread src/__tests__/unit/helper.test.ts
@haseebmalik18
haseebmalik18 force-pushed the DSACMS/haseeb/add-gov-dependencies branch from 4170e82 to 3043f02 Compare July 27, 2026 18:26
@haseebmalik18

haseebmalik18 commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator Author

@sachin-panayil Here is the successful run in test-repo:
https://github.com/DSACMS/testing-repository/actions/runs/30384490568

And the generated code.json with populated reusedCode field:
DSACMS/testing-repository@d01420c

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