Uniface Dry Run Rollback Erased the Import Log

Resumo

Pixel shares a Uniface 10 CRM debugging case where CSV dry runs validated customer changes but the form rolled back the import log entry. The post explains how the service recorded dry runs in SQLite and why the form’s transaction handling erased that record, a useful lesson for reliable import logging.

DEV Community

A dry run that left no trace - how a rollback in a Uniface form removed the service's own log entry

The customer app from the series Building a customer app in Uniface 10 got a CRM part in its latest stage. Two of the new forms can import a CSV file: one for contacts, one for changes to customer records. Both offer two buttons, "Check" and "Apply". "Check" runs the import as a dry run and lists the line errors, "Apply" writes the data. Tested with Rocket Uniface 10.4.03 Community Edition (10.4.03.021) on Windows, October 2026. The app uses SQLite through the SLE driver (SQLite 3.50.2). The forms worked, the click tests passed - and the import log was still wrong. This post is about that one line in the form. The service has a dry-run flag The import service has one operation per file type. All of them take a numeric pDryRun parameter and hand it down to a shared entry that reads the file line by line. Each line goes to a row entry. The row entry for customer changes validates the line and then stops before it writes anything: if (pDryRun = 1)
return 0
endif
After the last line the shared entry writes one row into the import log, whether it was a dry run or not. The flag is stored in its own column: call NEXT_ID("IMPORT_LOG", "IMPORT_ID", pImportId)
sql "INSERT INTO IMPORT_LOG (IMPORT_ID, IMPORT_TYPE, FILE_NAME, ROWS_TOTAL, ROWS_OK, ROWS_ERROR, DRY_RUN, IMPORTED_AT, IMPORTED_BY, ERROR_TEXT) VALUES (%%(pImportId), '%%(pType)', %%(vFileLit), %%(vTotal), %%(pOk), %%(pErrors), %%(pDryRun), datetime('now', 'localtime'), %%(vUserLit), %%(vErrLit))", "CUSTOMERS"
So the service already makes the decision. In a dry run it changes no customer data, and it records that a check took place. The form rolled back after the check The first version of the form treated the dry run as something to undo. After the activate, it committed only for the real run: if ($status < 0)
rollback
INFO.CMP_DMY = vError
return -1
endif
if (pDryRun = 1)
rollback
else
commit
endif
vText = ""
forlist vLine in vErrText
call ADD_LINE(vText, vLine)
The idea was "a check must not change anything, so roll back to be sure". The result: the only thing the service wrote in a dry run was the log row, and the rollback removed exactly that row. The import log showed applied imports only. Every check had disappeared. This was not visible in the first click test, because the log after "Check" and "Apply" showed one line - the applied one - and that looked plausible. It became visible while reading the service code again to describe it: the DRY_RUN column existed, so the service clearly expected dry-run rows in the log. The fix: let the service own the decision The form now commits in both cases: if ($status < 0)
rollback
INFO.CMP_DMY = vError
return -1
endif
commit
vText = ""
forlist vLine in vErrText
call ADD_LINE(vText, vLine)
The rest of the entry is unchanged. It still uses pDryRun to choose the message ("Check: ..." or "Import ..."). The click test after the change, with a database copy that was restored afterwards: "Check" on a file with one valid and one invalid line: the log shows entry 1 as "check", the customer record is unchanged (same version number, no history row). "Apply" on the same file: the log shows entry 2 as "applied". "Check import" in the contacts form: a log row of type CONTACTS with DRY_RUN = 1, and no contact was created. What I take from it A rollback in the form undoes everything the service did in that transaction, not only the part the form had in mind. If a service has a dry-run flag, the service decides what a dry run writes. The form should not add its own idea of "undo" on top. An audit table with a dry-run column is a hint worth reading. Its rows only make sense if both kinds of runs reach the table. The forms still roll back when the service returns an error status. That case is different: the service reports that it could not finish, and nothing it wrote should stay.
Uniface Dry Run Rollback Erased the Import Log
Powered by Readybot.io

As últimas novidades de Pixel

Incident Response: Look Beyond the Red Alert

Pixel’s DEV Community announcement explores how teams can fixate on one failing service while overlooking the real cause of an outage, such as a full …

Sach: AI Fact-Checks WhatsApp Forwards in India

Pixel’s announcement introduces Sach, a tool that checks forwarded messages in English, Hindi, Telugu, and 14 other Indian languages against official sources. It gives cited …

Java 25 Removes SecurityManager: What to Fix

Pixel’s announcement explains how Java 24’s JEP 486 permanently disabled the SecurityManager, breaking test workarounds that intercept System.exit. It recommends returning exit codes or throwing …