Repository navigation
XRAY-129161 - Send curation audit id in headers for email batching - #897
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
49150f6 to
cdc16b6
Compare
adaafc4 to
b8825ee
Compare
7a7dc5a to
5547020
Compare
|
This simple-index GET ( Review generated by xray-pr-review |
|
The description here is the unmodified checklist template (all boxes unchecked) with just a link to the Jira ticket for screenshots. Consider adding a short summary of what changed (audit-ID header threading, panic-safety of ID generation) and why (Xray email-batching correlation), so reviewers and future readers don't need to reconstruct intent from the diff alone. Review generated by xray-pr-review |
|
Review generated by xray-pr-review |
|
The Review generated by xray-pr-review |
|
Verified this manually: ca.auditId is assigned once before Run()'s per---working-dirs loop and never touched inside it, so sharing is correct by construction. Confirmed end-to-end too — ran jf ca --working-dirs=.,child-project against a local Xray/Artifactory; one audit ID logged for the whole invocation, and both projects' rows landed under it in the DB. Skipping an automated test for this specific claim: a real one needs Run()'s actual loop (the existing harness calls doCurateAudit() directly, bypassing auditId generation) with real npm/yarn/pnpm subprocess execution — disproportionate for a guarantee that's already trivially true by inspection. Leaving as a known gap. |
5547020 to
269e6f5
Compare
|
One thing worth confirming before merge: the description and test-plan say "Manually verified end-to-end against a local Xray/Artifactory: header reaches Xray's Could you confirm: (1) was the E2E test re-run against the current Review generated by xray-pr-review |
0410344 to
4e25460
Compare
|
I have read the CLA Document and I hereby sign the CLA |

Summary
jf curation-auditsends per-requestX-Artifactory-Curation-*headers so Xray can identify and batch its curation-audit traffic on the server side:X-Artifactory-Curation-Run-Id(Go constant:CurationAuditIdHeader): a UUID generated once perRun()invocation, threaded through every curation HTTP request (main audit tree, waiver requests, CVS/npm-log fallback paths) via a newca.createHttpClientDetails()helper. Xray correlates all requests sharing one audit ID and batches its blocked-package email notifications into a single message perjf carun instead of one email per package.X-Artifactory-Curation-Source: jf-curation-audit: identifies traffic as coming fromjf curation-auditspecifically (as opposed to a plain package download), independent of the on-demand/cache path Artifactory routes it through. Sent unconditionally on every curation request (main path and the npm curation-probe fallback), since it identifies the caller rather than a specific run.uuid.New()->uuid.NewRandom():uuid.New()panics on an entropy-read failure;NewRandom()surfaces the same failure as a normal, handleableerrorinstead, so a rare OS-level hiccup cannot crash the wholejf cainvocation.Why
Xray previously had no way to associate multiple package-check requests from the same
jf cainvocation, so a run blocking N packages sent N separate notification emails. The audit ID lets Xray's backend batch these into one email per run. The Source header separately lets Xray's audit trail classifyjf catraffic as its own event-origin category, distinct from real package downloads.Test plan
go build ./...passesgo vet ./.../go fmt ./...cleanTestRunGeneratesAuditIdForHttpDetails,TestSendWaiverRequestsSendsCurationAuditIdHeader,TestCreateHttpClientDetails_AuditIdHeaderOmittedWhenEmpty(also covers the Source header),TestProbeBlockedPnpmDirectDepsSendsCurationAuditIdHeaderpackage_statushandler and correlates the batched notification emailScreenshots of before/after are on the Jira ticket: https://jfrog-int.atlassian.net/browse/XRAY-129161