Skip to content

feat(anonymiser): add retain-descriptions option with security warning - #146

Merged
boscorat merged 3 commits into
masterfrom
134-enhancement-anonymiser-improvements
Aug 8, 2026
Merged

feat(anonymiser): add retain-descriptions option with security warning#146
boscorat merged 3 commits into
masterfrom
134-enhancement-anonymiser-improvements

Conversation

@boscorat

@boscorat boscorat commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Summary

Adds support for the retain_descriptions parameter from uk-bank-statement-anonymiser v0.2.3, with appropriate security safeguards as requested in #134.

Changes

anonymise_dialog.py (view)

  • Added StanCheckBox + StanHelpIcon in Section 3 (Run Anonymisation area)
  • Checkbox and help icon are hidden by default

anonymise_presenter.py (presenter)

  • Added _retain_descriptions: bool state field (per-session, not persisted)
  • Checkbox visibility is dynamic — shown only when the Always Anonymise table has data (BSA requires it)
  • Checking the box shows a security warning dialog (Warning icon, Yes/Cancel with Cancel default)
  • Warning text covers: what it does, PII risks, user responsibilities, and sharing restrictions
  • _update_retain_description_visibility() refreshes on table edits and dialog open
  • _update_retain_description_status() appends [Retain descriptions: ON] to the status label
  • retain_descriptions threaded through _AnonymiseWorker to bsa.anonymise_pdf() for both single-file and batch modes

test_anonymise_retain_descriptions.py (new — 15 tests)

  • Worker parameter threading (single + batch)
  • AlwaysAnonymiseConfig TOML loading
  • Visibility logic (hidden when empty, visible with data, unchecked when cleared)
  • Status label marker appending and stripping

Closes

Closes #134

- 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
@boscorat boscorat linked an issue Aug 8, 2026 that may be closed by this pull request
@github-actions

github-actions Bot commented Aug 8, 2026

Copy link
Copy Markdown

Documentation reminder

The following view file(s) were modified in this PR:

src/openstan/views/anonymise_dialog.py

Please review and update the relevant pages in docs/screens/ before merging.

If the UI has visually changed, capture a new screenshot for the affected screen(s) and commit it to docs/assets/screenshots/. See docs/assets/screenshots/SCREENSHOTS.md for the filename, required app state, and capture instructions for each screen.

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 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_descriptions flag through AnonymisePresenter_AnonymiseWorkerbsa.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.

Comment thread src/openstan/views/anonymise_dialog.py
Comment thread src/openstan/presenters/anonymise_presenter.py Outdated
Jason Farrar and others added 2 commits August 8, 2026 16:08
- 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>
@boscorat
boscorat merged commit 1fd1677 into master Aug 8, 2026
2 checks passed
@boscorat
boscorat deleted the 134-enhancement-anonymiser-improvements branch August 8, 2026 16:33
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.

Enhancement: Anonymiser improvements

2 participants