Part number now picks the longest hyphenated candidate instead of the
first one, matching the documented intent and preventing a short
unrelated token from being reported as the part number (which feeds
the fingerprint used for sorting).
Date code now only accepts YYWW candidates with a plausible year
(10-39) and valid calendar week (01-53), taking the last match when
several qualify; otherwise it stays null instead of guessing wrong,
since a wrong value is worse than a missing one.
Adds regression tests for both cases plus a no-plausible-candidate
case that must yield null.
The lazy quantifier {4,6}? never expanded beyond its minimum because
the trailing greedy [A-Z0-9]* always absorbed the rest up to the
hyphen, so a longer density code would silently be truncated to 5
chars and could match an unrelated table entry, producing wrong specs
instead of null. The density code is actually fixed-width (A + 4
chars); the revision after it is the variable part. Tighten the
pattern to {4}, rewrite the stale comment (which still claimed a fixed
3-char revision), and add a test that every Samsung density key is
exactly 5 characters so a future mismatched table entry can't silently
become unreachable.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Das Samsung-Muster hat die Revision auf exakt 3 Zeichen festgelegt und die
Dichte-Gruppe auf exakt 4 Folgezeichen. Dies führte dazu, dass bei
abweichender Revisionslänge das gesamte Muster nicht passte und Bauform,
Geschwindigkeit und Kapazität verloren gingen.
Das neue Muster verwendet einen faul (lazy) Quantifier für die
Dichte-Gruppe (4-6 Zeichen) und erlaubt beliebig lange Revisionen vor
dem Bindestrich. Dadurch werden Bauform und Geschwindigkeit auch bei
nicht standardisierten Revisionslängen korrekt erkannt.
- M393A2K43B-CTD (einteilige Revision)
- M393A2K43BBX1-CTD (vierteilige Revision)
Beide Tests bestätigen jetzt die korrekte Erkennung von Bauform und
Geschwindigkeit unabhängig von der Revisionslänge.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Deckt die Samsung-Referenz-Teilenummer aus dem physisch vorhandenen
Modul ab. Unbekannte Fragmente (z.B. nicht gelistete Dichte-Codes)
liefern bewusst null statt einer Vermutung - das ist der geplante
Uebergang zum OCR-Weg, kein Fehlerfall.
Das im Task-Brief vorgegebene Regex-Muster liess das literale 'A' der
Dichte-Kennung ausserhalb der Erfassungsgruppe, wodurch die
Tabellensuche nach 'A8K40' nie greifen konnte. Muster korrigiert, damit
die ebenfalls vorgegebenen Tests bestehen; Tabelleninhalte und
Warnkommentar blieben wortgleich.
canonical() und matchKnown() stützen sich auf normalizeToken(), das bei
Nicht-Strings '' zurückgibt. Dies führt dazu, dass bereits geparste Zahlenwerte
lautlos ignoriert werden: canonical(64) liefert '' statt '64', matchKnown(64, list)
liefert null statt den gefundenen Wert.
Die Behebung konvertiert Zahlen zu Zeichenketten, bevor sie normalizeToken()
erreichen, ohne null/undefined zu ändern (diese ergeben weiterhin ''/'null).
Alle 23 Tests grün.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>