Social media and the Blogosphere (what’s left of it) and many other media publishing some individual’s view is full of people who claim that “AI” (meaning Large Language Models) only produces what they call “slop” that is full of errors. In programming they claim that it only reproduces code that was part of its training data and if it does not find anything matching it will just produce some hallucination that is mostly wrong. Also the code is supposed to be inefficient. And of course that it does not work at all for niche programming languages (which alas Delphi has become).
I have stated before, that they are wrong but I am getting tired of this. But before I simply give up, here is an example how I just found and fixed a problem in a proprietary tool.
Today I got an email from a user that contained only one sentence:
“Anscheinend kann der DIR-Checker keine Messungen mit R erkennen bzw. checken.”
(English: Apparently the DIR checker tool cannot detect or check measurements with R.)
OK, I first had to call him to clear up what exactly he meant. The I started Claude Code in the source directory of the tool and gave it the following prompt:
“According to a user the ArgusDirCheck version of this tool does not check measurmements that have an R at the second to last position of the name, e.g. T0023_R5.* It works for numbers and other letters, but not R.” (Yes, including the typo)
After it chewed on that for about 5 minutes, I got the following reply:
I found it. Diagnosis before touching anything:
Root cause
src/w_ArgusDirCheck.pas:433 Tf_ArgusDirCheck.GetMeasureList — the filter that is supposed to skip Wiederholungs- und Reifenanschlussmessungen looks at the wrong character position:
MTyp := Copy(Measurement, Length(Measurement) – 1, 1); // zweitletztes Zeichen
MTyp2 := Copy(Measurement, Length(Measurement) – 1, 1); // identisch (siehe todo)
if (not SameText(MTyp, ‘R’)) and (not SameText(MTyp, ‘W’)) and
(not SameText(MTyp2, ‘R’)) and (not SameText(MTyp2, ‘W’)) then beginMeasurement is fn.FilenameOnly, i.e. the full extension is already stripped → for T0023_R5.* it is exactly T0023_R5, whose second-to-last character is R. The measurement is dropped from MeasureList and never checked. Because MeasureList is also what feeds TotalMeasurements, it doesn’t even show up as “skipped”.
Evidence that position 7 is not the measurement type
– ArgKopf.PAS:992 TRunHeader.NameToType — documented as “Ermittelt den Messungstyp anhand des zweiten Zeichens des Messungsnamens”, with CharToType: W = Wiederholung, R = Reifenanschluss, V = Vorbereitung, T = Test, E = Eigenüberwachung, everything else = Produktion.
– The name scheme (ArgConfig.pas:292, DEFAULT_NEW_SESSION_FORMULA = ‘ID+HdNumber(”d”,4)+LandChar+BaseNStr(SeqNum,10,2)’) is: 1 Zeichen Fahrzeug, 4 Zeichen HD-Nummer, 1 Zeichen Land, 2 Zeichen laufende Nummer. So positions 7–8 are the sequence number — and per u_NewSessionTable.GetSessionField the production range runs 00…U9 (99 → A0 → … → U9). R5 is simply the sequence number after ~280 measurements, hence “works for numbers and other letters, but not R” — the user hit the Rx block of sequence numbers.
– T0023_R5 = Fahrzeug T (SKM2), HD 0023, Landkennung _, lfd. Nr. R5, Typ-Zeichen 0 → rteProduction.
– svn.exe blame / svn.exe cat -r 6239: the line is unchanged since 2013 (the todo comment above it already flagged the duplicated MTyp/MTyp2), so this filter has in fact never caught real repeat/tyre-link measurements — those have W/R at position 2 and were always checked.Proposed fix
In GetMeasureList, replace the second-to-last-character test with the domain helper (ArgKopf is already in the uses clause), and drop the redundant MTyp2:
// Wiederholungs- und Reifenanschlussmessungen nicht pruefen
Measurement := fn.FilenameOnly;
// Der Messungstyp steht im zweiten Zeichen des Messungsnamens, nicht im zweitletzten.
// Das zweitletzte Zeichen gehoert zur laufenden Nummer, deshalb wurden bisher z.B.
// Messungen wie T0023_R5 faelschlich uebersprungen. — 2026-07-29
if not (TRunHeader.NameToType(Measurement) in [rteRepeat, rteTyreLink]) then beginSide effect worth knowing: names with W at position 7 (e.g. T0023_W3) were previously skipped and will now be checked — same class of bug, just less likely to have been noticed. Types T/V/E stay unaffected (they were never filtered and still aren’t).
Shall I apply this, and do you want the German comment kept as above? I’d also do a buildcheck.sh debug afterwards.”
I told it to go ahead and it happily changed the code as proposed.
Fix applied and it builds clean.
src/w_ArgusDirCheck.pas, Tf_ArgusDirCheck.GetMeasureList:
// Wiederholungs- und Reifenanschlussmessungen nicht pruefen
Measurement := fn.FilenameOnly;
// Der Messungstyp steht im zweiten Zeichen des Messungsnamens, nicht im zweitletzten.
// Das zweitletzte Zeichen gehoert zur laufenden Nummer, deshalb wurden bisher z.B.
// Messungen wie T0023_R5 faelschlich uebersprungen. — 2026-07-29 twm
if not (TRunHeader.NameToType(Measurement) in [rteRepeat, rteTyreLink]) then beginThe duplicated MTyp/MTyp2 locals and the 2022 todo comment about them are gone (the todo is answered by the fix: they were identical, and both looked at the wrong position). ARGKOPF was already in the implementation uses, so no new dependency.
buildtools/buildcheck.sh debug: 0 errors, 1 warning — the pre-existing u_DataCheckScriptLaserQpr.pas(185) H1054, untouched by this change.
Not committed (and note src/ArgusDataCheck_Version.ini got its build number bumped by the build — leave it out of the commit). Verification against real data still has to happen on your side: run ArgusDirCheck on a project that contains a *_R? measurement and confirm it now appears in the log; a *_W? measurement will now also be checked, which is the same bug in the other letter.
The whole turnaround was about 10 minutes. I didn’t even have to start the Delphi IDE or debug anything. It found the problem just by analyzing the source code.
That’s not slop, that’s very concise analysis of the problem and fixing it by calling an existing method, as it should have been implemented in the first place (but to be fair: That method possibly didn’t exist back when this functionality was originally implemented. So the original programmer (probably me) had to hand craft it himself and got it wrong. Or possibly this convention has been changed over time and nobody adapted the code to match it.)