Skip to content

Removing unused uid-number library - #1237

Merged
BethGriggs merged 1 commit into
nodejs:mainfrom
pacostas:removing-unused-library
Nov 12, 2026
Merged

BethGriggs merged 1 commit into
nodejs:mainfrom
pacostas:removing-unused-library

Conversation

@pacostas

Copy link
Copy Markdown
Contributor

Summary

This PR removes the uid-number library from package.json.

The uid-number library is evaluating the uid/gid only if one of the gid uid are type of string.

https://github.com/npm/uid-number/blob/6e9bdb302ae4799d05abf12e922ccdb4bd9ea023/uid-number.js#L27-L29

  if (typeof gid === "number" && typeof uid === "number") {
    return process.nextTick(cb.bind(null, null, uid, gid))
  }

In addition, the uid-number library is converting the strings to numbers

https://github.com/npm/uid-number/blob/6e9bdb302ae4799d05abf12e922ccdb4bd9ea023/uid-number.js#L21-L22

  if (!isNaN(gid)) gid = gidCache[gid] = +gid
  if (!isNaN(uid)) uid = uidCache[uid] = +uid

This is not the case any more, as after landing this PR, #182 the uid/gid is parsed by common args and it always ends up being type of number with either an actual number in it or a NaN.

citgm/lib/common-args.js

Lines 95 to 107 in f6fc80b

if (!windows) {
app
.option('uid', {
alias: 'u',
type: 'number',
description: 'Set the uid (posix only)'
})
.option('gid', {
alias: 'g',
type: 'number',
description: 'Set the gid (posix only)'
});
}

In case of the NaN value, the current code sets the gid or uid, to the process.getuid(); or process.getgid(); accordingly, as a fallback, before calling the uid-number

citgm/lib/bin/citgm.js

Lines 53 to 55 in f6fc80b

const uid = app.uid || process.getuid();
const gid = app.gid || process.getgid();
uidnumber(uid, gid, (err, uid, gid) => {

Therefore, the functionality that the uid-number provides, is never used, as the gid uid variables, are always numbers, and practically, the uid-number library just returns.

In addition, the uid-number library is deprecated. Last publish was 12 years ago. By removing this library, the warning during npm install is being removed too.

Checklist
  • npm test passes
  • contribution guidelines followed
    here

@codecov-commenter

codecov-commenter commented Nov 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.09%. Comparing base (f6fc80b) to head (2b6ca7b).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1237      +/-   ##
==========================================
- Coverage   96.11%   96.09%   -0.03%     
==========================================
  Files          29       29              
  Lines        2213     2201      -12     
==========================================
- Hits         2127     2115      -12     
  Misses         86       86              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@BethGriggs

Copy link
Copy Markdown
Member

Some history that might be useful context...in the early days of CITGM the intent was to use many ecosystem packages in the implementation so that the CITGM tool itself would form part of the regression test.

But, I'm +1 to being lighter in module usage in CITGM itself going forward as it's a lot easier to debug/triage modules that are explicitly tested in the lookup over trying to debug why CITGM itself is broken.

@pacostas

Copy link
Copy Markdown
Contributor Author

Some history that might be useful context...in the early days of CITGM the intent was to use many ecosystem packages in the implementation so that the CITGM tool itself would form part of the regression test.

Thank you for the context, as this also means that the packages of the implementation, it could be nice to be on the lookup.json in case in the future we want a more explicit approach on how we test node against them. I'll go through these at some point, and check if it worth some of those should be on the lookup.json as there is a possibility CITGM not failing, but the testing suite of the packages does.

@BethGriggs
BethGriggs merged commit c760390 into nodejs:main Nov 12, 2026
11 checks passed
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.

3 participants