Spaces:
Running
Running
solidprivacy-nl commited on
Commit ·
1a8e87e
1
Parent(s): 84f5312
Add deterministic reinsert UI implementation handover
Browse files
handover/workpackages/20260607_1915_v13_3_reinsert_ui_implementation.md
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Handover — WP8B — v13.3 Deterministic reinsert UI implementation
|
| 2 |
+
|
| 3 |
+
Repository: solidprivacy-nl/scrub
|
| 4 |
+
Workpackage title: WP8B — v13.3 Deterministic reinsert UI implementation
|
| 5 |
+
Status: implemented; awaiting GitHub Actions, Hugging Face sync and app verification
|
| 6 |
+
|
| 7 |
+
## Summary
|
| 8 |
+
|
| 9 |
+
Implemented the deterministic local reinsert UI described in `REINSERT_UI_SPEC.md`.
|
| 10 |
+
|
| 11 |
+
The future user flow is now represented in the startup patch:
|
| 12 |
+
|
| 13 |
+
1. User has or loads a Scrub Key.
|
| 14 |
+
2. User pastes scrubbed or AI-generated text.
|
| 15 |
+
3. User explicitly clicks `Zet originele waarden lokaal terug`.
|
| 16 |
+
4. The app calls the verified helper `reinsert_from_scrub_key(...)` locally.
|
| 17 |
+
5. The app shows restored text, an audit summary and a `.txt` download for restored text.
|
| 18 |
+
|
| 19 |
+
This workpackage did not add AI calls, cloud processing, automatic document rehydration or DOCX/PDF reinsert.
|
| 20 |
+
|
| 21 |
+
## Files added
|
| 22 |
+
|
| 23 |
+
- `tests/test_scrub_key_reinsert_ui_patch.py`
|
| 24 |
+
- `handover/workpackages/20260607_1915_v13_3_reinsert_ui_implementation.md`
|
| 25 |
+
|
| 26 |
+
## Files changed
|
| 27 |
+
|
| 28 |
+
- `fix_streamlit_nested_expanders.py`
|
| 29 |
+
- `tests/test_scrub_key_ui_patch.py`
|
| 30 |
+
- `WORKPACKAGES.md`
|
| 31 |
+
- `CHANGELOG.md`
|
| 32 |
+
|
| 33 |
+
## Files intentionally not changed
|
| 34 |
+
|
| 35 |
+
- `presidio_streamlit.py`
|
| 36 |
+
- `scrub_key_reinsert.py`
|
| 37 |
+
- `scrub_key.py`
|
| 38 |
+
- `scrub_key_import.py`
|
| 39 |
+
- existing TXT/CSV/DOCX/PDF export implementation files
|
| 40 |
+
|
| 41 |
+
## Implementation details
|
| 42 |
+
|
| 43 |
+
Added import/wiring:
|
| 44 |
+
|
| 45 |
+
```python
|
| 46 |
+
from scrub_key_reinsert import reinsert_from_scrub_key
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
Added UI section:
|
| 50 |
+
|
| 51 |
+
```text
|
| 52 |
+
Originele waarden terugzetten
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
Added input label:
|
| 56 |
+
|
| 57 |
+
```text
|
| 58 |
+
Plak hier de tekst waarin u originele waarden lokaal wilt terugzetten
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
Added action button:
|
| 62 |
+
|
| 63 |
+
```text
|
| 64 |
+
Zet originele waarden lokaal terug
|
| 65 |
+
```
|
| 66 |
+
|
| 67 |
+
Added output label:
|
| 68 |
+
|
| 69 |
+
```text
|
| 70 |
+
Herstelde tekst
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
Added download button:
|
| 74 |
+
|
| 75 |
+
```text
|
| 76 |
+
Download herstelde tekst (.txt)
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
Added audit summary section:
|
| 80 |
+
|
| 81 |
+
```text
|
| 82 |
+
Controleverslag terugzetten
|
| 83 |
+
```
|
| 84 |
+
|
| 85 |
+
The UI calls:
|
| 86 |
+
|
| 87 |
+
```python
|
| 88 |
+
reinsert_from_scrub_key(reinsert_input_text, active_reinsert_scrub_key)
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
The UI uses `st.session_state["active_scrub_key"]` when a key was imported successfully. If no imported key is active, it falls back to the current Scrub Key built from reviewed replacement rows.
|
| 92 |
+
|
| 93 |
+
## Tests
|
| 94 |
+
|
| 95 |
+
Added:
|
| 96 |
+
|
| 97 |
+
- `tests/test_scrub_key_reinsert_ui_patch.py`
|
| 98 |
+
|
| 99 |
+
Updated:
|
| 100 |
+
|
| 101 |
+
- `tests/test_scrub_key_ui_patch.py`
|
| 102 |
+
|
| 103 |
+
The new/updated tests guard:
|
| 104 |
+
|
| 105 |
+
- `reinsert_from_scrub_key` import and use;
|
| 106 |
+
- required UI labels;
|
| 107 |
+
- warning that restored text may contain personal/confidential data again;
|
| 108 |
+
- local-only/no-AI/no-cloud wording;
|
| 109 |
+
- explicit button-gated helper call;
|
| 110 |
+
- audit summary fields;
|
| 111 |
+
- preservation of existing Scrub Key export/import labels;
|
| 112 |
+
- preservation of existing download/export markers;
|
| 113 |
+
- no `st.stop()` or blocking behavior;
|
| 114 |
+
- no AI calls;
|
| 115 |
+
- no cloud calls;
|
| 116 |
+
- no automatic document rehydration;
|
| 117 |
+
- no DOCX/PDF reinsert markers;
|
| 118 |
+
- no changes to existing replacement application or scrubbed download functions.
|
| 119 |
+
|
| 120 |
+
## Validation status
|
| 121 |
+
|
| 122 |
+
Local targeted validation on a reconstructed subset passed:
|
| 123 |
+
|
| 124 |
+
```bash
|
| 125 |
+
PYTHONPATH=. pytest -q tests/test_scrub_key.py tests/test_scrub_key_import.py tests/test_scrub_key_reinsert.py tests/test_scrub_key_reinsert_ui_patch.py tests/test_scrub_key_import_ui_patch.py tests/test_scrub_key_ui_patch.py
|
| 126 |
+
```
|
| 127 |
+
|
| 128 |
+
Result:
|
| 129 |
+
|
| 130 |
+
```text
|
| 131 |
+
57 passed
|
| 132 |
+
```
|
| 133 |
+
|
| 134 |
+
Full repository test suite was not run from this connector environment.
|
| 135 |
+
|
| 136 |
+
## GitHub Actions status
|
| 137 |
+
|
| 138 |
+
Pending for WP8B commits.
|
| 139 |
+
|
| 140 |
+
Commits created in this workpackage:
|
| 141 |
+
|
| 142 |
+
- `ada543c989f45d083c2b38c8008a9030ce34ca1f` — Add deterministic reinsert UI patch.
|
| 143 |
+
- `22400b7653e4ed9c26fb5da6f89eb8cdbe6a990f` — Add deterministic reinsert UI patch tests.
|
| 144 |
+
- `dfcfc4bc9d23a561a6bfffebb9b53c53cef58b44` — Update Scrub Key UI patch boundary tests for reinsert.
|
| 145 |
+
- `7725182c5d248bfb98f87a04e1c5da6453fdbfa7` — Record deterministic reinsert UI implementation status.
|
| 146 |
+
- `84f531293d26a800faa1e608041f089d6333901f` — Record deterministic reinsert UI implementation.
|
| 147 |
+
|
| 148 |
+
## Hugging Face sync status
|
| 149 |
+
|
| 150 |
+
Pending for WP8B commits.
|
| 151 |
+
|
| 152 |
+
## App verification status
|
| 153 |
+
|
| 154 |
+
Pending.
|
| 155 |
+
|
| 156 |
+
App verification is required because UI behavior changed.
|
| 157 |
+
|
| 158 |
+
The coordinator/user should verify that:
|
| 159 |
+
|
| 160 |
+
- `Originele waarden terugzetten` is visible after the Scrub Key area.
|
| 161 |
+
- User can paste scrubbed or AI-generated text.
|
| 162 |
+
- User can click `Zet originele waarden lokaal terug`.
|
| 163 |
+
- Mapped placeholders are restored locally.
|
| 164 |
+
- `Herstelde tekst` is shown.
|
| 165 |
+
- `Download herstelde tekst (.txt)` works.
|
| 166 |
+
- `Controleverslag terugzetten` is visible.
|
| 167 |
+
- Warning text about restored sensitive/confidential data is visible.
|
| 168 |
+
- Existing `Download Scrub Key (.json)` remains visible.
|
| 169 |
+
- Existing `Scrub Key laden` import/reload remains visible.
|
| 170 |
+
- Existing TXT, CSV, DOCX and PDF scrubbed downloads remain available.
|
| 171 |
+
|
| 172 |
+
## Boundary confirmation
|
| 173 |
+
|
| 174 |
+
Preserved boundaries:
|
| 175 |
+
|
| 176 |
+
- No direct edit to `presidio_streamlit.py`.
|
| 177 |
+
- No edit to `scrub_key_reinsert.py`.
|
| 178 |
+
- No edit to `scrub_key.py`.
|
| 179 |
+
- No edit to `scrub_key_import.py`.
|
| 180 |
+
- No AI calls added.
|
| 181 |
+
- No cloud processing added.
|
| 182 |
+
- No automatic document rehydration added.
|
| 183 |
+
- No DOCX/PDF reinsert added.
|
| 184 |
+
- No TXT, CSV, DOCX or PDF scrubbed export behavior changed.
|
| 185 |
+
- No Scrub Key JSON export behavior intentionally changed.
|
| 186 |
+
- No Scrub Key import/reload behavior intentionally changed except storing the validated imported key in session state for reinsert use.
|
| 187 |
+
- No silent overwrite of existing review rows.
|
| 188 |
+
- No secrets, tokens or real personal data stored.
|
| 189 |
+
|
| 190 |
+
## Remaining risks
|
| 191 |
+
|
| 192 |
+
- UI patch area is still a sensitive sequential integration area.
|
| 193 |
+
- Hugging Face runtime still needs app verification after sync.
|
| 194 |
+
- Restored text may contain personal or confidential information and requires manual review before sharing.
|
| 195 |
+
- AI-output-specific behavior remains future work and should be separately reviewed.
|
| 196 |
+
|
| 197 |
+
## Next recommended step
|
| 198 |
+
|
| 199 |
+
Start WP8C — v13.3 Deterministic reinsert UI verification and closeout:
|
| 200 |
+
|
| 201 |
+
1. Verify GitHub Actions tests for WP8B.
|
| 202 |
+
2. Verify GitHub to Hugging Face sync.
|
| 203 |
+
3. Ask the coordinator/user to verify the app behavior.
|
| 204 |
+
4. Close WP8B only after tests, sync and app verification are green/confirmed.
|