Spaces:
Running
Running
File size: 6,600 Bytes
53bf340 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | # SCRUB-WP_BASIC_MODE_DECLUTTER_CONTRACTS
Status: contract-tests-only boundary document.
Repository: `solidprivacy-nl/scrub`
## Purpose
This document defines the product and safety contracts for the next Basiscontrole declutter implementation.
The goal is to make `Basiscontrole` materially cleaner than the current first mode-split implementation while preserving `Expertcontrole` as the full review, audit and troubleshooting surface.
This package does not implement UI changes. A later implementation requires a separate workpackage.
## Product thesis
```text
Basiscontrole is not weaker review.
Basiscontrole is lower cognitive load with the same safety boundaries.
Expertcontrole preserves the full review/audit machinery.
```
Basiscontrole should reduce visible complexity. It must not weaken privacy, review, export, Scrub Key, reinsert, audit or document-hygiene controls.
## Basiscontrole target
Basiscontrole must remain the default selected review mode.
The mode state key must remain:
```text
solidprivacy_review_mode
```
The primary visible flow should remain:
```text
1. Voeg document of tekst toe
2. Controleer resultaat
3. Exporteer resultaat / Download veilig
```
Under `2. Controleer resultaat`, Basiscontrole should keep the practical essentials visible or near-visible:
- `Controleweergave`;
- `Basiscontrole` / `Expertcontrole`;
- side-by-side review;
- `Markeringen tonen`;
- short instruction copy;
- replacement count;
- `Gemiste waarde toevoegen`;
- one compact correction/detail path such as `Details aanpassen`;
- primary document downloads.
The replacement table remains the internal source of truth and fallback. It should remain reachable in Basiscontrole, but it should not dominate the default visual path.
## Basiscontrole declutter contract
Basiscontrole should avoid showing the full expert expander stack as equally prominent top-level controls.
The following should not all remain equally prominent in Basiscontrole:
- `Waarom controleren?`;
- `Extra controlehulpen`;
- `Mogelijk extra te controleren waarden`;
- `Geavanceerde details bij de vervangtabel`;
- `Stap voor stap controleren`;
- `Herbruikbare vervangingen`;
- `Technische informatie`;
- `Geavanceerde herkenningsdetails`.
Acceptable Basiscontrole approaches:
- show only a smaller correction path such as `Details aanpassen`;
- keep `Gemiste waarde toevoegen` visible or immediately reachable;
- keep `Vervangtabel controleren` reachable through the correction path;
- show candidate-warning controls only when candidate rows exist;
- keep Scrub Key and audit downloads available but secondary;
- keep technical/advanced details primarily in Expertcontrole.
## Expertcontrole preservation contract
When `Expertcontrole` is selected, the full detailed machinery must remain available:
- `Waarom controleren?`;
- `Gemiste waarde toevoegen`;
- `Extra controlehulpen`;
- `Mogelijk extra te controleren waarden`;
- `Vervangtabel controleren`;
- `Geavanceerde details bij de vervangtabel`;
- `Stap voor stap controleren`;
- `Herbruikbare vervangingen`;
- `Scrub Key downloaden`;
- `Audit en technische bestanden`;
- `DOCX hygiene audit`;
- `Technische informatie`;
- `Geavanceerde herkenningsdetails`.
Expertcontrole may remain more technical. It must not be stripped down as part of Basiscontrole decluttering.
## Mode-switch and session-state contract
Switching modes must not reset:
- uploaded text;
- uploaded file;
- recognized replacements;
- manual additions;
- replacement decisions;
- download outputs;
- session state needed for the active document.
A later implementation should capture the review-surface return value in `presidio_streamlit.py`, for example:
```python
side_by_side_review_state = render_side_by_side_review_panel(
source_text=st_text,
edited_replacements_df=replacement_editor_df,
)
review_mode = side_by_side_review_state.get("review_mode", "Basiscontrole")
is_expert_review = review_mode == "Expertcontrole"
```
The mode flag may control visibility and grouping only. It must not control recognition, replacement construction, export payloads, Scrub Key JSON, reinsert behavior or audit generation.
## Streamlit implementation constraints
Do not introduce nested expanders.
A later implementation must not put existing `st.expander(...)` blocks inside a parent `st.expander(...)`.
Allowed approaches:
- conditionally render fewer top-level expanders in Basiscontrole;
- rename a top-level expander in Basiscontrole, for example `Details aanpassen — vervangtabel`;
- keep expert-only controls as top-level expanders only when Expertcontrole is selected;
- use simple headings/captions above grouped controls;
- use tabs only if they do not introduce state loss or visual confusion.
Do not introduce a parent `Meer controleopties` expander containing other expanders.
## Safety boundaries
A later implementation must not change:
- replacement logic;
- review table data semantics;
- include/remember/find/replace_with meaning;
- export content;
- download filenames;
- download MIME types;
- Scrub Key JSON semantics;
- Scrub Key warning meaning;
- reinsert behavior;
- recognizer logic;
- benchmark logic;
- DOCX/PDF parsing behavior;
- runtime/startup behavior;
- dependencies.
A later implementation must not introduce:
- cloud processing;
- AI processing;
- OCR;
- restored PDF promise;
- PDF-to-DOCX reconstruction;
- click-to-mark;
- advanced editor;
- full-document marking;
- hidden export gate;
- old replacement decision helper panel.
## Required app verification checklist for later implementation
When a later implementation changes UI behavior, live app verification must confirm:
1. App starts without Script execution error.
2. Basiscontrole is selected by default.
3. Basiscontrole is visibly cleaner than before.
4. Side-by-side review remains visible.
5. `Markeringen tonen` remains visible.
6. `Gemiste waarde toevoegen` remains reachable.
7. `Vervangtabel controleren` / `Details aanpassen` remains reachable.
8. Expertcontrole exposes the full detailed controls.
9. Step-by-step review remains reachable in Expertcontrole.
10. Scrub Key download remains separated and warning-protected.
11. Primary document downloads remain visible.
12. Audit/technical downloads remain available.
13. DOCX hygiene audit remains available when relevant.
14. No visible export, Scrub Key or reinsert regression appears.
## Next package
The next implementation package may be:
```text
SCRUB-WP_BASIC_MODE_DECLUTTER_IMPLEMENTATION
```
Only start implementation after these contract tests are accepted and merged.
|