release/2026-02-27 - Fix Time ticket issue, add additional logging around reynolds

This commit is contained in:
Dave
2026-03-04 12:21:29 -05:00
parent e251e5f8f6
commit f56a540b2f
7 changed files with 278 additions and 132 deletions

View File

@@ -1,5 +1,6 @@
const { buildClientAndOpts, rrCombinedSearch } = require("./rr-lookup");
const CreateRRLogEvent = require("./rr-logger-event");
const { withRRRequestXml } = require("./rr-log-xml");
/**
* Pick and normalize VIN from inputs
* @param vin
@@ -168,9 +169,12 @@ const ensureRRServiceVehicle = async (args = {}) => {
if (bodyshop) {
const combinedSearchResponse = await rrCombinedSearch(bodyshop, { kind: "vin", vin: vinStr, maxResults: 50 });
CreateRRLogEvent(socket, "silly", "{SV} Preflight combined search by VIN: raw response", {
response: combinedSearchResponse
});
CreateRRLogEvent(
socket,
"silly",
"{SV} Preflight combined search by VIN: raw response",
withRRRequestXml(combinedSearchResponse, { response: combinedSearchResponse })
);
owners = ownersFromCombined(combinedSearchResponse, vinStr);
}
@@ -194,10 +198,15 @@ const ensureRRServiceVehicle = async (args = {}) => {
}
} catch (e) {
// Preflight shouldn't be fatal; log and continue to insert (idempotency will still be handled)
CreateRRLogEvent(socket, "warn", "{SV} VIN preflight lookup failed; continuing to insert", {
vin: vinStr,
error: e?.message
});
CreateRRLogEvent(
socket,
"warn",
"{SV} VIN preflight lookup failed; continuing to insert",
withRRRequestXml(e, {
vin: vinStr,
error: e?.message
})
);
}
// Vendor says: MODEL DESCRIPTION HAS MAXIMUM LENGTH OF 20
@@ -271,7 +280,7 @@ const ensureRRServiceVehicle = async (args = {}) => {
try {
const res = await client.insertServiceVehicle(insertPayload, insertOpts);
CreateRRLogEvent(socket, "silly", "{SV} insertServiceVehicle: raw response", { res });
CreateRRLogEvent(socket, "silly", "{SV} insertServiceVehicle: raw response", withRRRequestXml(res, { res }));
const data = res?.data ?? {};
const svId = data?.dmsRecKey || data?.svId || undefined;
@@ -309,11 +318,16 @@ const ensureRRServiceVehicle = async (args = {}) => {
};
}
CreateRRLogEvent(socket, "error", "{SV} insertServiceVehicle: failure", {
message: e?.message,
code: e?.code,
status: e?.meta?.status || e?.status
});
CreateRRLogEvent(
socket,
"error",
"{SV} insertServiceVehicle: failure",
withRRRequestXml(e, {
message: e?.message,
code: e?.code,
status: e?.meta?.status || e?.status
})
);
throw e;
}