TASK: Diagnose + fully document the Dataforth test-datasheet bug. You are running ON AD2 (192.168.0.6), the host of the testdatadb generator + PostgreSQL. Do NOT fix anything yet — trace, document, and pinpoint root cause. === THE PROBLEM (reported today, 2026-06-17) === John Lehman (jlehman@dataforth.com) to Mike: "We are experiencing problems with test datasheets. Column headers are wrong. Some Final Test lines are missing." From the thread (apps engineer Peter Iliya): - For the 8B35: the STAGED datasheet "H9553-13" (T: drive, TS-4L/STAGE) has the CORRECT input column label "Temp" — but the WEBSITE version "179553-13" shows the WRONG label "resistance". DSCA38 is flagged with the same issue. - Peter CANNOT find 179553-13 as a file on the X: drive or in the DFWDS report — because the website version is generated from the DB, not stored as a file. - Core question (Peter): "Is there a reason we list the input for our RTD modules as resistance, but show the temperature instead?" - Trigger: customer Wellbore Integrity (Joseph Swinehart) raised a cal-cert AUDIT discrepancy on 8B35 4-wire RTD certs. === THE KEY POINT (Mike) === The rendered test sheet EXISTS AS A FILE BEFORE it is ingested into the database. That original/staged file is the ground truth (correct Temp label). Our DB-based regeneration is what introduces the error. FOLLOW THE TRAIL UPSTREAM and FIND WHERE THE ORIGINAL FILE IS. === ARCHITECTURE (per TEST-DATASHEET-PROCESS.md) === Test stations (TS-01..27, DOS) write .dat logs -> AD1 HISTLOGS: \\ad1\... C:\Shares\test\Ate\HISTLOGS\{log_type}\{model}.DAT (+ per-station \TS-XX\LOGS\) -> Legacy DFWDS (VB6) historically rendered "For_Web" .TXT datasheets (the ORIGINAL rendered files) -> testdatadb (THIS host AD2): Node.js + Express + PostgreSQL 18, service on :3000, dashboard http://localhost:3000/, WinSW wrapper, service account INTRANET\svc_testdatadb -> Hoffman Product API (/api/v1/TestReportDataFiles/bulk, OAuth2) -> public website. === WHAT WE ALREADY FOUND IN THE CODE (verify the DEPLOYED copy matches) === Generator template: datasheet-exact.js (find the deployed copy on AD2; repo copy is projects/dataforth-dos/datasheet-pipeline/implementation/templates/datasheet-exact.js). - getSensorNum(): RTD -> 7. Input header logic: sensorNum 3-6 (thermocouples) -> " Temp. (C)"; sensorNum 7 (RTD) -> " Rin (ohms)"; so RTD is rendered as RESISTANCE. The accuracy VALUE formatting is ALSO sensorNum-driven (temperature format vs resistance format) - so values may be wrong too, not just the label. - Final Test loop: `for (i < dataLines.length && i < parsed.statusEntries.length)` with `if (status.length <= 4) continue` -> rows DROP when statusEntries are misaligned/short. === YOUR DELIVERABLES === 1. FULLY DOCUMENT THE END-TO-END PROCESS (write it to a markdown file), especially the UPSTREAM half: exactly what the test station emits, what the ORIGINAL rendered datasheet file is, WHERE it physically lives (find TS-4L/STAGE, the staged H9553-13, and/or the DFWDS For_Web .TXT), and exactly how testdatadb ingests it (parser, which fields, the .DAT format). 2. LOCATE THE ORIGINAL FILE for the 8B35 example (H9553-13 / its For_Web .TXT / the .dat it came from) and for a DSCA38 example. 3. DIFF original (correct) vs DB-generated (wrong) for 8B35 RTD and DSCA38: the exact column header difference, any VALUE differences, and which Final Test lines are missing and WHY. 4. ROOT-CAUSE LOCALIZATION: is the defect in (a) ingestion/.DAT parsing, (b) the DB data itself, or (c) datasheet-exact.js rendering? Confirm against the original file, not assumptions. 5. State the CORRECT RTD output (label = Temp (C); values = temperature, derived how?) per the original, and the precise code change(s) that would fix both the header/values and the dropped Final Test lines. Note any modules where resistance IS the correct label (don't over-correct). Resources you have locally: PostgreSQL on AD2 (query testdatadb directly), the deployed Node service + its code, SMB to AD1 (\\ad1\...) and D2TESTNAS (\\192.168.0.9\test, /data/test has DFWDS, Ate, 8BDATA, DSCDATA, etc.). The ClaudeTools repo has the pipeline source under projects/dataforth-dos/. Output: the process doc (file) + a diagnosis summary + the proposed fix. Diagnose only — no changes to the generator or DB until reviewed.