muaddib-scanner 2.10.65 → 2.10.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/monitor/auto-labeler.js +14 -5
package/package.json
CHANGED
|
@@ -22,7 +22,7 @@ const { atomicWriteFileSync } = require('./state.js');
|
|
|
22
22
|
|
|
23
23
|
const DEFAULT_INPUT = path.join(__dirname, '..', '..', 'data', 'ml-training.jsonl');
|
|
24
24
|
const DEFAULT_OUTPUT = path.join(__dirname, '..', '..', 'data', 'ml-training-relabeled.jsonl');
|
|
25
|
-
const DEFAULT_DELAY_MS =
|
|
25
|
+
const DEFAULT_DELAY_MS = 50; // 20 req/s — CLI one-shot, no monitor slot sharing needed
|
|
26
26
|
const SURVIVAL_DAYS = 30;
|
|
27
27
|
|
|
28
28
|
// Labels eligible for auto-relabeling
|
|
@@ -72,8 +72,8 @@ function sleep(ms) {
|
|
|
72
72
|
* @param {string} name - package name
|
|
73
73
|
* @returns {Promise<{status: string, latestVersion?: string, detail?: string}>}
|
|
74
74
|
*/
|
|
75
|
-
async function checkNpmStatus(name) {
|
|
76
|
-
await acquireRegistrySlot();
|
|
75
|
+
async function checkNpmStatus(name, options = {}) {
|
|
76
|
+
if (!options.skipSemaphore) await acquireRegistrySlot();
|
|
77
77
|
try {
|
|
78
78
|
const data = await httpsGetJson(`https://registry.npmjs.org/${encodeURIComponent(name)}`);
|
|
79
79
|
|
|
@@ -90,7 +90,7 @@ async function checkNpmStatus(name) {
|
|
|
90
90
|
} catch (err) {
|
|
91
91
|
return { status: 'error', detail: err.message };
|
|
92
92
|
} finally {
|
|
93
|
-
releaseRegistrySlot();
|
|
93
|
+
if (!options.skipSemaphore) releaseRegistrySlot();
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
|
|
@@ -250,11 +250,13 @@ async function relabelDataset(options = {}) {
|
|
|
250
250
|
|
|
251
251
|
const labelChanges = new Map(); // packageKey → { label, source }
|
|
252
252
|
|
|
253
|
+
const total = packageMap.size;
|
|
253
254
|
for (const [key, pkg] of packageMap) {
|
|
255
|
+
const t0 = Date.now();
|
|
254
256
|
let registryStatus;
|
|
255
257
|
try {
|
|
256
258
|
if (pkg.ecosystem === 'npm') {
|
|
257
|
-
registryStatus = await checkNpmStatus(pkg.name);
|
|
259
|
+
registryStatus = await checkNpmStatus(pkg.name, { skipSemaphore: true });
|
|
258
260
|
} else if (pkg.ecosystem === 'pypi') {
|
|
259
261
|
registryStatus = await checkPyPIStatus(pkg.name);
|
|
260
262
|
} else {
|
|
@@ -265,18 +267,25 @@ async function relabelDataset(options = {}) {
|
|
|
265
267
|
} catch (err) {
|
|
266
268
|
summary.errors++;
|
|
267
269
|
summary.checked++;
|
|
270
|
+
console.log(`[RELABEL] ${key} → error (${Date.now() - t0}ms): ${err.message}`);
|
|
268
271
|
continue;
|
|
269
272
|
}
|
|
270
273
|
|
|
271
274
|
if (registryStatus.status === 'error') {
|
|
272
275
|
summary.errors++;
|
|
273
276
|
summary.checked++;
|
|
277
|
+
console.log(`[RELABEL] ${key} → error (${Date.now() - t0}ms): ${registryStatus.detail}`);
|
|
274
278
|
if (delayMs > 0) await sleep(delayMs);
|
|
275
279
|
continue;
|
|
276
280
|
}
|
|
277
281
|
|
|
278
282
|
const newLabel = computeNewLabel(pkg, registryStatus);
|
|
279
283
|
summary.checked++;
|
|
284
|
+
console.log(`[RELABEL] ${key} → ${newLabel ? newLabel.label : 'unchanged'} (${registryStatus.status}, ${Date.now() - t0}ms)`);
|
|
285
|
+
|
|
286
|
+
if (summary.checked % 100 === 0) {
|
|
287
|
+
console.log(`[RELABEL] Progress: ${summary.checked}/${total} checked`);
|
|
288
|
+
}
|
|
280
289
|
|
|
281
290
|
if (newLabel) {
|
|
282
291
|
labelChanges.set(key, newLabel);
|