Skip to content

feat(cli): add threshold flag override#2114

Open
rodboev wants to merge 2 commits into
data-privacy-stack:mainfrom
rodboev:pr/cli-threshold-override
Open

feat(cli): add threshold flag override#2114
rodboev wants to merge 2 commits into
data-privacy-stack:mainfrom
rodboev:pr/cli-threshold-override

Conversation

@rodboev

@rodboev rodboev commented Jun 28, 2026

Copy link
Copy Markdown

Change Description

Adds a top-level --threshold flag to presidio-cli, so one-shot invocations can set the analyzer confidence threshold without writing a YAML config file or passing inline YAML through -d.

The CLI flag overrides threshold values loaded from -c, -d, .presidiocli, or the default config for the current invocation only. Existing config-file behavior and the default threshold remain unchanged when the flag is omitted.

This also updates the CLI README with plain --threshold usage and precedence notes, and records the feature in the root changelog under a new Presidio CLI unreleased section.

Issue reference

Fixes #2101

Tests

  • poetry run pytest tests/test_cli.py
  • poetry run ruff check presidio_cli tests

Note on CHANGELOG

Update CHANGELOG.md under [unreleased]Presidio CLIAdded.

Checklist

  • I have reviewed the contribution guidelines
  • I have signed the CLA (if required)
  • My code includes unit tests
  • All unit tests and lint checks pass locally
  • My PR contains documentation updates / additions if required

Copilot AI review requested due to automatic review settings June 28, 2026 03:13
@rodboev

rodboev commented Jun 28, 2026

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a --threshold command-line flag to presidio-cli so users can override the configured analyzer confidence threshold for a single invocation without modifying or providing YAML configuration.

Changes:

  • Added --threshold CLI argument with validation (0.0–1.0) and applied it as an in-memory override after config loading.
  • Expanded CLI unit tests to cover threshold override behavior and threshold parsing errors.
  • Updated CLI documentation and the root changelog to document the new flag and its precedence.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
presidio-cli/presidio_cli/cli.py Adds --threshold flag parsing/validation and applies the override to the loaded config.
presidio-cli/tests/test_cli.py Adds tests for threshold override behavior and threshold parsing validation.
presidio-cli/README.md Documents the threshold config key and the new --threshold override behavior/precedence.
CHANGELOG.md Notes the new CLI flag under the unreleased Presidio CLI section.

Comment thread presidio-cli/tests/test_cli.py Outdated
Comment thread presidio-cli/tests/test_cli.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add --threshold CLI flag to presidio-cli to override config-file threshold

2 participants