feat(anonymiser): add retain-descriptions option with security warning - #146
Conversation
- Add StanCheckBox + StanHelpIcon in Section 3 (Run Anonymisation area) - Checkbox hidden by default, shown only when always_anonymise table has data - Warning dialog fires on check with Security Warning icon, Yes/Cancel - _retain_descriptions threaded through _AnonymiseWorker to bsa.anonymise_pdf() - Status label appends [Retain descriptions: ON] when active - 15 unit tests covering worker param, config loading, visibility, and status Closes #134
|
Documentation reminder The following view file(s) were modified in this PR: Please review and update the relevant pages in If the UI has visually changed, capture a new screenshot for the affected screen(s) and commit it to |
There was a problem hiding this comment.
Pull request overview
Adds support for retain_descriptions in the anonymisation workflow (uk-bank-statement-anonymiser v0.2.3), including UI controls and presenter logic intended to mitigate the added security risk.
Changes:
- Adds a new “retain descriptions” UI control (plus help text) to the anonymisation dialog, hidden by default.
- Threads a new
retain_descriptionsflag throughAnonymisePresenter→_AnonymiseWorker→bsa.anonymise_pdf()for single-file and batch modes, with a warning prompt on enable. - Adds unit tests covering worker parameter threading, TOML loading behavior, UI visibility logic, and status label marker behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/unit/test_anonymise_retain_descriptions.py | Adds unit tests for retain-descriptions threading and UI/presenter behavior. |
| src/openstan/views/anonymise_dialog.py | Introduces the retain-descriptions UI elements (checkbox + help icon) in the Run Anonymisation section. |
| src/openstan/presenters/anonymise_presenter.py | Adds retain-descriptions state, warning dialog, dynamic visibility logic, and threads the flag into the worker calls. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Add 'Retaining transaction descriptions' section with usage guidance - Add security warning admonition (danger) covering PII risks - Fix typo: bsp.anonymise_pdf → bsa.anonymise_pdf - Update SCREENSHOTS.md description to note new checkbox
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Jason Farrar <farrar.jason1@gmail.com>
Summary
Adds support for the
retain_descriptionsparameter fromuk-bank-statement-anonymiserv0.2.3, with appropriate security safeguards as requested in #134.Changes
anonymise_dialog.py(view)StanCheckBox+StanHelpIconin Section 3 (Run Anonymisation area)anonymise_presenter.py(presenter)_retain_descriptions: boolstate field (per-session, not persisted)_update_retain_description_visibility()refreshes on table edits and dialog open_update_retain_description_status()appends[Retain descriptions: ON]to the status labelretain_descriptionsthreaded through_AnonymiseWorkertobsa.anonymise_pdf()for both single-file and batch modestest_anonymise_retain_descriptions.py(new — 15 tests)AlwaysAnonymiseConfigTOML loadingCloses
Closes #134