Add Technical_Decomp_Diff

Miguel Jacq 2025-12-27 20:37:34 -06:00
parent b900873405
commit bd62c814c5

30
Technical_Decomp_Diff.md Normal file

@ -0,0 +1,30 @@
## enroll/diff.py
### BundleRef (dataclass)
Purpose: represents a prepared harvest bundle that diff can read from.
#### Fields:
`dir`: Path: directory containing at least `state.json` and (optionally) artifacts/
`tempdir`: Optional[tempfile.TemporaryDirectory]: Set only when the bundle had to be extracted/decrypted into a temporary directory. Lets the caller clean up later
#### Property:
`state_path` -> Path: dir / "state.json"
#### Lifecycle / where its used:
Constructed by _bundle_from_input(path, sops_mode=...) which accepts:
- bundle directory
- direct state.json path
- .tar.gz/.tgz
- .sops encrypted tarball (or when --sops is enabled)
`compare_harvests()` uses `ExitStack` to ensure any `tempdir.cleanup()` happens.
#### Key design detail:
This class is the bridge between "user supplied something" and “we have a real directory with files”.