Slice 2 of touch-signed approvals (parent oc-3bc80df): the host admits one signed approval note per change in project storage, readers recognise the refused-approval outcome, a project can declare that its change records are retained, and the signers publication carries the approval key lists and the instance identity and wakes on every input it publishes. Nothing is enforced and no device is involved. The brief, written against main 5d56575, is the next comment.
Comments
contributor2026-11-14 20:57 UTC
Keep slice 2 separate from slice 3: storage, readers and publication form a deployable compatibility boundary that can be tested without signing devices. Its strongest feature is the separate approval blob, which preserves the existing meaning of integration requests and lets readers ship before enforcement.
Ship approval-ref admission, record-history retention support, `refused-approval` readers, and publication of approval authority and instance identity. These additions are **not built**. Client signing, approve/review lists, landing enforcement, approval consumption and activation stay out. **Implemented:** the statement contains instance, project, target, change, original version/head, observed record commit, principal and issue time; it has no expiry or policy digest. Hardware for every approval is a **deployment choice** through the existing policy switch, not a hardcoded platform restriction.
Store one ordinary signed note directly as a blob at `refs/the-valley/approvals/<target>/<change>`. There is no tree or `approval.note` entry. Resolve the plan’s unspecified `<change>` spelling as `change.RequestName(id)`, matching recorded requests: currently `main/c-<id>`. The statement still contains the bare ID. Use the **implemented** `approval.MaxNote` bound of 2048 bytes; inspect object type and size before reading content. Reject malformed names, symbolic refs, lookalikes, non-blobs and oversized objects. Structural note/statement parsing can reuse `note.Split` and `approval.Parse`; signature authority and landing eligibility remain the gate’s responsibility.
Only a named principal holding `approve`, including its accepted `request` spelling, may create, replace or delete an approval ref. Ownership, ordinary push access and `restack` alone confer none of these powers. Preserve additional protection restrictions. Publication callers must lease creates against absence and replacements/deletions against the observed OID. The hook cannot prove that a client deliberately supplied a lease. Atomic request/approval publication does not prevent subsequent divergence; the future gate must compare signed subjects and verify both refs transactionally.
The record-deletion requirement lacks its configuration mechanism. Add an explicit project declaration, such as `retainChangeRecords`, default false, rendered into the hook’s push policy. When true, refuse deletion even by approve holders; retain existing update-history rules. Future enforcement must require retention. Do not infer it from `approval.hardware`, an approval’s presence or `seq`: those would acquire second meanings. Uninterrupted ready history distinguishes restacking from withdrawal or unreadying. Retention also consumes the existing record-count capacity; document that constraint without adding garbage collection here.
Recognise `refused-approval` in the existing four-field outcome format and expose it through status’s decision mapping, human output and JSON. Updating only the parser can reach status’s unhandled-decision panic. The restacker already holds refusals; add a regression case, not another scheduling rule. Check requests remain requests to build evidence and acquire no approval meaning.
Extend the existing signers tree with separate `100644` entries named `approval-signers`, `approval-signers-hardware` and, as this brief’s concrete naming choice, `instance-id`. Preserve `known-signers`, `integrator-name` and optional `signer-projects`. Validate both approval files with `note.ParseVerifierKeys`; publish their bytes even when they contain zero keys. Explicitly unconfigured authority publishes empty files, removing old authority; configured unreadable or malformed files fail publication visibly. Never substitute known signers or ordinary approval keys for missing hardware authority.
Retain the publisher’s lock, unchanged-tree comparison and leased update. The host publisher writes locally as the Git user; pushes to the publication remain forbidden. Its snapshot informs clients; future enforcement reads local authority independently. The publisher lock does not make the compiler’s separate file replacements atomic, so do not promise a coherent compiler generation.
For identity, resolve the authoritative instance repository’s integrated `refs/heads/main` once, enumerate that commit’s root ancestors and Git object format, and call the **implemented** `approval.InstanceID`. Publish its 64 lowercase hexadecimal digits plus newline. Its canonical hash input is `valley-instance-v1\n`, `object-format <format>\n`, then sorted `root <oid>\n` lines. Use sanitized Git execution and reject incomplete/shallow history. This identifies lineage: clones share scope, and integrating an unrelated root changes it. Directory-only policy configuration supplies no identity.
Wire both existing compiler outputs into host publication. Wake publication on either approval file, existing publication inputs, and instance-tip changes, including packed-ref updates; reread durable inputs after waking. Watching only `known-signers` misses approval-only revocations. Add no timer.
Required tests belong in existing checks: hook admission, malformed objects, authorized replacement/deletion, stale leases, atomic rejection and retention refusal in `valleyhook-unit`/`protect-e2e`; refusal parsing/rendering in `rebase-unit`/`valley-go-unit`, with restacker holding in `restack-unit`; publication, empty revocation, unchanged publication, concurrent publishers, identity derivation and reader compatibility in `integrator-unit`/`signers-e2e`; rendered compiler arguments, publisher inputs, watches and retention policy in `module-eval`. Use Go drivers and declarative Nix, not additional Bash logic. No device, expiry or signed-client tests belong here.
Identity compilation, hardware qualification, policy support, registry pinning and the codec/session signer are already implemented. Shared landing preparation is unnecessary. The integrator already has separate input fingerprints and landing transactions; neither belongs in this slice. **Project storage** holds approvals, retained change history and the public verification snapshot because they describe versions or project-wide facts. **The source** holds registry, policy and project declarations. Keep request heads, readiness, sequence numbers and evidence fingerprints unchanged in meaning.
Verified file map, against `5d56575cb86df1ee08d6a49541b30ec229cfe7c5`; tests are specified above, not executed:
Storage: `valleyhook/policy.go:152`, `policy.decide`; `valleyhook/repo.go:388`, `objectStream.read`; add `valleyhook/approval.go` and its tests. `change/id.go:28`, `RequestName`, supplies the canonical request suffix.
Retention: `valleyhook/record.go:185`, `checkRecord`; `schema/valley.cue:41`, `#Project`; `nix/valley-host.nix:1105`, `pushPolicy`.
Readers: `rebase/outcome.go:22`, `ParseOutcome`; `status/status.go:400`, `decide`; `status/render.go:17`, `writeHuman`; `restack/plan.go:193`, `Currency`.
Publication: `integrator/signers.go:77`, `publishSigners`; the same file’s `signersTree` at 149 and `lockSigners` at 193. `status/signers.go:254`, `readSigners`, is the client publication reader; `status/list.go:277`, `instanceOf`, supplies discovery.
Identity: `approval/statement.go:54`, bounds; the same file’s `InstanceID` at 197. `integrator/git.go:57`, `resolveRef`; `integrator/main.go:549`, `gitEnvironment`.
Host wiring: `identity/compile.go:24`, existing output flags; `nix/valley-host.nix:246`, `identityCommand`; `signersCommand` at 288, publisher service at 2765 and path unit at 2807. Update importing modules’ `go.mod` files and their module lists in `nix/packages.nix:150`, 415 and 1056.
Replacements and existing mechanisms: `bin/valley` is replaced by `status/approve.go:692`, `approval.attempt`, with atomic publication at 905; `status/review.go:912`, `review.approve`. Existing integrator mechanisms are `integrator/inputs.go:70`, `inputState`, and `integrator/refs.go:664`, `prepareLanding`.
Verification/documentation: `nix/checks/host-module.nix:666`, `signersPublisher`; `nix/checks/signers.nix:81`, `signers-e2e`. Update `docs/reference.md:2214`, ref layouts and outcome documentation; `docs/architecture.md:162`, publication; `docs/security.md:335`, publication trust. Run `prose-format` and list required checks with `valley checks --names origin/main HEAD`.
The single change that most improves this plan is making publication wake on every input it publishes; otherwise approval-only revocation can leave clients advertising revoked keys indefinitely.
contributor2026-11-14 21:47 UTC
Independent review of head b5d6380 (run 20261114-2057-96ecf164, 44 min, $12.07; 31 files +1073/-176; 43 checks passed in the agent's run). Verdict NOT READY: one blocker (a lost path-unit wake can leave a revoked approval key or an old instance identity published) and three should-fix. Fix round launched: the publisher rereads its inputs after publishing until they match.
NOT READY
Separating storage and readers from enforcement provides a deployable compatibility boundary. Separate approval blobs preserve integration requests’ existing meaning while allowing authority publication to ship independently.
Blocker — nix/valley-host.nix:2851 and integrator/signers.go:151, using new-side diff lines: publication can indefinitely advertise revoked keys. Start the publisher, let it read both approval files, then run a compilation that removes a key before publication finishes. Systemd removes the path watches while the triggered service runs; its completion check does not detect replacements of existing files. The publisher therefore writes the old key and receives no subsequent wake. Later compilations with identical output replace nothing, leaving the stale publication indefinitely. The comment promising another run after the last replacement is false. This follows from systemd’s [path activation and completion handling](https://github.com/systemd/systemd/blob/v258/src/core/path.c#L476-L573). The same lost wake can leave an old instance identity published after main incorporates another root.
Should-fix — status/render.go:82: the suggested remedy cannot work with this slice’s client. Given a current refused-approval outcome, following `valley review` reaches the existing approval path, which publishes requests and evidence but creates no approval note; with unchanged evidence and request, it publishes nothing. Remove the promise that this command supplies the missing approval, and avoid promising future enforcement’s retry behaviour.
Should-fix — integrator/signers_test.go:21: the sequential publication test cannot expose the blocker. Add a deterministic test that changes an authority input after it has been read, while publication remains active, and verifies eventual removal without another unrelated event. Synchronize on events rather than sleeps.
Should-fix — nix/checks/module-eval.sh:100: the new retention assertions add verification logic to Bash despite the brief’s explicit constraint. Put these rendered-policy assertions in the existing declarative Nix checks.
Nits: none.
This was a static review of the supplied diff against the snapshot; tests were not executed.
The single most valuable change is to retain pending input changes throughout publication and reread durable inputs before considering publication caught up.
contributor2026-11-14 22:39 UTC
Recheck of the fix (head 1f1c68a, run 20261114-2147-4ee80e2a, 48 min). Retention rendering: closed. Lock contention: closed. Not closed: a change that lands between the publisher's final matching read and its exit is still missed, because the path unit has no watch while the service runs; a failed reread or the round bound fails the unit visibly but nothing schedules a repair. A tree mixing one old and one new key file can be published briefly and is corrected by the reread. Awaiting the operator's choice between accepting this as a stated limit (the publication informs clients and authorizes nothing; the gate reads local files) and a level-triggered wake.
NOT READY
Rereading catches changes observed during publication, while the lock prevents concurrent publishers from overtaking each other. The retention check inspects the same policy value serialized for the hook.
1. Not closed. Using new-side diff lines: integrator/signers.go:195 reads inputs matching the publication, and :199–200 breaks. Before process exit, the compiler revokes a key, or main incorporates another root. nix/valley-host.nix:2868 still uses PathChanged; systemd has removed its watches while the service runs, and completion does not detect replacement of an existing file. The publisher exits successfully with stale authority and no subsequent wake. [Systemd path lifecycle](https://github.com/systemd/systemd/blob/v258/src/core/path.c)
Read failure: publish the old keys at integrator/signers.go:189, replace the approval file with the revocation, then let the reread fail. Lines :195–197 return immediately, retaining the old publication. integrator/main.go:268–270 reports the error and exits nonzero, so the unit visibly fails; failure does not schedule recovery.
Round bound: change inputs after every round’s read, ending with a revocation after the last read used for publication. integrator/signers.go:202–204 detects the mismatch but leaves the revoked key published and returns an error at :220. The bound is five with both approval files, six with signer-projects—not universally four (:257–264). A subsequent delivered wake repairs either failure with readable, settled inputs; no such wake is guaranteed.
Lock contention: closed for publishers using the same inputs. The second publisher waits at integrator/signers.go:150 and reads only after acquiring the lock (:161), so it repairs changes missed by the first. Its own final-read-to-exit gap remains.
2. A mixed tree remains possible, although rereading did not introduce the underlying race. Read approval-signers A0 at integrator/signers.go:239; the compiler replaces approvals with A1, then hardware signers with H1 (identity/compile.go:105–111); read H1 at integrator/signers.go:242. Publication at :189 exposes A0/H1, although disk states were A0/H0, A1/H0, A1/H1. Correction happens only afterward; a subsequent read failure can leave that tree published. Wrong-file hardware authority: closed—the hardware read uses its own argument (:242), wired to the compiler’s hardware output at nix/valley-host.nix:261 and :311.
3. Closed. nix/valley-host.nix:1147 includes retainChangeRecords=true whenever the project declares true, and :1152 serializes that exact value. The internal option (:2257–2262) exposes it without controlling the hook’s serialization. valleyhook/policy.go:34 reads the boolean, and valleyhook/record.go:195 refuses deletion when true.
The single most valuable change is a persistent watcher that arms watches before reading and retains pending events throughout reconciliation, eliminating the final-read-to-exit handoff.
contributor2026-11-15 02:53 UTC
Operator accepted the publication's missed-wake window as a stated limit (follow-up bd-c23c67b). Docs and comments round (run 20261115-0247-7b7e5d96, 6 min) made the docs say what holds: head 8c039e5, 5 files +53/-41, no behaviour change. Coordinator read the diff against the reviewed head 1f1c68a and marked 8c039e5 ready.
contributor2026-11-15 03:00 UTC
Change valley:the-valley/lqprlzlnrmootxqumrpyltqztpxknqvm landed: v4 as 69d7baef1f04a5306064bd92704f7d837475e57a.
Every change the knot links has landed and it has no active children, so klaus set it done.