gunk-dev/the-valley
the-valley:oc-d28b43aoutcomeopen

Approvals carry across a rebase that leaves the delta unchanged

State
free to start
Created
2026-10-17 by contributor
Source
2026-10-13, change-identity-design.md §4

Body

### 4. Approvals carry across clean rebases

The operator, 2026-10-13: an approval binds the change and carries across clean rebases. Rev 2 listed the prerequisites: a delta with a real security definition, output verification, and semantic limits. This section meets them by defining the delta over **whole files**, which needs no textual-diff semantics at all.

**The delta** of a prepared result R on tip T is the set of paths whose entries differ between T and R. Each path has:
- a **pre-image**: its entry in T, or `absent`;
- a **post-image**: its entry in R, or `absent`.

An entry is `(mode, SHA-256 of the content)`, exactly as in `valley-tree-v1`; a symlink's content is its target. A rename is a deletion plus an addition. Because whole contents are hashed:
- binary content, executable mode, symlink targets, CRLF and final newlines are all bound;
- nothing is positional, so there is no "which occurrence" problem.

**The encoding,** `valley-delta-v1`, is exact and is parsed strictly:
- The digest is SHA-256 over the header line `valley-delta-v1\n`, followed by one line per path.
- Each line is `<len> <path> <pre> <post>\n`, where:
  - `<len>` is the canonical decimal byte length of the path: no sign, no leading zeros;
  - `<path>` is the raw path bytes as git stores them in the tree, and a parser consumes exactly `<len>` bytes of it;
  - each image is `-` or `<mode> <sha256>`. The mode is one of `100644`, `100755` or `120000`, and the hash is 64 lowercase hex digits.
- Paths are unique and sorted bytewise.
- Paths are never cleaned, case-folded or Unicode-normalised before hashing.

**Rejected:**
- submodules;
- other unsupported tree entries;
- duplicate or malformed entries;
- any tree that can't be materialised faithfully on the supported filesystem (case-sensitive Linux), such as a file/directory alias.

A policy may also reject case or Unicode aliases, for checkouts elsewhere.

**Scope.** The digest binds git leaf entries. It doesn't bind ownership, ACLs or other filesystem metadata. It ships with conformance vectors for valid input (renames, mode-only changes, symlinks, deletions, CRLF, paths containing spaces and newlines) and for malformed input.

**What's signed.** The approval statement (§2) binds:
- instance, repository and target;
- the change ID;
- the delta digest;
- the landing-message digest and the change's author fields (name, email, date), which the descriptor gains, because the integrator copies them from the head into the landed commit (`integrator/refs.go:338`);
- the tip and result it was prepared on;
- the policy and registry snapshots;
- the carry mode;
- an expiry.

The change version is bound for audit only.

**The acceptance predicate.** A review recorded on descriptor D₀ (tip T₀, result R₀) counts for the descriptor D₁ being landed (tip T₁, result R₁) only if **all** of these hold. A human approval and an agent review are both reviews.

1. **Only version, tip and result may differ.** Everything else in D₁ equals D₀: instance, repository, target, change ID, delta digest, landing-message digest, and author fields. A version that changes the message or the author needs a new review, however identical its files.
2. **Output verification.** `delta(T₁, R₁)` equals the approved delta digest:
   - every touched path goes from the approved pre-image to the approved post-image;
   - nothing else in R₁ differs from T₁.

   This proves the touched paths read the same at T₁ as at T₀. It says nothing about what happened to them in between.
3. **Linear history.** T₀ is an ancestor of T₁ on the target's landing history. The interval of landings (T₀, T₁] is what rule 4 inspects.
4. **Carry mode.** The mode is the strictest among all the classes the delta's paths fall in, classified by the policy pinned in rule 5:
   - `exact`: T₁ = T₀.
   - `same-class`: no landing in the interval touched any path in any of those classes.
   - `same-paths`: no further condition.
5. **Same authority inputs.** The policy snapshot and the registry snapshot at T₁ equal D₀'s, and the integrator pins the registry generation it decides under. Either one changing voids every carried review. A policy that changed and changed back still voids them, because rule 4 inspects the interval.
6. **Current eligibility, judged against D₁.**
   - The reviewer is still authorised for the class, and the review hasn't expired or been revoked.
   - The independence rules hold for D₁'s full, immutable, authenticated upload history.
   - An agent reviewer must not be the principal behind any version of the change.
   - In a class that requires an independent human approver, that approver uploaded no version of the change.
   - So a reviewer who later uploads an identical delta loses their carried review.
7. **Blocking verdicts carry too.** Any request-changes that rules 1–6 would carry to D₁ blocks D₁. Only new content, meaning a different delta, moves past it, and the old verdict stays on record.
8. **Checks are separate.** Checks are owed on R₁ and met by evidence over R₁, with the usual pure-check carry-over. A review never stands in for a check.
9. **Trains.**
   - A train approval binds the ordered entries: each entry's change ID, delta digest and predecessor entry.
   - Substitution, skipping and reordering are refused.
   - Every entry must independently pass rules 1–8 against its predecessor's actual result.
   - An entry that changes policy or the registry voids carry for every entry after it (rule 5).

**Policy decides the mode per class.** Classes that change trust set `exact`: the identity registry and grants, `policy/` itself, and `secrets/`. Everything else defaults to **`same-paths`** (the operator, 2026-10-13). A project can set `same-class` or `exact` on any class it knows is sensitive or tightly coupled.

**The semantic limit is stated, not hidden.** An identical delta can acquire a different meaning:
- a caller the approver saw can call a function that another landing changed in a different file;
- a symlink's unchanged target can point at content that changed elsewhere.

`same-class` narrows this within a class. Neither mode protects a dependency that crosses classes. The guards are the checks over R₁, and `exact` where the checks aren't enough. That is a deliberate trade, and the operator has chosen it. **A human approval verifies aligned intent and quality; it is not where bugs are caught.** Checks are. So approvals carry as far as the rules allow, the system favours eventual consistency with fault tolerance, and sensitive areas opt into stricter modes.

**Clean is file-level in v1.** A landing that changed a different part of the same file changes that file's pre-image, so the review doesn't carry. Carrying across non-overlapping edits within one file would need hunk identity, and with it the occurrence problem. It is a possible later refinement, not part of v1.

**Broad-intent delegation stays deferred.** "Approve whatever this change becomes" remains decision 3's separate delegation contract.

Comments

  1. contributor2026-10-17 18:05 UTCedited2026-10-29 01:09 UTC by contributor
    The operator, 2026-10-17: carry modes are project policy, set per class through the-valley policy framework, because they are use-case specific. Initially: same-class for valleyhook/, integrator/, sigverify/ and identity, and for the deployment project's host modules that enforce access; exact for policy, the registry and secrets; same-paths elsewhere. Rule 5 also pins the required check set, unless the policy snapshot covers it. A carried approval records the landings in (T0, T1]. Threat model: restacker-carry-threats.md.
  2. contributor2026-10-17 18:19 UTCedited2026-10-29 01:09 UTC by contributor
    The operator, 2026-10-17: a change to a check implementation (a script behind an unchanged attribute) does not void a carried approval. Check results never carry across changed inputs: the closure digest makes the new check run on the rebased result (attest/inputs.go). The approval verifies intent, and re-reading an unchanged delta says nothing about the new check. A change to policy check declarations still voids carry through rule 5, since the policy digest covers the whole composed policy.
  3. contributor2026-10-18 14:45 UTCedited2026-10-29 01:09 UTC by contributor
    From the coordinator's working file `restacker-carry-threats.md` (moved here 2026-10-18), part 1 of 1:
    
    # Carrying an approval across a restack: threats (2026-10-17)
    
    From a conversation between the coordinator and the operator. Reviews act as a gate on intent, quality and security. Part 3 (`change-identity-design.md` §4) carries an approval only when the rebased result has exactly the approved whole-file delta, message and author fields (rules 1–2). So the change's own content is pinned, and a restack can't alter what the reviewer read. Any altered byte breaks the delta, and the approval doesn't carry. The restacker needs no trust for content.
    
    The risk is what the reviewer never saw: the rest of the tree, which moves between the approved tip T₀ and the landing tip T₁.
    
    ## Quality and security: the reviewer's reasoning rested on files that moved
    
    - **Cross-file meaning.** The reviewer judged a change safe because of code elsewhere, and a landing in the interval changed that code. The delta is the same, but the meaning differs. §4 states this limit, and leaves it to the checks and to stricter modes for sensitive classes.
    - **The checks moved.** A landing in the interval weakens or removes a check the reviewer relied on. The change still requires its checks on R₁, but the check set itself moved. Rule 5 pins the policy and the registry snapshots. Whether it pins the required check set is unconfirmed; if it doesn't, it should, so a change to the checks voids carry the way a policy change does.
    - **Split payloads.** A compromised agent splits something harmful into two changes that look innocent apart, A and B. B is approved while A is pending, then A lands and B's approval carries, so the combination was never seen together. A fresh review wouldn't reliably catch this either, because it shows only B's diff, but carry removes the last chance. `same-class` closes it within a class.
    - **Symlinks.** An unchanged target can point at content that changed elsewhere (stated in §4).
    
    ## Intent: the approval goes stale in meaning
    
    - **Overtaken.** Another landing solved the same problem differently, or reversed the decision behind the change.
    - **Old.** An approval carried across weeks of restacks. The statement's expiry bounds it, and the restacker's per-change cap.
    
    ## Social engineering: approving changed content shouldn't feel routine
    
    - When a restack conflicts and an agent resolves it, the delta changes, so nothing carries. That's correct.
    - The risk is that "restacked, please re-approve" trains the operator to rubber-stamp, while a resolution can carry unrelated edits.
    - **The defence is a clear signal in review:**
      - **clean:** this version has the same delta as the version approved before;
      - otherwise, only what differs from that version, as a range-diff.
    
    ## A compromised restacker
    
    It can add versions, never carried content. Its worst case is denial of service: versions churned up to the cap, or rebases withheld.
    
    ## Decisions (the operator, 2026-10-17)
    
    1. **Part 2 builds `valley-delta-v1` now.**
       - Review says **clean** when a restacked version has the same delta as an approved version, and otherwise shows the range-diff against it.
       - Review also lists the landings between the two bases.
       - This makes re-approval before part 3 a one-look touch, and builds part 3's rule 2 early.
    2. **When an approval carries (part 3),** its decision record lists the landings in the interval (T₀, T₁].
    3. **Pin the required check set** with the policy in rule 5, unless the policy snapshot already covers it.
    4. **Carry modes are project policy.** Each project sets a mode per class through the-valley's policy framework. It's use-case specific, so it isn't a platform constant.
       - **The-valley, initially:**
         - `same-class` for `valleyhook/`, `integrator/`, `sigverify/` and identity;
         - `exact` for policy, the registry and secrets, as §4 already says;
         - `same-paths` for everything else.
       - **The deployment project:** `same-class` for the host modules that enforce access.
    5. **Hook replay verification is cut.** Rule 2 makes restacked content verifiable at carry time, and the clean signal in review covers it before part 3.
    6. **A stale request doesn't hold a change back.** Rebasing it is what lets its approval carry, or, with decision 1, lets the operator re-approve it at a glance.
  4. contributor2026-11-09 22:53 UTC
    Decided 2026-11-09: carry stays defined over whole-file deltas. A restack whose commits are patch-identical, but onto files main also edited, needs a fresh answer, because the same patch can apply at a different place in a file that changed. The moved prompt's in-place [a]pprove (oc-c9fa26c) makes that fresh answer one keypress, with the reason shown.