feat(hk): connect delivery failures to precise diagnostic records
This commit is contained in:
1 parent
275a574203
commit
60e49c1ec9
17 files changed
+253
-20
No files matched your search
@@ -75,3 +75,21 @@ it("links server operation IDs to the audit search without trusting browser IDs"
|
||||
]).auditLink,
|
||||
).toBeNull();
|
||||
});
|
||||
|
||||
it("links a server delivery error to its exact persisted delivery only", () => {
|
||||
const id = "840f4023-04cd-4d7b-92c5-047aa620029c";
|
||||
const record = createErrorRecord(
|
||||
"server",
|
||||
"Delivery failed",
|
||||
"private failure",
|
||||
{ module: "operations", deliveryId: id },
|
||||
);
|
||||
expect(errorOperationLink(record)).toBe(`/admin/devops/deliveries?id=${id}`);
|
||||
expect(errorOperationLink({ ...record, source: "browser" })).toBeNull();
|
||||
expect(
|
||||
errorOperationLink({
|
||||
...record,
|
||||
context: { module: "operations", deliveryId: "../settings" },
|
||||
}),
|
||||
).toBeNull();
|
||||
});
|
||||
@@ -1,8 +1,14 @@
|
||||
import { isDeliveryReference } from "@/features/operations/delivery-diagnostics";
|
||||
import type { CmsErrorRecord } from "./error-monitor";
|
||||
|
||||
export function errorOperationLink(record: CmsErrorRecord): string | null {
|
||||
const context = record.context;
|
||||
if (record.source === "server") {
|
||||
if (
|
||||
context.module === "operations" &&
|
||||
isDeliveryReference(context.deliveryId)
|
||||
)
|
||||
return `/admin/devops/deliveries?id=${context.deliveryId}`;
|
||||
if (context.module === "news") {
|
||||
const id = String(context.articleId ?? "");
|
||||
return /^[1-9]\d{0,18}$/.test(id)
|
||||
|
||||
Reference in new issue
Block a user