Skip to content

feat(TE-22637): add threshold flags to upload-pdf - #562

Open
shrinishLT wants to merge 1 commit into
LambdaTest:stagefrom
shrinishLT:TE-22637
Open

feat(TE-22637): add threshold flags to upload-pdf#562
shrinishLT wants to merge 1 commit into
LambdaTest:stagefrom
shrinishLT:TE-22637

Conversation

@shrinishLT

@shrinishLT shrinishLT commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

What

Three new options on upload-pdf:

--approvalThreshold <number>   mismatch % at or below which every PDF in this upload is auto-approved (0-100)
--rejectionThreshold <number>  mismatch % at or above which every PDF in this upload is auto-rejected (0-100)
--thresholds <json|file>       per-PDF overrides keyed by name; inline JSON or a path to a JSON file
smartui upload-pdf ./invoices --buildName release-42 --approvalThreshold 2 --rejectionThreshold 5
smartui upload-pdf ./invoices --buildName release-42 --thresholds thresholds.json

The customer shape this serves: one upload-pdf per tolerance group with the same --buildName, so every group lands in one project and one build and health stays aggregated in one place.

Design

Values are forwarded as strings and the backend validates them (range, band, unmatched names, use_default_thresholds), so the CLI surfaces the server's message rather than carrying a second copy of the rules. "0" survives because it's a non-empty string — an explicit zero must not read as "not set".

--thresholds accepts a file path as a convenience for a 50-PDF map; fs.existsSync decides, everything else is treated as inline JSON.

A run with none of the flags appends nothing new to the form — byte-for-byte today's request.

Files

commander/uploadPdf.ts (options) · types.ts · lib/ctx.ts (mapping) · tasks/uploadPdfs.ts (file resolution) · lib/httpClient.ts (form fields) — 19 insertions, no deletions.

Verification

tsup build succeeds; dist/index.cjs contains the new flags. Note tsc --noEmit fails on the untouched tsconfig.json (TS5110: module CommonJS vs moduleResolution NodeNext) — pre-existing on stage, unrelated to this change, and not what the project builds with.

Server side: LambdatestIncPrivate/smartui-rendering-service#1264 · DES: LambdatestIncPrivate/dotlapse-event-service#2913 · RFC: LambdatestIncPrivate/internal-docs#2963 · Ticket: TE-22637

🤖 Generated with Claude Code

https://claude.ai/code/session_01QbnKfTzhr64osinPevTmVG

--approvalThreshold and --rejectionThreshold apply to every pdf in the
upload; --thresholds takes inline JSON or a path to a JSON file with
per-pdf overrides keyed by name, e.g.
{"invoice.pdf":{"approval":2,"rejection":5}}.

Values are forwarded as strings and left to the backend to validate
(range, band, unmatched names, use_default_thresholds), so the CLI
surfaces the server's message rather than a second copy of the rules.
A run with none of the flags sends nothing new.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QbnKfTzhr64osinPevTmVG
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