vilopa 0.0.1__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.
Files changed (38) hide show
  1. vilopa-0.0.1/.github/workflows/ci.yml +60 -0
  2. vilopa-0.0.1/.github/workflows/release.yml +50 -0
  3. vilopa-0.0.1/.gitignore +10 -0
  4. vilopa-0.0.1/.python-version +1 -0
  5. vilopa-0.0.1/LICENSE +202 -0
  6. vilopa-0.0.1/Makefile +36 -0
  7. vilopa-0.0.1/PKG-INFO +180 -0
  8. vilopa-0.0.1/README.md +163 -0
  9. vilopa-0.0.1/action.yml +43 -0
  10. vilopa-0.0.1/deploy/compose.dev.yml +23 -0
  11. vilopa-0.0.1/docs/adr/0001-postgres-as-the-job-queue.md +35 -0
  12. vilopa-0.0.1/docs/adr/0002-hmac-principals.md +36 -0
  13. vilopa-0.0.1/docs/adr/0003-no-llm-in-the-deletion-path.md +36 -0
  14. vilopa-0.0.1/docs/dpdp-for-engineers.md +31 -0
  15. vilopa-0.0.1/examples/bharat-bazaar/datamap.yaml +105 -0
  16. vilopa-0.0.1/examples/bharat-bazaar/schema.sql +119 -0
  17. vilopa-0.0.1/examples/bharat-bazaar/seed.py +371 -0
  18. vilopa-0.0.1/pyproject.toml +61 -0
  19. vilopa-0.0.1/schemas/datamap.schema.json +359 -0
  20. vilopa-0.0.1/src/mita/__init__.py +5 -0
  21. vilopa-0.0.1/src/mita/cli.py +220 -0
  22. vilopa-0.0.1/src/mita/connectors/__init__.py +0 -0
  23. vilopa-0.0.1/src/mita/connectors/postgres.py +101 -0
  24. vilopa-0.0.1/src/mita/core/__init__.py +0 -0
  25. vilopa-0.0.1/src/mita/core/catalog.py +21 -0
  26. vilopa-0.0.1/src/mita/core/datamap.py +321 -0
  27. vilopa-0.0.1/src/mita/core/detect.py +336 -0
  28. vilopa-0.0.1/src/mita/core/lint.py +136 -0
  29. vilopa-0.0.1/tests/conftest.py +51 -0
  30. vilopa-0.0.1/tests/integration/test_scan_db.py +127 -0
  31. vilopa-0.0.1/tests/integration/test_seed_db.py +42 -0
  32. vilopa-0.0.1/tests/unit/test_cli.py +66 -0
  33. vilopa-0.0.1/tests/unit/test_datamap.py +245 -0
  34. vilopa-0.0.1/tests/unit/test_detect.py +196 -0
  35. vilopa-0.0.1/tests/unit/test_lint.py +132 -0
  36. vilopa-0.0.1/tests/unit/test_schema_file.py +18 -0
  37. vilopa-0.0.1/tests/unit/test_seed.py +115 -0
  38. vilopa-0.0.1/uv.lock +699 -0
@@ -0,0 +1,60 @@
1
+ name: ci
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [main]
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ concurrency:
12
+ group: ci-${{ github.ref }}
13
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
14
+
15
+ jobs:
16
+ check:
17
+ name: lint, types, unit
18
+ runs-on: ubuntu-latest
19
+ timeout-minutes: 10
20
+ steps:
21
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
22
+ with:
23
+ persist-credentials: false
24
+ - uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
25
+ - run: uv sync --locked
26
+ - run: uv run ruff check .
27
+ - run: uv run ruff format --check .
28
+ - run: uv run mypy
29
+ - run: uv run pytest -m "not db"
30
+
31
+ seed:
32
+ name: demo shop seed (Postgres 16)
33
+ runs-on: ubuntu-latest
34
+ timeout-minutes: 10
35
+ services:
36
+ postgres:
37
+ image: postgres:16
38
+ env:
39
+ POSTGRES_USER: mita
40
+ POSTGRES_PASSWORD: mita
41
+ POSTGRES_DB: bharat_bazaar
42
+ ports:
43
+ - 5432:5432
44
+ options: >-
45
+ --health-cmd "pg_isready -U mita -d bharat_bazaar"
46
+ --health-interval 2s --health-timeout 5s --health-retries 20
47
+ env:
48
+ MITA_APP_PG_DSN: postgresql://mita:mita@localhost:5432/bharat_bazaar
49
+ steps:
50
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
51
+ with:
52
+ persist-credentials: false
53
+ - uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
54
+ - run: uv sync --locked
55
+ - run: uv run python examples/bharat-bazaar/seed.py
56
+ - run: uv run pytest -m db
57
+ - name: lint the demo data map through the GitHub Action
58
+ uses: ./
59
+ with:
60
+ datamap: examples/bharat-bazaar/datamap.yaml
@@ -0,0 +1,50 @@
1
+ name: release
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+
7
+ permissions:
8
+ contents: read
9
+
10
+ jobs:
11
+ build:
12
+ name: build and check
13
+ runs-on: ubuntu-latest
14
+ timeout-minutes: 10
15
+ steps:
16
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
17
+ with:
18
+ persist-credentials: false
19
+ - uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
20
+ - run: uv sync --locked
21
+ - run: uv run ruff check .
22
+ - run: uv run mypy
23
+ - run: uv run pytest -m "not db"
24
+ - name: tag matches the package version
25
+ env:
26
+ TAG: ${{ github.ref_name }}
27
+ run: test "v$(uv version --short)" = "$TAG"
28
+ - run: uv build
29
+ - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
30
+ with:
31
+ name: dist
32
+ path: dist/
33
+
34
+ publish:
35
+ name: publish to PyPI
36
+ needs: build
37
+ runs-on: ubuntu-latest
38
+ timeout-minutes: 10
39
+ # Trusted publishing: PyPI accepts the job's OIDC token, so no API token is stored.
40
+ environment:
41
+ name: pypi
42
+ url: https://pypi.org/p/vilopa
43
+ permissions:
44
+ id-token: write
45
+ steps:
46
+ - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
47
+ with:
48
+ name: dist
49
+ path: dist/
50
+ - uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
@@ -0,0 +1,10 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.py[cod]
4
+ .mypy_cache/
5
+ .pytest_cache/
6
+ .ruff_cache/
7
+ dist/
8
+ build/
9
+ .env
10
+ .env.*
@@ -0,0 +1 @@
1
+ 3.12
vilopa-0.0.1/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
vilopa-0.0.1/Makefile ADDED
@@ -0,0 +1,36 @@
1
+ export MITA_APP_PG_DSN ?= postgresql://mita:mita@127.0.0.1:55432/bharat_bazaar
2
+ COMPOSE := docker compose -f deploy/compose.dev.yml
3
+
4
+ .PHONY: dev down seed test-fast test-db lint fmt types schema check
5
+
6
+ dev: ## install dependencies and start Postgres
7
+ uv sync
8
+ $(COMPOSE) up -d --wait
9
+
10
+ down:
11
+ $(COMPOSE) down
12
+
13
+ seed: ## load the demo shop into the dev database
14
+ uv run python examples/bharat-bazaar/seed.py
15
+
16
+ test-fast: ## unit tests, no database
17
+ uv run pytest -m "not db"
18
+
19
+ test-db: ## integration tests against the dev database
20
+ uv run pytest -m db
21
+
22
+ lint:
23
+ uv run ruff check .
24
+ uv run ruff format --check .
25
+
26
+ fmt:
27
+ uv run ruff format .
28
+ uv run ruff check --fix .
29
+
30
+ types:
31
+ uv run mypy
32
+
33
+ schema: ## regenerate the committed data map JSON Schema
34
+ uv run mita datamap schema > schemas/datamap.schema.json
35
+
36
+ check: lint types test-fast
vilopa-0.0.1/PKG-INFO ADDED
@@ -0,0 +1,180 @@
1
+ Metadata-Version: 2.5
2
+ Name: vilopa
3
+ Version: 0.0.1
4
+ Summary: Execute and verify data-erasure and access requests across your databases, storage and SaaS tools. Self-hosted, DPDP-aware.
5
+ Project-URL: Homepage, https://github.com/hrithiknl17/mita
6
+ Project-URL: Issues, https://github.com/hrithiknl17/mita/issues
7
+ Author: Hrithik
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ Keywords: data-erasure,dpdp,gdpr,postgres,privacy-engineering
11
+ Requires-Python: >=3.12
12
+ Requires-Dist: psycopg[binary]>=3.2
13
+ Requires-Dist: pydantic>=2.9
14
+ Requires-Dist: pyyaml>=6.0
15
+ Requires-Dist: typer>=0.12
16
+ Description-Content-Type: text/markdown
17
+
18
+ # mita
19
+
20
+ Delete a person's data from every system you mapped, prove it, and hit the deadline.
21
+ Self-hosted. DPDP-aware. Not legal advice.
22
+
23
+ > **Status: pre-alpha.** mita does not delete anything yet. What exists today: the data map
24
+ > format with a validator, `mita scan` and `mita lint` for finding personal data your map
25
+ > misses, and a demo shop database seeded with canary data for testing erasure. Follow the
26
+ > [roadmap](#roadmap).
27
+
28
+ ## Install
29
+
30
+ ```sh
31
+ pip install vilopa # or: uv tool install vilopa
32
+ ```
33
+
34
+ The package is published as `vilopa`; the command and the import are `mita`.
35
+
36
+ ```sh
37
+ mita --version
38
+ ```
39
+
40
+ ## Why this exists
41
+
42
+ - From May 2027, Indian companies must answer erasure and access requests within a fixed
43
+ deadline and delete personal data once its purpose is served (DPDP Act and Rules).
44
+ - Personal data spreads across your database, file storage and SaaS tools. A hand-written
45
+ delete script does not verify, does not track deadlines, and silently breaks when someone
46
+ adds a new column holding a phone number.
47
+
48
+ ## What it is not
49
+
50
+ - Not a consent manager (see [tsi-dpdp-cms](https://github.com/tsi-coop/tsi-dpdp-cms)).
51
+ - Not legal advice, and not "compliance in a box". Companies are compliant; tools are not.
52
+ - It cannot see copies you did not map, and it cannot rewrite old backups.
53
+
54
+ ## The data map
55
+
56
+ You describe where personal data lives in a YAML file kept in your repo and reviewed in PRs:
57
+
58
+ ```yaml
59
+ principal:
60
+ root: app_pg.public.customers
61
+ keys:
62
+ email: { column: email, normalize: email }
63
+
64
+ tables:
65
+ app_pg.public.invoices:
66
+ erase: retain
67
+ retain:
68
+ reason: Tax invoices must be kept as issued.
69
+ period: P8Y
70
+ from_column: issued_at
71
+ ```
72
+
73
+ See the full demo map in [`examples/bharat-bazaar/datamap.yaml`](examples/bharat-bazaar/datamap.yaml)
74
+ and the JSON Schema in [`schemas/datamap.schema.json`](schemas/datamap.schema.json). Editors with the
75
+ YAML language server get completion and validation from it.
76
+
77
+ ```console
78
+ $ uv run mita datamap validate examples/bharat-bazaar/datamap.yaml
79
+ examples/bharat-bazaar/datamap.yaml: ok (9 tables, 1 connector(s))
80
+ ```
81
+
82
+ ## Finding personal data: `mita scan` and `mita lint`
83
+
84
+ `mita scan` lists the columns of a live Postgres database that look like personal data, from
85
+ their names, types and a sample of their values. It recognises Indian identifiers by shape:
86
+ mobile numbers in any common format, PAN, GSTIN, Aadhaar (with its check digit), UPI IDs and
87
+ PIN codes, as well as emails, IP addresses, and free text with emails or phone numbers inside.
88
+
89
+ ```console
90
+ $ DATABASE_URL=postgresql://... uv run mita scan --connector app_pg
91
+ COLUMN CATEGORY CONFIDENCE WHY
92
+ app_pg.public.customers.email email high name suggests email; 200/200 sampled values look like email
93
+ app_pg.public.customers.pan pan high name suggests pan; 94/94 sampled values look like pan
94
+ app_pg.public.events.properties free_text medium 36/200 sampled values contain an email address or phone number
95
+ app_pg.public.events.ip ip_address high column type is inet
96
+ app_pg.public.products.name name low name suggests name
97
+ ...
98
+ 71 columns scanned, 22 look like personal data (14 high, 6 medium, 2 low)
99
+ ```
100
+
101
+ `mita lint` fails when the database and the map disagree: a column that looks like personal
102
+ data at medium confidence or above is not in the map, or the map names a table or column that
103
+ no longer exists. Columns you reviewed and marked `pii: none` never fail the lint.
104
+
105
+ ```console
106
+ $ uv run mita lint examples/bharat-bazaar/datamap.yaml
107
+ examples/bharat-bazaar/datamap.yaml: error: app_pg.public.customers.alt_mobile: looks like phone (high: name suggests phone); not in the data map
108
+ examples/bharat-bazaar/datamap.yaml: app_pg: 1 error(s), 0 warning(s)
109
+ ```
110
+
111
+ Both connect read-only with a statement timeout, and never print, log or store a sampled
112
+ value: reports carry categories, confidences and counts only. Sampling reads the first rows a
113
+ table returns, not a random sample; `--sample-rows 0` classifies by name and type alone, which
114
+ is what you want against a freshly migrated, empty CI database.
115
+
116
+ ### In CI
117
+
118
+ Run your migrations against a throwaway database, then lint the map in the same job:
119
+
120
+ ```yaml
121
+ - uses: hrithiknl17/mita@v0.0.1 # pin a commit SHA in real use
122
+ env:
123
+ MITA_APP_PG_DSN: postgresql://app:app@localhost:5432/app # the map's dsn_env
124
+ with:
125
+ datamap: privacy/datamap.yaml
126
+ sample-rows: 0
127
+ ```
128
+
129
+ ## Development
130
+
131
+ Needs [uv](https://docs.astral.sh/uv/) and Docker.
132
+
133
+ ```sh
134
+ make dev # uv sync + start Postgres 16 on 127.0.0.1:55432
135
+ make seed # load the Bharat Bazaar demo shop
136
+ make check # ruff, mypy --strict, unit tests
137
+ make test-db # integration tests against the dev database
138
+ ```
139
+
140
+ No `make` (for example on Windows)? The same steps:
141
+
142
+ ```sh
143
+ uv sync
144
+ docker compose -f deploy/compose.dev.yml up -d --wait
145
+ uv run python examples/bharat-bazaar/seed.py
146
+ uv run ruff check . && uv run mypy && uv run pytest -m "not db"
147
+ MITA_APP_PG_DSN=postgresql://mita:mita@127.0.0.1:55432/bharat_bazaar uv run pytest -m db
148
+ ```
149
+
150
+ ### The demo shop and its canaries
151
+
152
+ `examples/bharat-bazaar` is a small Indian e-commerce schema with shapes that make erasure
153
+ hard on purpose: a self-referencing FK, orders kept for accounting, tax invoices that must be
154
+ retained, guest support tickets linked only by email, an analytics table with no foreign key,
155
+ and phone numbers inside free text in four different formats.
156
+
157
+ Every seeded customer carries a unique canary token in their personal fields. The erasure
158
+ tests will check two things: after erasing one customer, their token appears nowhere
159
+ (**canary**), and every other customer's rows are unchanged (**bystander**). The seed is
160
+ deterministic, so failures reproduce.
161
+
162
+ ## Architecture decisions
163
+
164
+ - [0001 Postgres is the job queue](docs/adr/0001-postgres-as-the-job-queue.md)
165
+ - [0002 Principals are stored as keyed hashes](docs/adr/0002-hmac-principals.md)
166
+ - [0003 No language model in the deletion path](docs/adr/0003-no-llm-in-the-deletion-path.md)
167
+
168
+ ## Roadmap
169
+
170
+ 1. ~~**`mita scan` and `mita lint`**~~ (done): find PII-looking columns in a live Postgres
171
+ schema, and fail CI when a migration adds one the data map does not cover. Ships as a
172
+ GitHub Action.
173
+ 2. **`mita plan`**: resolve a person across tables through foreign keys and declared
174
+ relations, order the deletes, and refuse plans that touch too many rows.
175
+ 3. **`mita erase` / `mita access`**: execute, verify, and write an evidence record.
176
+ 4. **Service**: request intake, approvals, deadlines, retention sweeps, connectors.
177
+
178
+ ## License
179
+
180
+ [Apache-2.0](LICENSE)