The bernstein gate verify command verifies signed adjudication records for phase-gate boundaries. It recomputes inputs_hash from claimed inputs and confirms the panel saw exactly those inputs, then verifies the record is anchored in a verified lineage spine.
def _lineage_root(workdir: Path) -> Path:
return workdir / ".sdd" / "lineage"Returns the path to the lineage directory under the given workdir.
Main command implementation:
root = Path(workdir).resolve()- converts workdir to absolute pathlineage_root = _lineage_root(root)- gets lineage dir under resolved workdirclaimed = json.loads(Path(inputs_file).read_text(encoding="utf-8"))- reads claimed inputs- Reads adjudication records from lineage root
- Verifies each record against claimed inputs
- The
workdirparameter (from--workdiroption, default ".") is resolved to an absolute path using.resolve() - All lineage-related paths are derived from this resolved workdir path
- The inputs file path is used as provided (but validated to exist by click.Path)
✅ Worktree-safe: The command correctly handles worktree scenarios because:
- It uses the provided workdir parameter (not a hardcoded path)
- It resolves workdir to absolute path before deriving other paths
- Lineage root is correctly located at
{workdir}/.sdd/lineage - No hardcoded paths point to the main project location
From within worktree at /work/proj/.sdd/worktrees/backend-072bd1f9:
# Correct - uses worktree's lineage
bernstein gate verify <run> --inputs inputs.json --workdir .
# Also correct - explicit worktree path
bernstein gate verify <run> --inputs inputs.json --workdir /work/proj/.sdd/worktrees/backend-072bd1f9
# Correct but different - uses main project's lineage
bernstein gate verify <run> --inputs inputs.json --workdir /work/projUnit tests in tests/unit/cli/test_gate_cmd.py show proper usage:
- Both
inputs_fileandworkdirare passed as paths relative totmp_path(test worktree root) - Command correctly locates records in
{workdir}/.sdd/lineage - No test failures indicating path resolution issues
The gate command implementation does not contain path resolution logic that would incorrectly look up fixture files at /work/proj/ instead of the worktree root. It properly uses the provided workdir parameter to locate all relevant files and directories, making it compatible with git worktrees when used with appropriate --workdir values.