Skip to content

Commit 3b2f62f

Browse files
committed
feat: add m2 local import context edge integrity dry run
1 parent 987257d commit 3b2f62f

9 files changed

Lines changed: 960 additions & 0 deletions

docs/adr/0012-m2-local-extraction-import-scope.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,3 +577,27 @@ The next allowed step is:
577577
```text
578578
m2_explicit_local_import_context_edge_integrity_dry_run
579579
```
580+
581+
## Explicit Local-Import Context-Edge Integrity Dry-Run
582+
583+
The aggregate-only context-edge integrity dry-run is:
584+
585+
```text
586+
scripts/run_m2_explicit_local_import_context_edge_integrity_dry_run.py
587+
```
588+
589+
It reopens one explicit workspace-private JSON export under
590+
`workspace/local-private/extraction-indexing/input/`, requires the prior envelope, record-shape,
591+
context-edge-shape, and context-edge-reference compatibility gates, and reports only aggregate
592+
self-edge and duplicate-edge counts. Optional redacted output remains private under
593+
`workspace/local-private/extraction-indexing/import/context-edge-integrity/`.
594+
595+
The helper does not emit ids, relation values, duplicate tuples, source text, paths, filenames,
596+
hashes, logs, payloads, or runtime evidence. It does not map retrieval buckets, import a DB,
597+
construct an index, construct a graph, or complete any original M2 criterion.
598+
599+
The next allowed step is:
600+
601+
```text
602+
m2_explicit_local_import_context_edge_integrity_dry_run_review_gate
603+
```

docs/devlog/DECISIONS_PENDING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Decisions Pending
22

3+
- The M2 explicit local-import context-edge integrity dry-run is implemented. Add
4+
`m2_explicit_local_import_context_edge_integrity_dry_run_review_gate` next using redacted
5+
summary evidence only.
6+
- Keep selected-export reopening during review, id emission, relation emission, duplicate tuple
7+
emission, retrieval-bucket mapping, real DB import, line-index construction, context-graph
8+
construction, and every original M2 completion flag false.
39
- The M2 explicit local-import context-edge integrity contract is defined. Implement
410
`m2_explicit_local_import_context_edge_integrity_dry_run` next as an aggregate-only dry-run.
511
- Keep id emission, id normalization, id hashing, relation emission, retrieval-bucket mapping,

docs/devlog/KNOWN_RISKS.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Known Risks
22

3+
- The M2 explicit local-import context-edge integrity dry-run reopens one explicit private UTF-8
4+
JSON export, decodes it with no size cap, and counts self-edge and duplicate-edge occurrences in
5+
memory. A large selected file may consume substantial memory.
6+
- The dry-run output is aggregate-only. Do not treat it as permission to emit ids, relation values,
7+
duplicate tuples, source text, paths, filenames, hashes, logs, payloads, or runtime evidence.
8+
- Keep optional context-edge integrity dry-run JSON under
9+
`workspace/local-private/extraction-indexing/import/context-edge-integrity/` and out of tracked
10+
files, chat, reports, and commits.
11+
- A future `m2_explicit_local_import_context_edge_integrity_dry_run_review_gate` must read only
12+
redacted integrity summary JSON and must not reopen the selected export.
313
- The M2 explicit local-import context-edge integrity contract is static policy only. Do not
414
describe it as reopening or decoding an export, checking real edges, emitting ids or relation
515
values, mapping retrieval buckets, importing a DB, building an index, or constructing a graph.

docs/devlog/NEXT_ACTIONS.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Next Actions
22

3+
After the original M2 explicit local-import context-edge integrity dry-run:
4+
5+
1. Treat `scripts/run_m2_explicit_local_import_context_edge_integrity_dry_run.py` as the
6+
aggregate-only self-edge and duplicate-edge dry-run over one explicit workspace-private export.
7+
2. Keep ids, relation values, duplicate tuples, source text, paths, filenames, hashes, logs,
8+
payloads, and runtime evidence out of stdout, output JSON, tracked files, reports, and commits.
9+
3. Keep retrieval-bucket mapping, real DB import, line-index construction, context-graph
10+
construction, and every original M2 completion flag blocked.
11+
4. Add only a redacted review gate for the integrity summary next.
12+
13+
Recommended next safe step:
14+
15+
- Implement `m2_explicit_local_import_context_edge_integrity_dry_run_review_gate`.
16+
17+
---
18+
319
After the original M2 explicit local-import context-edge integrity contract:
420

521
1. Treat `docs/m2-explicit-local-import-context-edge-integrity-contract.md`,

docs/devlog/SESSION_SUMMARY.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
# Session Summary
22

3+
Original M2 explicit local-import context-edge integrity dry-run is implemented.
4+
5+
Completed in the latest session:
6+
- Added `scripts/run_m2_explicit_local_import_context_edge_integrity_dry_run.py` and
7+
`tests/test_m2_explicit_local_import_context_edge_integrity_dry_run.py`.
8+
- The helper reopens only one explicit workspace-private JSON export and requires the approved
9+
envelope, record-shape, context-edge-shape, and context-edge-reference preconditions.
10+
- The dry-run reports only aggregate `self_edge_count` and `duplicate_edge_count`; record ids,
11+
edge ids, relation values, duplicate tuples, source text, paths, filenames, hashes, logs,
12+
payloads, and runtime evidence remain sealed.
13+
- Optional redacted JSON output is restricted to
14+
`workspace/local-private/extraction-indexing/import/context-edge-integrity/`.
15+
- Wired the temp-workspace self-test into `scripts/check_all.py`.
16+
- Retrieval-bucket mapping, DB import, line-index construction, context-graph construction, and
17+
every original M2 completion flag remain blocked.
18+
- The only approved next step is
19+
`m2_explicit_local_import_context_edge_integrity_dry_run_review_gate`.
20+
21+
---
22+
323
Original M2 explicit local-import context-edge integrity contract is defined.
424

525
Completed in the latest session:

docs/m2-explicit-local-import-context-edge-integrity-contract.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,35 @@ The next allowed step is:
9292
```text
9393
m2_explicit_local_import_context_edge_integrity_dry_run
9494
```
95+
96+
## Context-Edge Integrity Dry-Run
97+
98+
The aggregate-only dry-run helper is:
99+
100+
```text
101+
scripts/run_m2_explicit_local_import_context_edge_integrity_dry_run.py
102+
```
103+
104+
It reopens only one explicit workspace-private JSON export under
105+
`workspace/local-private/extraction-indexing/input/`, verifies the approved envelope,
106+
record-shape, context-edge-shape, and context-edge-reference preconditions, and reports only
107+
aggregate self-edge and duplicate-edge counts. Optional redacted JSON output remains private under
108+
`workspace/local-private/extraction-indexing/import/context-edge-integrity/`.
109+
110+
The dry-run does not emit ids, relation values, duplicate tuples, source text, paths, filenames,
111+
hashes, logs, payloads, or runtime evidence. It does not normalize ids, hash ids, map retrieval
112+
buckets, import a DB, construct a line index, construct a context graph, or complete any original
113+
M2 criterion. It intentionally applies no decode-size cap, matching the earlier explicit private
114+
JSON dry-runs.
115+
116+
Validate the dry-run smoke with:
117+
118+
```powershell
119+
python scripts/run_m2_explicit_local_import_context_edge_integrity_dry_run.py --self-test --quiet
120+
```
121+
122+
The next allowed step is:
123+
124+
```text
125+
m2_explicit_local_import_context_edge_integrity_dry_run_review_gate
126+
```

scripts/check_all.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,15 @@ def main() -> int:
479479
"--quiet",
480480
],
481481
),
482+
(
483+
"M2 explicit local-import context-edge integrity dry-run smoke",
484+
[
485+
sys.executable,
486+
"scripts/run_m2_explicit_local_import_context_edge_integrity_dry_run.py",
487+
"--self-test",
488+
"--quiet",
489+
],
490+
),
482491
(
483492
"BepInEx bridge safety smoke",
484493
[

0 commit comments

Comments
 (0)