datadouble 0.0.5__tar.gz → 0.0.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {datadouble-0.0.5 → datadouble-0.0.6}/PKG-INFO +1 -1
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/run.py +19 -5
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/spec.py +4 -3
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/verify.py +7 -5
- {datadouble-0.0.5 → datadouble-0.0.6}/tests/test_run.py +8 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/.gitignore +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/LICENSE +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/README.md +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/pyproject.toml +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/__init__.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/announce.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/anonymize.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/api.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/boundary.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/catalog.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/channels.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/ci.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/cli.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/closure.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/discover.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/engine.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/files.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/images.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/jailer.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/jsonpath.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/locales/__init__.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/locales/base.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/locales/data/first_names.txt +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/locales/data/sources.txt +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/locales/data/streets.txt +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/locales/data/surnames.txt +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/locales/gb.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/locales/us.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/locales/vocabulary.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/names.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/notify.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/objects.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/outcome.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/pii.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/planner.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/programs.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/progress.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/promote.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/prune.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/py.typed +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/redaction.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/registry.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/replicate.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/resolve.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/runtime.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/secrets.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/settings.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/signing.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/staging.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/storage.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/strict.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/subset.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/src/datadouble/versions.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/tests/conftest.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/tests/fake_engine.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/tests/fakes.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/tests/test_anonymize_pii.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/tests/test_api.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/tests/test_catalog.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/tests/test_ci.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/tests/test_cli.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/tests/test_closure.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/tests/test_commands.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/tests/test_commands_operations.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/tests/test_discover.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/tests/test_extends.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/tests/test_files.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/tests/test_jailer.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/tests/test_jsonpath.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/tests/test_locales.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/tests/test_notify.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/tests/test_objects.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/tests/test_operations.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/tests/test_planner.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/tests/test_programs.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/tests/test_progress.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/tests/test_redaction.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/tests/test_resolve_strict.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/tests/test_runtime.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/tests/test_spec.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/tests/test_storage_images.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/tests/test_subset.py +0 -0
- {datadouble-0.0.5 → datadouble-0.0.6}/tests/test_transform.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: datadouble
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.6
|
|
4
4
|
Summary: Realistic, safe copies of production data for development and testing
|
|
5
5
|
Project-URL: Homepage, https://datadouble.tightlinesoftware.com/
|
|
6
6
|
Project-URL: Source, https://github.com/datadouble/datadouble
|
|
@@ -98,7 +98,13 @@ from datadouble.subset import (
|
|
|
98
98
|
key_conditions,
|
|
99
99
|
nested_conditions,
|
|
100
100
|
)
|
|
101
|
-
from datadouble.verify import
|
|
101
|
+
from datadouble.verify import (
|
|
102
|
+
FormatReport,
|
|
103
|
+
VerificationReport,
|
|
104
|
+
check_image,
|
|
105
|
+
pii_scan,
|
|
106
|
+
restore_failed,
|
|
107
|
+
)
|
|
102
108
|
from datadouble.versions import newest
|
|
103
109
|
|
|
104
110
|
|
|
@@ -833,7 +839,7 @@ class Run:
|
|
|
833
839
|
def verify(
|
|
834
840
|
self, working: WorkingDatabases, planned: Plan, group: PlannedGroup
|
|
835
841
|
) -> VerificationReport:
|
|
836
|
-
"""Restore every format and check it."""
|
|
842
|
+
"""Restore every format and check it, scanning the first for personal data."""
|
|
837
843
|
packaged = self.required(Stage.PACKAGE, group.name)
|
|
838
844
|
transformed = self.required(Stage.TRANSFORM, group.name)
|
|
839
845
|
inputs = {
|
|
@@ -847,6 +853,9 @@ class Run:
|
|
|
847
853
|
|
|
848
854
|
def work(directory: Path) -> dict[str, JsonValue]:
|
|
849
855
|
reports: list[FormatReport] = []
|
|
856
|
+
# Every format holds the same rows, so one scan covers the image
|
|
857
|
+
# (decision 170): the first format that restores is scanned.
|
|
858
|
+
scanned = False
|
|
850
859
|
for archive in _load(tuple[ImageArchive, ...], packaged.outputs["archives"]):
|
|
851
860
|
file = self._dir(Stage.PACKAGE, group.name) / archive.key.rsplit("/", 1)[1]
|
|
852
861
|
scratch = directory / str(archive.format)
|
|
@@ -855,9 +864,14 @@ class Run:
|
|
|
855
864
|
image, _ = unpack(file, scratch / "archive")
|
|
856
865
|
progress.step(f"restoring the {archive.format} format")
|
|
857
866
|
with working.restore(image, archive.format, scratch / "restored") as restored:
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
867
|
+
checked = check_image(planned, group, archive.format, restored, expected)
|
|
868
|
+
if not scanned:
|
|
869
|
+
scan = pii_scan(planned, group, restored)
|
|
870
|
+
checked = checked.model_copy(
|
|
871
|
+
update={"checks": (*checked.checks, *scan)}
|
|
872
|
+
)
|
|
873
|
+
scanned = True
|
|
874
|
+
reports.append(checked)
|
|
861
875
|
except (EngineError, ImageError, OSError) as error:
|
|
862
876
|
reports.append(restore_failed(archive.format, str(error)))
|
|
863
877
|
shutil.rmtree(scratch, ignore_errors=True)
|
|
@@ -1327,9 +1327,10 @@ class Spec(_Model):
|
|
|
1327
1327
|
package: Package = Package()
|
|
1328
1328
|
"""The image formats to produce, and the database accounts built into physical images."""
|
|
1329
1329
|
verify: Verify = Verify()
|
|
1330
|
-
"""Checks every image must pass. Each image must restore,
|
|
1331
|
-
and references must match
|
|
1332
|
-
|
|
1330
|
+
"""Checks every image must pass. Each format of each image must restore,
|
|
1331
|
+
and its row counts and references must match. The PII scan, which runs on
|
|
1332
|
+
the first format that restores, must find nothing it doesn't allow, and
|
|
1333
|
+
every assertion must return no rows. This section sets the PII
|
|
1333
1334
|
scan's allowed values and the assertions. Allowed values under ``files.``
|
|
1334
1335
|
and assertions with ``files: true`` apply to the spec's ``files``, and
|
|
1335
1336
|
the rest to its sources."""
|
|
@@ -4,8 +4,10 @@
|
|
|
4
4
|
"""Verification of a packaged golden image, restored into scratch space.
|
|
5
5
|
|
|
6
6
|
Every format of every image is restored and checked: row counts against the
|
|
7
|
-
working database, references between the image's tables
|
|
8
|
-
|
|
7
|
+
working database, references between the image's tables and the spec's
|
|
8
|
+
assertions. The PII scan of text and JSON columns runs once per image, on the
|
|
9
|
+
first format that restores, since every format holds the same rows
|
|
10
|
+
(decision 170). Reports carry counts, never
|
|
9
11
|
values, so a report never repeats the personal data it found.
|
|
10
12
|
"""
|
|
11
13
|
|
|
@@ -101,13 +103,12 @@ def check_image(
|
|
|
101
103
|
restored: RestoredImage,
|
|
102
104
|
expected: tuple[TableCount, ...],
|
|
103
105
|
) -> FormatReport:
|
|
104
|
-
"""Run every check against a restored format."""
|
|
106
|
+
"""Run every check but the PII scan (``pii_scan``) against a restored format."""
|
|
105
107
|
checks = [Check(kind=CheckKind.RESTORE, name="restore", passed=True)]
|
|
106
108
|
progress.step(f"counting the {image_format} format's rows")
|
|
107
109
|
checks.append(_row_counts(restored, expected))
|
|
108
110
|
progress.step(f"checking the {image_format} format's references")
|
|
109
111
|
checks.extend(_references(plan, group, restored))
|
|
110
|
-
checks.extend(_pii_scan(plan, group, restored))
|
|
111
112
|
if plan.assertions:
|
|
112
113
|
progress.step(f"running {len(plan.assertions)} assertion(s)")
|
|
113
114
|
checks.extend(
|
|
@@ -161,7 +162,8 @@ def _references(plan: Plan, group: PlannedGroup, restored: RestoredImage) -> lis
|
|
|
161
162
|
_SCANNED = (ColumnKind.TEXT, ColumnKind.JSON)
|
|
162
163
|
|
|
163
164
|
|
|
164
|
-
def
|
|
165
|
+
def pii_scan(plan: Plan, group: PlannedGroup, restored: RestoredImage) -> list[Check]:
|
|
166
|
+
"""Scan a restored format's text and JSON columns for personal data."""
|
|
165
167
|
allow: defaultdict[ColumnRef, dict[tuple[str, Detector | None], list[re.Pattern[str]]]]
|
|
166
168
|
allow = defaultdict(dict)
|
|
167
169
|
for rule in plan.pii_allow:
|
|
@@ -203,6 +203,11 @@ def test_a_whole_build(tmp_path: Path, registry: Registry, engine: FakeEngine) -
|
|
|
203
203
|
CheckKind.REFERENCES,
|
|
204
204
|
CheckKind.PII_SCAN,
|
|
205
205
|
}
|
|
206
|
+
# Both formats hold the same rows, so only the first is scanned.
|
|
207
|
+
scanned = {
|
|
208
|
+
r.format: any(c.kind is CheckKind.PII_SCAN for c in r.checks) for r in report.formats
|
|
209
|
+
}
|
|
210
|
+
assert scanned == {ImageFormat.PHYSICAL: True, ImageFormat.LOGICAL: False}
|
|
206
211
|
(summary,) = result.images
|
|
207
212
|
assert summary.identity.engine_version == "1"
|
|
208
213
|
assert summary.server_version == "1.0"
|
|
@@ -357,6 +362,9 @@ verify:
|
|
|
357
362
|
assert failed[(CheckKind.PII_SCAN, "public.users.email")] == "3 value(s) look like email"
|
|
358
363
|
assert failed[(CheckKind.PII_SCAN, "public.comments.body")] == "1 value(s) look like phone"
|
|
359
364
|
assert failed[(CheckKind.ASSERTION, "no early users")] == "1 row(s) returned"
|
|
365
|
+
# The physical format didn't restore, so the logical one was scanned.
|
|
366
|
+
logical = next(r for r in report.formats if r.format is ImageFormat.LOGICAL)
|
|
367
|
+
assert any(c.kind is CheckKind.PII_SCAN for c in logical.checks)
|
|
360
368
|
assert not (tmp_path / "store").exists()
|
|
361
369
|
|
|
362
370
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|