fix: use serial positions 6-11 for module slug instead of last 6 chars

Serial format is PPPPPP+SSSSSS+0001 — slice(-6) was picking up the
trailing 0001 suffix. slice(6,12) gives the correct device identifier.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-28 01:29:24 +02:00
parent 15ed8f8723
commit d6cde25504
+3 -1
View File
@@ -10,7 +10,9 @@ const USER_ID = process.env.SOLEM_USER_ID || '5de53bca7ed4c45c2cfe067f';
const registry = new Map(); const registry = new Map();
function makeSlug(type, serial) { function makeSlug(type, serial) {
const suffix = (serial || '').slice(-6).toLowerCase(); // Serial format: PPPPPP SSSSSS 0001 — device identifier is at positions 6-11
const s = serial || '';
const suffix = (s.length >= 12 ? s.slice(6, 12) : s.slice(-6)).toLowerCase();
return `${type}_${suffix}`.replace(/[^a-z0-9_]/g, '_'); return `${type}_${suffix}`.replace(/[^a-z0-9_]/g, '_');
} }