Docs/Reference

Reference

Temporary paths and scratch heaps: block-temporary-path-operations

A gate on reads, edits, writes, notebook changes and saves (tama hook block-temporary-path-operations) that refuses a target in a temporary directory: /tmp, /var/tmp, /var/folders and their /private spellings, $TMPDIR and any path with a component spelled tmp. Each target is judged as written, made absolute against the directory the hook runs in, and with symlinks resolved, so either spelling of a symlinked temporary directory is caught. A target is found in every field a harness names it in: a path field under any of its spellings, a patch's file header, a list of edits, and a target list of bare paths (files: ["<path>"]). The refusal is BLOCKED: Temporary-path Read/Edit/Write/Save operations are not allowed: <targets>.

A gate on reads, edits, writes, notebook changes and saves (tama hook block-temporary-path-operations) that refuses a target in a temporary directory: /tmp, /var/tmp, /var/folders and their /private spellings, $TMPDIR and any path with a component spelled tmp. Each target is judged as written, made absolute against the directory the hook runs in, and with symlinks resolved, so either spelling of a symlinked temporary directory is caught. A target is found in every field a harness names it in: a path field under any of its spellings, a patch's file header, a list of edits, and a target list of bare paths (files: ["<path>"]). The refusal is BLOCKED: Temporary-path Read/Edit/Write/Save operations are not allowed: <targets>.

#Scratch heaps

A write is also refused when it lands in a checkout's scratch heap: an existing top-level directory of the checkout that holds no tracked file (git ls-files lists nothing under it) and that git does not ignore (git check-ignore exits 1). Whatever a session leaves there appears as untracked files in every other session's status and is published by the next broad commit. A run's throwaway state belongs under the checkout's ignored .build/, so the refusal names both: BLOCKED: a write into a checkout directory that is neither source nor its ignored build directory: <target> lands in <checkout>/<directory>, which holds no tracked file and is not ignored; put a run's throwaway state under <checkout>/.build.

These pass: a write into a directory that holds tracked files, into a directory that does not exist yet (new source), to a file at the checkout's root, into .build/ or any other ignored directory, outside every checkout, and every read. A checkout or directory whose state git cannot report is refused with git's answer: BLOCKED: whether <target> lands in a checkout's scratch heap cannot be read: git check-ignore … exited <status>: <git's error>; an ancestor whose .git cannot be examined is refused naming it.

#Where it comes from

Source: rust/crates/tama-hook-tools/src/ports/block_temporary_path_operations/ (scratch_root.rs reads the heap). The journeys cargo test --manifest-path rust/Cargo.toml -p tama-cli --test temporary_path_fields and --test temporary_paths_scratch_heap run the built hook: the first requires a temporary target refused in every field that names it and a relative target whose directory is gone refused naming it; the second builds a real checkout under .build/ and requires a write into its untracked, unignored target/ refused naming target and .build, writes to source, a new directory, the root and .build/ passed, and a read of the heap passed.