Skip to content

feat(TE-22637): per-PDF approval and rejection thresholds on upload - #66

Open
shrinishLT wants to merge 3 commits into
LambdaTest:stagefrom
shrinishLT:TE-22637
Open

feat(TE-22637): per-PDF approval and rejection thresholds on upload#66
shrinishLT wants to merge 3 commits into
LambdaTest:stagefrom
shrinishLT:TE-22637

Conversation

@shrinishLT

@shrinishLT shrinishLT commented Sep 9, 2026

Copy link
Copy Markdown

What

Java SDK half of TE-22637 (per-PDF approval/rejection threshold override at upload). Sibling PRs: smartui-rendering-service#1264 · dotlapse-event-service#2913 · migrations#6188 · smartui-cli#562 · RFC internal-docs#2963.

SmartUIConfig gains three options, forwarded by SmartUIPdf.uploadPDF as the new multipart fields of POST /pdf/upload:

Config Form field Meaning
withApprovalThreshold(Double) approvalThreshold build-level approval, applies to every PDF in the call
withRejectionThreshold(Double) rejectionThreshold build-level rejection
withPdfThresholds(Map<String, PdfThreshold>) thresholds (JSON) per-PDF override; keys are the uploaded file names (or the matching pdfNames entry)

Resolution is per PDF: thresholds[name] side → call-level side → project setting. A side left null is omitted from the request so the server falls back; an explicit 0.0 is sent (rejection 0 = never auto-reject). All validation (0–100, approval <= rejection when rejection > 0, unknown names, use_default_thresholds projects) is done server-side before any build exists, and the server message surfaces in the SDK log and the wrapped exception.

Map<String, PdfThreshold> perPdf = new HashMap<>();
perPdf.put("invoice.pdf", new PdfThreshold(0.0, 4.0));
perPdf.put("contract.pdf", PdfThreshold.approval(3.0));

SmartUIConfig config = new SmartUIConfig()
    .withProjectToken(token)
    .withBuildName("release-42")
    .withApprovalThreshold(1.0)
    .withRejectionThreshold(5.0)
    .withPdfThresholds(perPdf);
new SmartUIPdf(config).uploadPDF("./pdfs");
// invoice 0/4, contract 3/5, every other PDF 1/5

Existing postPDFToSmartUI / uploadPDFs signatures are kept as delegating overloads; no behaviour change when no threshold is set.

The three setters and PdfThreshold take Number, so withApprovalThreshold(5), (5L), (2.5f), (1.25) and (null) all work; the value is stored as a boxed Double and serialised the same way. Version bumped to 1.0.25-beta.1 (Maven Central's latest is 1.0.24-beta.1; a new feature takes a fresh -beta.1 as before).

Verified on dev (pdf-thresholds, 2026-09-09 16:12 IST)

Case Result
config above, 3 PDFs rows stored invoice 0/4, contract 3/5, report 1/5
no thresholds rows NULL/NULL, same as before
thresholds names a PDF not uploaded 400 thresholds names pdfs that are not in this upload: nope.pdf, no build created
approval 6 / rejection 5 400 approvalThreshold (6) cannot exceed rejectionThreshold (5), no build created

Requires the lsrs/DES side to be deployed; against an older backend the fields are ignored and the project defaults apply.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QbnKfTzhr64osinPevTmVG

shrinishLT and others added 3 commits September 9, 2026 16:13
SmartUIConfig gains withApprovalThreshold, withRejectionThreshold and
withPdfThresholds; SmartUIPdf forwards them as the approvalThreshold,
rejectionThreshold and thresholds multipart fields of POST /pdf/upload.
Sides are boxed so an unset value is omitted (project fallback) while an
explicit 0 is sent. Existing signatures are kept as delegating overloads.

Verified on dev env pdf-thresholds: per-file over build-level resolution,
no-threshold upload unchanged, unknown name and inverted band rejected
by the server before any build is created.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QbnKfTzhr64osinPevTmVG
withApprovalThreshold, withRejectionThreshold and PdfThreshold take Number so
int, long, float and double literals all work at the call site; the stored
value stays a boxed Double so an unset side is still omitted from the request.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VwiEkDHT1WnU2ruSFkxYJa
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VwiEkDHT1WnU2ruSFkxYJa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant