Spaces:
Sleeping
Sleeping
solidprivacy-nl commited on
Commit ·
5854dbf
1
Parent(s): 9209a7a
Add v13.3 deterministic reinsert helper handover
Browse files
handover/workpackages/20260607_1745_v13_3_reinsert_helper.md
ADDED
|
@@ -0,0 +1,145 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Handover — WP7A — v13.3 Deterministic reinsert helper, pure helper and tests
|
| 2 |
+
|
| 3 |
+
Repository: solidprivacy-nl/scrub
|
| 4 |
+
Workpackage title: WP7A — v13.3 Deterministic reinsert helper, pure helper and tests
|
| 5 |
+
Status: implemented; awaiting GitHub Actions and Hugging Face sync
|
| 6 |
+
|
| 7 |
+
## Summary
|
| 8 |
+
|
| 9 |
+
WP7A adds the deterministic reinsert helper layer for the future local reinsert workflow.
|
| 10 |
+
|
| 11 |
+
The helper was already present on `main` during this worker session, so this worker did not overwrite the implementation. This worker inspected the existing files, validated the helper behavior on a reconstructed local subset, and updated project control documentation plus this handover.
|
| 12 |
+
|
| 13 |
+
The helper supports the future workflow:
|
| 14 |
+
|
| 15 |
+
```text
|
| 16 |
+
Scrub → Review → Scrub Key → AI → Reinsert → Export → Audit
|
| 17 |
+
```
|
| 18 |
+
|
| 19 |
+
This workpackage remains helper-only. It does not add UI and does not call AI.
|
| 20 |
+
|
| 21 |
+
## Files added
|
| 22 |
+
|
| 23 |
+
- `handover/workpackages/20260607_1745_v13_3_reinsert_helper.md`
|
| 24 |
+
|
| 25 |
+
## Files changed
|
| 26 |
+
|
| 27 |
+
- `WORKPACKAGES.md`
|
| 28 |
+
- `CHANGELOG.md`
|
| 29 |
+
|
| 30 |
+
## Existing implementation files inspected
|
| 31 |
+
|
| 32 |
+
- `scrub_key_reinsert.py`
|
| 33 |
+
- `tests/test_scrub_key_reinsert.py`
|
| 34 |
+
- `SCRUB_KEY_SPEC.md`
|
| 35 |
+
- `scrub_key.py`
|
| 36 |
+
- `scrub_key_import.py`
|
| 37 |
+
- `tests/test_scrub_key.py`
|
| 38 |
+
- `tests/test_scrub_key_import.py`
|
| 39 |
+
|
| 40 |
+
## Implemented helper behavior
|
| 41 |
+
|
| 42 |
+
Existing `scrub_key_reinsert.py` provides:
|
| 43 |
+
|
| 44 |
+
- `detect_placeholders(text)` for conservative placeholder-token detection.
|
| 45 |
+
- `build_reinsert_mapping(scrub_key)` for deterministic placeholder-to-original mapping.
|
| 46 |
+
- `reinsert_from_scrub_key(text, scrub_key)` for returning reinserted text plus an audit summary.
|
| 47 |
+
|
| 48 |
+
Behavior covered:
|
| 49 |
+
|
| 50 |
+
- Valid Scrub Keys can reinsert original values into scrubbed text.
|
| 51 |
+
- Invalid Scrub Keys return validation issues and do not modify text.
|
| 52 |
+
- Duplicate placeholders are detected and excluded from ambiguous reinsertion.
|
| 53 |
+
- Excluded Scrub Key items are ignored even if present in malformed/imported key data.
|
| 54 |
+
- Unknown placeholders in text are reported.
|
| 55 |
+
- Placeholders from the key that are not found in text are reported.
|
| 56 |
+
- Audit summary includes item counts, replacement count, missing placeholders, unknown placeholders, duplicate placeholders, validation issues and reinsert status.
|
| 57 |
+
- Output explicitly records local/no-AI/no-cloud behavior.
|
| 58 |
+
|
| 59 |
+
## Tests
|
| 60 |
+
|
| 61 |
+
Existing tests inspected:
|
| 62 |
+
|
| 63 |
+
- `tests/test_scrub_key_reinsert.py`
|
| 64 |
+
|
| 65 |
+
Test coverage includes:
|
| 66 |
+
|
| 67 |
+
- valid reinsert with one placeholder;
|
| 68 |
+
- valid reinsert with multiple placeholders;
|
| 69 |
+
- repeated placeholder occurrences in text;
|
| 70 |
+
- placeholder from key not found in text;
|
| 71 |
+
- unknown placeholder in text not present in key;
|
| 72 |
+
- invalid Scrub Key validation issues;
|
| 73 |
+
- duplicate placeholder detection;
|
| 74 |
+
- excluded rows not being reinserted;
|
| 75 |
+
- synthetic Dutch legal values only;
|
| 76 |
+
- input Scrub Key immutability;
|
| 77 |
+
- explicit no-AI/no-cloud flags;
|
| 78 |
+
- deterministic placeholder detection.
|
| 79 |
+
|
| 80 |
+
## Validation status
|
| 81 |
+
|
| 82 |
+
Local targeted validation in this worker environment passed on the available/reconstructed subset:
|
| 83 |
+
|
| 84 |
+
```bash
|
| 85 |
+
PYTHONPATH=. pytest -q tests/test_scrub_key.py tests/test_scrub_key_import.py tests/test_scrub_key_reinsert.py
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
+
Result:
|
| 89 |
+
|
| 90 |
+
```text
|
| 91 |
+
25 passed
|
| 92 |
+
```
|
| 93 |
+
|
| 94 |
+
Full repository test suite was not run in this connector environment.
|
| 95 |
+
|
| 96 |
+
## GitHub Actions status
|
| 97 |
+
|
| 98 |
+
Pending for the latest WP7A documentation/status commit line.
|
| 99 |
+
|
| 100 |
+
Existing implementation commits already present on `main` before this worker updated documentation:
|
| 101 |
+
|
| 102 |
+
- `2f230019de017b80bed42c539fda0d64314338a8` — Add deterministic Scrub Key reinsert helper.
|
| 103 |
+
- `1b58ecf483ba98c3121a059e2c52ca13c3c45d29` — Add deterministic reinsert helper tests.
|
| 104 |
+
|
| 105 |
+
Documentation/status commits from this worker:
|
| 106 |
+
|
| 107 |
+
- `8d8bc75edcbe482149e4843b2c686bbc75e14681` — Record WP7A reinsert helper validation.
|
| 108 |
+
- `9209a7a717e0f93781d933e37b82a7ed08e2997b` — Record WP7A reinsert helper validation in changelog.
|
| 109 |
+
|
| 110 |
+
## Hugging Face sync status
|
| 111 |
+
|
| 112 |
+
Pending for the latest WP7A documentation/status commit line.
|
| 113 |
+
|
| 114 |
+
No app behavior changed in this workpackage, so Hugging Face app verification is not required for helper behavior, but sync should still be checked as part of project hygiene.
|
| 115 |
+
|
| 116 |
+
## App verification status
|
| 117 |
+
|
| 118 |
+
Not applicable.
|
| 119 |
+
|
| 120 |
+
No UI was added or changed.
|
| 121 |
+
|
| 122 |
+
## Boundaries preserved
|
| 123 |
+
|
| 124 |
+
- No UI added.
|
| 125 |
+
- No edit to `presidio_streamlit.py`.
|
| 126 |
+
- No edit to `fix_streamlit_nested_expanders.py`.
|
| 127 |
+
- No AI calls.
|
| 128 |
+
- No cloud processing.
|
| 129 |
+
- No automatic document rehydration.
|
| 130 |
+
- No TXT, CSV, DOCX or PDF export behavior changes.
|
| 131 |
+
- No Scrub Key export behavior changes.
|
| 132 |
+
- No Scrub Key import UI behavior changes.
|
| 133 |
+
- No secrets, tokens or real personal data stored.
|
| 134 |
+
- Synthetic test data only.
|
| 135 |
+
|
| 136 |
+
## Remaining risks
|
| 137 |
+
|
| 138 |
+
- GitHub Actions and Hugging Face sync still need external verification for the latest WP7A documentation/status commits.
|
| 139 |
+
- Reinsert UI is not implemented yet.
|
| 140 |
+
- AI-output reinsert is not implemented yet and should remain a separately reviewed workflow.
|
| 141 |
+
- A Scrub Key remains sensitive because it makes scrubbed values reversible.
|
| 142 |
+
|
| 143 |
+
## Next recommended step
|
| 144 |
+
|
| 145 |
+
Verify GitHub Actions and Hugging Face sync for WP7A. After green checks, close WP7A. Then plan a separate v13.3 UI workpackage only after the helper is externally verified.
|