Principle:416rehman DeepZero Corpus Isolation
| Knowledge Sources | |
|---|---|
| Domains | State_Management, Pipeline_Orchestration |
| Last Updated | 2026-10-27 00:00 GMT |
Overview
A work-directory scoping pattern where each run target (corpus) gets an isolated, independently resumable directory under the pipeline root, preventing state collisions between different targets through the same pipeline.
Description
Corpus isolation ensures that different targets processed through the same pipeline never share sample state, reports, or work files. The PipelineDefinition.bind_corpus(target) method computes a corpus_key from the target's resolved path:
- The resolved absolute path is SHA-256 hashed (8 hex chars).
- A readable basename is derived from the path name.
- The corpus key is <basename>-<8hex>, e.g., "driver_pack-abcd1234".
The work directory becomes <work_dir_setting>/<pipeline_name>/<corpus_key>. This means:
- Same target, same pipeline: always maps to the same corpus key, so a re-run resumes in place.
- Different targets, same pipeline: different corpus keys, so runs are isolated.
- Same target at different paths: different resolved paths → different hashes → different corpus keys (no accidental collision).
- Case-insensitive filesystems: on Windows, the path is case-folded before hashing so
C:\Xandc:\xagree.
Usage
This principle is applied automatically by the pipeline loading and CLI. Use it when:
- Running the same pipeline against multiple corpora
- Resumability per-corpus is needed (interrupt one, start another, return to the first)
- Preventing cross-contamination of sample state between targets
Theoretical Basis
# Abstract algorithm (NOT real implementation)
def corpus_segment(target_path):
resolved = target_path.resolve()
key_source = str(resolved).lower() if on_windows else str(resolved)
digest = sha256(key_source.encode()).hexdigest()[:8]
basename = sanitize(resolved.name)[:48] or "corpus"
return f"{basename}-{digest}"
# Work directory: <work_dir>/<pipeline_name>/<corpus_key>
# Same resolved path -> same corpus key -> resume
# Different resolved path -> different corpus key -> isolated