@controlfront/detect 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/commands/scan.js +16 -0
package/package.json
CHANGED
package/src/commands/scan.js
CHANGED
|
@@ -551,6 +551,14 @@ async function postBaselineDirect({
|
|
|
551
551
|
}
|
|
552
552
|
);
|
|
553
553
|
if (!res.ok) {
|
|
554
|
+
// 409 duplicate means the baseline already exists for this commit — not an error
|
|
555
|
+
if (res.status === 409) {
|
|
556
|
+
const body = await res.json().catch(() => ({}));
|
|
557
|
+
if (body?.code === "duplicate") {
|
|
558
|
+
console.log("ℹ️ Baseline already exists for this commit — skipping (idempotent)");
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
}
|
|
554
562
|
const text = await res.text().catch(() => "");
|
|
555
563
|
throw new Error(
|
|
556
564
|
`Baseline sync failed: ${res.status} ${res.statusText} ${text}`
|
|
@@ -606,6 +614,14 @@ async function postSnapshotDirect({
|
|
|
606
614
|
body: JSON.stringify(payload),
|
|
607
615
|
});
|
|
608
616
|
if (!res.ok) {
|
|
617
|
+
// 409 duplicate means the snapshot already exists for this commit — not an error
|
|
618
|
+
if (res.status === 409) {
|
|
619
|
+
const body = await res.json().catch(() => ({}));
|
|
620
|
+
if (body?.code === "duplicate") {
|
|
621
|
+
console.log("ℹ️ Snapshot already exists for this commit — skipping (idempotent)");
|
|
622
|
+
return;
|
|
623
|
+
}
|
|
624
|
+
}
|
|
609
625
|
const text = await res.text().catch(() => "");
|
|
610
626
|
throw new Error(
|
|
611
627
|
`Snapshot sync failed: ${res.status} ${res.statusText} ${text}`
|