gunk-dev/the-valley

03-verification-and-integration.md

sourcefec8fb9dfaf0main's published tip history
42.2 KiB · Rendered
1# Verification that can travel with a change
2
3The-valley's strongest verification idea is that a check result should remain useful when work moves
4between machines, authors, and integration attempts. A developer should not have to repeat an
5expensive computation merely because another service wants to see it happen. That idea has strong
6foundations in build systems, incremental computation, and database concurrency control. Its
7difficult part is establishing what the computation actually means, who can be trusted to report it,
8and when its result still applies.
9
10This chapter's research conclusion is favorable to portable evidence and selective reuse. It is
11considerably less favorable to treating signed local execution plus eventual auditing as a
12substitute for a protected verification boundary in adversarial settings. Those are separate
13architectural choices. The first does not require the second.
14
15This is a research assessment of repository commit `5bb3a7736fe49b0cc4914299b142c0c9bafb6870`, with
16external sources consulted on 2026-09-20. It is not a change to project policy. **Established
17result** means a result or construction in the cited literature; **documented behavior** means a
18system's published contract; **inference** means this report's reasoning about the-valley;
19**recommendation** means a proposed direction; **hypothesis** means something requiring measurement.
20The [annotated source register](./sources-verification.md) records reading depth and limitations.
21
22## 1. What exists, and what remains a claim
23
24The repository contains substantial verification machinery. The
25[attestation helper](../../attest/run.go) exports a committed tree, runs selected checks, records
26their subjects and results, signs statements, and stores them in Git refs.
27[Verification](../../attest/verify.go) checks statement syntax, schema, signatures, and optionally
28the subject tree. It does not independently execute the claimed check. The
29[integrator](../../integrator/refs.go) computes a candidate landing, derives requirements from its
30own policy sources, gathers evidence, and asks the
31[verdict library](../../integrator/verdict/verdict.go) whether that evidence transfers. Its
32protected-ref update uses compare-and-swap.
33
34The distinction between implementation and aspiration matters. The
35[roadmap](../../design/roadmap.md#phase-6--trust-backstop) places witness rebuilding and the
36transparency log in a later phase. A signed statement about execution is implemented. The inspected
37implementation does not yet provide independent re-verification of those local execution claims. Nor
38is a quantitative assurance level established merely by describing a future trust score.
39
40The current design separates two claims. A pure check claims that a fixed computation over fixed
41inputs produced a result. An effectful check claims that an environment observed a result at a
42particular time. That distinction is valuable. It should be supplemented by several independent
43acceptance questions:
44
45| Question | What can answer it? | What does not answer it? |
46| ------------------------------------------------------------- | ---------------------------------------------------------------------- | --------------------------------- |
47| Are these the bytes the signer signed? | Signature verification and unambiguous encoding | Whether the signer told the truth |
48| Does the evidence describe the required computation? | Binding to the approved definition, inputs, platform, and policy | A familiar check name |
49| Does the required computation support the claimed result? | A trusted execution boundary, independent execution, or suitable proof | A self-reported executable hash |
50| Is that computation an adequate test of the desired property? | Specification, test design, review, and empirical validation | Reproducibility alone |
51| Is accepting it authorized now? | Current authorization and revocation policy | An old valid signature alone |
52
53These are not five competing definitions of trust. They are five obligations that an acceptance
54decision can accidentally collapse into one green result.
55
56A successful independent rerun supports the claimed result under the rerun's assumptions. It does
57not prove that the signer's particular historical execution occurred. A policy concerned only with
58the result may find the rerun sufficient. A policy requiring evidence of who executed what at a
59particular time needs a trustworthy contemporaneous observation as well.
60
61The current implementation is a useful base because it already exposes the subject, predicate,
62signer, and transfer decision separately. The research priority is to make each obligation explicit
63at those existing boundaries, before adding a reputation system whose score might conceal which
64obligation remains unsatisfied.
65
66## 2. When equal inputs justify reusing a result
67
68For a deterministic function, equal inputs imply equal outputs. The engineering work is deciding
69what counts as the function and all its inputs. Consider a check that compiles a package and runs
70its tests. Its inputs include the package source, tests, compiler, libraries, flags, generated data,
71and any runtime behavior on which the answer depends. If the check consults a remote feature flag or
72the host clock, those observations also matter.
73
74Dolstra's Nix thesis gives the foundational approach: describe builds as functions of explicit
75dependencies and identify derivations so their results can be reused and composed. Its discussion of
76purity also recognizes that hashing cannot itself prevent undeclared environmental influence. The
77lesson is an explicit model with stated assumptions, not a proof that every command launched by Nix
78is pure. [V01 — Dolstra, 2006](https://edolstra.github.io/pubs/phd-thesis.pdf)
79
80Three terms need separate meanings. **Hermeticity** restricts what a computation can observe.
81**Determinism** says repeated execution under the specified conditions has the same result.
82**Reproducibility** says another party can recreate the specified artifacts. The Reproducible Builds
83definition deliberately includes source, environment, and instructions, and compares selected
84artifacts rather than every incidental log.
85[V09 — Reproducible Builds definitions](https://reproducible-builds.org/docs/definition/)
86
87A sandbox can improve hermeticity while leaving scheduling nondeterminism. A deterministic program
88can reproducibly calculate the wrong answer. A complete source archive can become impossible to
89rebuild when an essential external input disappears. These are different failure modes and should
90produce different diagnoses.
91
92The empirical evidence supports Nix's practical value without proving universal purity. Malka,
93Zacchiroli, and Zimmermann recreated historical build environments and rebuilt 14,452 of 14,461
94previously successful jobs from one old revision. The experiment reused cached dependencies; it did
95not rebuild the complete historical dependency closure from source. It also left bit-for-bit
96artifact reproducibility outside scope. Its preliminary failure analysis identifies sandbox leakage
97and flaky tests. A rebuild-success percentage must not be presented as a byte-reproducibility
98percentage.
99[V10 — Reproducibility of Build Environments through Space and Time](https://arxiv.org/html/2402.00424v1)
100
101### A concrete limitation of the current digest
102
103The helper's [`drvInputs`](../../attest/check.go) queries direct references of a derivation.
104[`inputsDigest`](../../attest/digest.go) hashes their sorted path strings. Separately, `evalClosure`
105hashes the derivation file. This is a commitment to Nix's symbolic dependency identity. It is not an
106independent observation and hash of every byte actually read during execution.
107
108That distinction does not make the design automatically unsound. A dependency graph can be
109represented transitively by hashes that name other hashed objects. However, correctness then depends
110on what those names guarantee. Nix distinguishes content-addressed store objects from
111input-addressed objects; one must not silently equate a recipe-derived path with a measured
112output-content hash.
113[V06 — Nix content-addressing documentation](https://nix.dev/manual/nix/2.28/store/store-object/content-address)
114
115**Inference:** the reportable claim should be narrower than “the complete observed input closure has
116this digest.” It is “this runner resolved this derivation and these dependency identities.” An
117implementation that wants the stronger claim must establish the store's integrity, the addressing
118modes it permits, the execution restrictions, and the role of substituted dependencies. The output
119digest helps compare outputs. It does not retroactively establish how an untrusted machine produced
120them.
121
122The Nix manual documents configurable sandbox paths, exceptions for fixed-output derivation
123networking, and signature requirements for importing non-content-addressed paths. Those controls
124demonstrate that the daemon configuration and cache trust are part of the execution boundary. They
125cannot be inferred from the word `nix` in a statement.
126[V04 — Nix configuration reference](https://nix.dev/manual/nix/2.28/command-ref/conf-file)
127
128## 3. The closest intellectual relatives are build systems and selective testing
129
130_Build Systems à la Carte_ separates scheduling from deciding whether existing results remain valid.
131It also distinguishes dependencies known before execution from dependencies discovered during
132execution, and traces that validate a result from traces that recover a cached result. This
133vocabulary is directly useful: the-valley's integrator combines an integration scheduler with a
134validator of previously recorded computation. Those components can evolve independently.
135[V02 — Mokhov, Mitchell, and Peyton Jones, 2018](https://www.microsoft.com/en-us/research/uploads/prod/2018/03/build-systems.pdf)
136
137The lesson from self-adjusting computation is that incrementality requires dependency information
138whose collection is itself sound. Acar and colleagues combine recorded dynamic dependencies with
139memoization to update computations after changes. Their results show substantial speedups on
140suitable workloads, alongside tracing and storage costs. They do not establish that an arbitrary
141shell process's reads can be represented cheaply or completely.
142[V03 — Acar et al., 2009](https://www.philinelabs.net/~ktangwon/papers/toplas09.pdf)
143
144Safe regression-test selection asks a closely related question: which old tests must execute again
145after a program changes? Rothermel and Harrold prove safety under explicit conditions, where safety
146means retaining every previously available test capable of exposing a fault in the modified program.
147This does not imply that the available test suite detects every fault. That boundary is especially
148useful for interpreting the-valley's claims about semantic conflicts.
149[V27 — Rothermel and Harrold, 1997](https://www.cs.purdue.edu/homes/xyzhang/spring07/Papers/p173-rothermel.pdf)
150
151**Inference:** the-valley can aim for two progressively stronger statements:
152
1531. Every reused result equals the result that its approved check would produce on the candidate
154 landing.
1552. The approved collection of checks is adequate for the project's acceptance requirements.
156
157The first is an evidence-reuse property. The second is a software-assurance property. A perfect
158implementation of the first leaves the second open. Documentation saying semantic interference is
159“caught by construction” should specify that construction's test coverage and dependency
160assumptions.
161
162### The economic tradeoff is the size of the dependency set
163
164Suppose a spelling check reads all of a repository because its derivation takes the repository root
165as its source. A change to a Go package now changes the spelling check's input identity, even if the
166check examines only Markdown. Reverification is conservative and potentially wasteful. Filtering the
167source set to Markdown can improve reuse, but only if configuration, dictionaries, includes, and
168file discovery remain accounted for.
169
170Conversely, suppose a test enumerates a directory and reads whichever configuration files exist. A
171trace that records only the files opened on the previous run may miss a newly added file. The
172directory listing, including the prior absence of a name, was an input too. “Track files read” is
173not yet a complete dependency model.
174
175Bazel's documentation gives practical examples of hermeticity failures, including host tools,
176timestamps, and writing into the source tree. Its remote cache distinguishes action-result metadata
177from content-addressed output storage. This is relevant prior art for both disciplined dependency
178declarations and the separate trust required in the mapping from an action to its claimed output.
179[V07 — Bazel hermeticity](https://bazel.build/basics/hermeticity),
180[V08 — Bazel remote caching](https://bazel.build/remote/caching)
181
182**Recommendation:** keep conservative whole-check invalidation as the baseline. Introduce finer
183source sets only with tests that attempt to change omitted inputs. Compare saved execution against
184the cost of maintaining those declarations. Precise reuse is valuable when it is demonstrably
185cheaper than rerunning the check; it is not an end in itself.
186
187## 4. A signed executable hash is not evidence that the executable ran
188
189The [verification mechanism stack](../../design/verification.md#the-mechanism-stack) overstates
190several guarantees. These overstatements matter because they concern the adversarial case that local
191verification must eventually address.
192
193Consider this failure trace:
194
1951. An attester has an authorized signing key and control of its own machine.
1962. It computes the expected tree and derivation identifiers without executing the check.
1973. It writes the identifier of the approved attestation tool into a statement.
1984. It invents a passing result and signs the statement directly.
199
200No modified-tool hash must appear. The attacker is choosing the statement's bytes. A verifier learns
201that the key endorsed those bytes, not that the named tool produced them. Local root can likewise
202suppress local observations. A sandbox controlled by the same adversary is not an independent
203observer of that adversary.
204
205This is a protocol-level counterexample, not a claim that the existing operator is malicious. The
206current trust model can be entirely appropriate for an operator's own devices and agents. The
207inaccurate part is claiming that these mechanisms force a malicious signer to leave detectable
208evidence of how it lied.
209
210Hardware-backed remote attestation offers a different trust boundary. The RATS architecture
211separates an attester's evidence, a verifier's appraisal, reference values, and the relying party's
212decision. A protected measurement can support a claim about an execution environment when its
213binding and freshness are established. It still needs an appraisal policy and a trusted measurement
214chain. [V23 — RFC 9334](https://www.rfc-editor.org/rfc/rfc9334.html)
215
216**Recommendation:** keep three deployment profiles conceptually distinct: trusted personal
217attesters; delegated builders whose signing authority is protected from submitted code; and
218independent witnesses that check selected claims. A project may combine them. A numeric score should
219never make the first profile appear cryptographically equivalent to the second.
220
221Independent execution also needs an independence definition. Two witnesses using the same
222compromised compiler or binary cache can agree on a malicious artifact. Thompson's compiler attack
223is the classic illustration of a toolchain reproducing a compromise even when inspected source no
224longer contains it.
225[V24 — Reflections on Trusting Trust](https://www.cs.cmu.edu/~rdriley/487/papers/Thompson_1984_ReflectionsonTrustingTrust.pdf)
226
227The practical requirement is not unlimited diversity at any cost. It is identifying which common
228failures a second witness is intended to exclude: a dishonest author, a corrupted machine, a
229poisoned cache, a compromised compiler, or a flawed test. Each requires a different kind of
230independence.
231
232## 5. What the supply-chain standards already solve
233
234The supply-chain ecosystem contains several distinct layers. Treating them as interchangeable makes
235both adoption and criticism less precise.
236
237| Prior art | Its useful contribution | Its boundary |
238| ----------------- | --------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
239| in-toto | Authorized steps and continuity between their inputs and outputs | Correctness still depends on the authorized process and trust assumptions |
240| in-toto Statement | A subject digest and a typed claim about it | The predicate defines the claim's meaning |
241| DSSE | A signed encoding that binds payload bytes and payload type | An envelope does not evaluate the payload's truth |
242| SLSA Build track | Requirements for provenance generation and builder isolation | A level is about meeting requirements, not counting security mechanisms |
243| Sigstore | Identity-linked signing and transparent signature history | Consumers still decide acceptable identities and claims |
244| TUF | Secure distribution of current trusted metadata despite several compromise and replay threats | It does not execute a build or determine whether a test is adequate |
245
246The in-toto paper is particularly relevant because it treats the connections between steps as
247security-critical. A project layout defines authorized functionaries and artifact rules; signed
248links record their work. This is close to the-valley's desire to compose evidence from multiple
249tools without giving a single forge ownership of the workflow.
250[V15 — Torres-Arias et al., 2019](https://www.usenix.org/system/files/sec19-torres-arias.pdf)
251
252The Statement specification already separates subject from predicate type. Pure verification and
253effectful observation can therefore be different predicates without abandoning interoperability. The
254[current local statement schema](../../schema/attestation.cue) has a similar conceptual separation,
255though its serialized protocol is its own.
256[V16 — in-toto Statement v1](https://in-toto.io/Statement/v1)
257
258DSSE authenticates the payload's exact serialized bytes together with its type, using an unambiguous
259encoding. It does not require all producers to canonicalize an application document into a universal
260byte representation before verifying the supplied bytes. The-valley's text format can still have
261independent benefits for readability and deterministic production; those benefits should justify its
262maintenance cost.
263[V18 — DSSE protocol](https://github.com/secure-systems-lab/dsse/blob/master/protocol.md)
264
265**Recommendation:** preserve a precise internal claim model and implement an explicit interoperable
266representation at the boundary. Re-encoding a statement changes its signed bytes. An adapter should
267either preserve the original signed object or produce a new, clearly attributed statement; it should
268not pretend signatures survive arbitrary translation.
269
270### The SLSA comparison needs correction
271
272The claim of being “roughly SLSA Level 3” is not supported by the mechanism stack. SLSA v1.2 Build
273L3 requires provenance strongly resistant to forgery by tenants, a trusted control plane, protected
274signing material, and build isolation. Its hosted requirement excludes builds on an individual's
275workstation. Reproducibility and periodic sampling do not, by themselves, satisfy those
276requirements. [V17 — SLSA v1.2 build requirements](https://slsa.dev/spec/v1.2/build-requirements)
277
278This is not a reason to imitate a hosted forge. It is a reason to describe the actual trust
279boundary. The-valley could integrate evidence from a conforming builder, and the specification
280allows systems involving independent rebuilders as build platforms. Any level claim would still
281require a concrete mapping of the entire deployment to the requirements. A per-check attestation is
282also a different object from complete provenance for a released artifact.
283
284Sigstore's use of short-lived certificates and transparency improves identity binding and
285auditability. Its documentation explicitly assigns monitoring responsibilities to users. It does not
286turn a signature into proof of successful computation. Whether to use its public services, privately
287operate components, or retain local keys is a deployment decision with operational and trust
288consequences. [V19 — Sigstore security model](https://docs.sigstore.dev/about/security/)
289
290## 6. Integration is concurrency control over evidence, with qualifications
291
292Kung and Robinson's optimistic concurrency control separates speculative work from validation and
293publication. Transactions proceed on local state; validation checks the conditions required for a
294serial order. Their argument assumes individual transactions preserve the relevant integrity
295conditions. Mapping this to code integration is fruitful only if the-valley states what its checks
296establish and what their dependency sets include.
297[V11 — Kung and Robinson, 1981](https://www.eecs.harvard.edu/~htk/publication/1981-tods-kung-robinson.pdf)
298
299The project already has the essential outline. Prepare a candidate against a target snapshot.
300Determine which results remain applicable. Publish only if the target still has the expected value.
301A lost compare-and-swap race causes reconsideration. This avoids silently landing a candidate
302validated against the wrong target.
303
304However, the analogy does not make software meaning transactional. A check may omit an important
305behavior. Two changes can preserve every tested property while jointly violating an untested one.
306Crystal's empirical work established that collaboration conflicts include build and test failures
307beyond overlapping textual edits, and explored speculative analysis for earlier detection. It
308supports testing combinations, not the inference that clean textual merges or finite tests establish
309semantic compatibility.
310[V12 — Brun et al., 2011](https://people.cs.umass.edu/~brun/pubs/pubs/Brun11fse.pdf)
311
312### Reuse needs a computation identity and an acceptance identity
313
314A useful proposed model has two independent questions:
315
316```text
317Computation identity:
318 approved check definition + resolved inputs + runner semantics + platform
319
320Acceptance decision:
321 computation result + applicable policy + authorized signer(s)
322 + freshness/revocation state + candidate landing
323```
324
325This is a design proposal, not a new wire format. A policy change need not invalidate a genuinely
326identical computation. It may change whether that result is sufficient. Conversely, preserving a
327check's display name must not conceal a change to its executable definition.
328
329There are three distinct failure traces worth testing against the implementation:
330
331**Candidate-controlled no-op.** Policy requires `unit-tests`; the candidate changes that derivation
332to create an output immediately. The attestation truthfully reports success. A witness faithfully
333rebuilds the no-op and agrees. The repository already records this exposure in
334[bd-eaefe82](../../.the-valley/bugs/bd-eaefe82-check-definitions-come-from-the-branch.md). Its
335suggestion that witness re-derivation would eventually detect a check that computes nothing does not
336follow: detecting the wrong check requires comparing against an approved definition or semantic
337expectation.
338
339**Same tree, different named computation.** The helper accepts a check name mapped to an attribute.
340The evidence collector extracts the name and result but does not retain the attribute in the
341verdict's evidence structure. The pure `unmoved` rule accepts an otherwise admissible passing
342statement when the subject tree is unchanged, without recomputing the expected derivation. Thus a
343same-tree shortcut has a stronger precondition than the implementation visibly establishes: the
344statement must name the computation policy required. This is a static code-review finding, not a
345reported end-to-end exploit.
346
347**Effectful label substitution.** The verdict retains an effectful observation's result and
348timestamp, but not the command or environment identity recorded in its statement. It can therefore
349decide freshness without itself comparing those fields to the required command. Again, upstream
350guarantees could change the assessment; the inspected verdict path does not establish that binding.
351A trustworthy signer can still make a configuration mistake, so this issue is not limited to
352malicious keys.
353
354**Recommendation:** establish computation identity before applying any transfer shortcut. Keep it
355separate from the policy digest in the transfer record. Resolve instance-mandated definitions from
356an independently authorized source. For changes to checks, run both the incumbent acceptance check
357and the proposed check where feasible; authorize the transition explicitly when compatibility is
358impossible. This permits improvements to tests without letting a proposal silently lower its own
359bar.
360
361### Cheap validation is a hypothesis about the runner
362
363`attest inputs` calls `nix eval` and is described as building nothing. Nix's import-from-derivation
364feature can pause evaluation to realize a derivation. Its manual explicitly documents disabling this
365behavior. Therefore evaluation-only latency needs an enforced restriction, rather than a comment in
366the integrator.
367[V05 — Nix import from derivation](https://nix.dev/manual/nix/2.28/language/import-from-derivation)
368
369Even with that restriction, evaluation, source materialization, and hashing have costs. A serial
370controller can bottleneck while doing those operations before its small atomic ref update. The size
371of the atomic operation and the end-to-end service rate are different measurements. The
372[current closure collector](../../integrator/evidence.go) runs an `attest inputs` subprocess per
373pure check, so repeated exports and evaluation are concrete costs to measure.
374
375### Merge queues are a baseline and a possible complement
376
377Zuul tests speculative combinations in parallel. Later queued changes include earlier ones; a failed
378predecessor causes affected work to restart. Its adjustable window limits wasted speculation.
379GitHub's merge queue likewise validates temporary combinations incorporating the target and
380preceding queued work. These are substantial existing solutions to integration throughput, not
381merely serialized CI gates.
382[V13 — Zuul project gating](https://zuul-ci.org/docs/zuul/latest/gating.html),
383[V14 — GitHub merge queues](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/configuring-pull-request-merges/managing-a-merge-queue)
384
385**Hypothesis:** a hybrid may improve some mixed workloads. Reuse unchanged per-check evidence first.
386Speculatively execute only invalidated checks on likely future landings. Reduce speculation when
387failures or conflicts rise. Reserve an integration opportunity for changes that repeatedly lose
388races. The hybrid adds scheduling and bookkeeping costs, and failed speculation can waste execution.
389It should be compared experimentally; there is no basis yet for claiming one queue policy works best
390for every repository.
391
392## 7. Effectful checks are observations with assumptions
393
394A check against a live API may be useful even though it cannot be replayed exactly. Its result means
395the observed interaction succeeded under the conditions recorded. A ten-minute acceptance window
396means the project accepts an observation up to ten minutes old. It does not mean the service
397remained healthy during those ten minutes.
398
399The repository's path-class rule adds a separate assumption: intervening changes outside the class
400do not affect the observation's applicability. That assumption can be wrong if a shared
401configuration file, service dependency, or credential policy sits outside the class. The time bound
402and the dependency scope should be reviewed independently.
403
404The RATS freshness discussion similarly recognizes that state can change immediately after evidence
405is produced; freshness is a policy choice about acceptable recentness.
406[V23 — RFC 9334, section 10](https://www.rfc-editor.org/rfc/rfc9334.html#section-10) That is a
407useful interpretation for ordinary test observations too, without claiming they are hardware
408attestations.
409
410The [current verdict](../../integrator/verdict/verdict.go) rejects observations whose calculated age
411reaches the validity window. Static inspection shows no rejection of negative age. A future
412timestamp is consequently a concrete test case. The larger issue is defining acceptable clock skew,
413which clock supplies time, and whether a trusted receipt or challenge is required. A sender's
414signature authenticates its stated time; it does not make the clock accurate.
415
416Not every nondeterministic check belongs in the same category as a live API test. Luo and colleagues
417studied flaky-test fixes and identified multiple causes of unstable outcomes. A race or test-order
418dependence can exist inside an otherwise isolated environment. Marking the wrapper `nix` does not
419eliminate that behavior.
420[V26 — Luo et al., 2014](https://mir.cs.illinois.edu/marinov/publications/LuoETAL14FlakyTestsAnalysis.pdf)
421
422**Recommendation:** define admissible result types. A deterministic check can have an equality-based
423result. A statistical benchmark may need a sample size, distribution summary, and acceptance rule. A
424live-service observation needs environment and time context. A flaky deterministic check should
425trigger investigation of its purity claim, rather than acquire an arbitrary expiration that conceals
426the defect.
427
428## 8. Transparency records claims; revocation changes what may rely on them
429
430A transparency log can make a submitted statement discoverable and make alterations detectable. It
431does not determine whether the statement is true. Certificate Transparency also distinguishes
432inclusion from consistent views of history; a dishonest log can present conflicting histories unless
433other participants compare or witness checkpoints. Monitors must look for the failures that matter.
434[V21 — RFC 9162, security considerations](https://www.rfc-editor.org/rfc/rfc9162.html#section-11)
435
436Tessera is a plausible implementation component, not a complete operational policy. Its documented
437lifecycle distinguishes sequencing an entry, integrating it into the tree, and publishing a signed
438checkpoint. Its publishing machinery supports witness policies. The-valley would still need to
439choose which stage permits integration and what happens when publication or witnesses are
440unavailable. [V22 — Tessera documentation](https://github.com/transparency-dev/tessera)
441
442There is a related crash boundary in the existing integrator. [`land`](../../integrator/refs.go)
443moves the protected ref before storing the transfer evidence. It reports subsequent failures, but a
444crash can still leave a landed change without the intended durable record. Composing and signing
445before the ref move reduces one failure class; it does not atomically publish evidence alongside the
446landing.
447
448**Recommendation:** investigate a Git ref transaction covering the target and evidence refs, or a
449durable intent record with recovery. For an external log, specify a two-stage protocol with a
450recoverable intermediate state. The experiment is a process kill at every persistence boundary,
451followed by a new controller reconstructing what happened. “Every landing has evidence” should be
452tested as a storage invariant.
453
454Revocation presents another distinction. An old statement can remain authentic while becoming
455unacceptable. A signing key may be revoked; a check definition may be disallowed; a vulnerability
456database may advance; or a policy may require a stronger builder. TUF's role separation, version
457checks, expiration, and key-update procedures are important prior art for distributing current trust
458information and resisting stale metadata.
459[V20 — TUF specification](https://theupdateframework.github.io/specification/latest/)
460
461**Inference:** a useful revocation record names the affected authority or statement, the reason, the
462effective interval, and the dependent decisions requiring reconsideration. A reverse index from
463attestations to transfers, releases, and deployments becomes operationally important. Pure
464computation results need not expire merely because time passes, but permission to rely on them can
465change.
466
467Revocation also does not undo consequences. An already deployed secret leak cannot be reversed by
468withdrawing an attestation. The architecture's tradeoff therefore needs an explicit exposure budget:
469which actions may proceed before independent verification, how far their outputs may propagate, and
470which actions require verification first.
471
472## 9. What random witness sampling can and cannot promise
473
474Sampling can make repeated dishonesty increasingly likely to be discovered. It cannot guarantee
475discovery of a particular unsampled statement. The following calculation is this report's elementary
476probability model, not an empirical estimate of the-valley's security.
477
478Suppose each false statement is independently sampled with probability `p`. Suppose a sampled false
479statement is always detected by an honest witness, and the attacker cannot choose its behavior after
480learning the sample decision. After `m` false statements:
481
482```text
483P(no detection) = (1 - p)^m
484P(at least one detection) = 1 - (1 - p)^m
485```
486
487At `p = 0.01`, one false statement has a 99% chance of escaping this sampling scheme. One hundred
488false statements have about a 36.6% chance of all escaping. Reaching a 95% probability of detecting
489at least one requires 299 false statements. The expected number of false statements up to and
490including first detection is 100; that expectation is not a maximum.
491
492If an audit detects a sampled false statement with probability `q`, independent of selection,
493replace `p` by `p*q`. A witness that reruns a candidate-controlled no-op has `q = 0` for the defect
494“this check does not test what policy intended.” Increasing sampling does not fix that defect.
495
496These equations also exclude correlated witness failures, compromised samplers, adaptive attacks,
497and delayed audit execution. A high historical success score gives no mathematical assurance against
498a signer that behaves honestly until one valuable attack. Multiple new identities can undermine
499reputation unless identity creation itself has a controlled cost or authorization boundary.
500
501**Recommendation:** select audits after the statement is irrevocably committed, using randomness the
502producer cannot predict or steer cheaply. Separate two aims: estimating routine error rates and
503deterring targeted abuse. Random sampling serves the first well under suitable assumptions. The
504second may require mandatory independent verification for high-impact changes, protected builder
505keys, or limits on what unverified outputs can authorize.
506
507A confidence statement also needs a denominator. If no failures appear in `n` independent,
508representative audits, a one-sided 95% upper bound for a stable defect rate is `1 - 0.05^(1/n)`,
509approximately `3/n` for large `n`. With 300 clean audits, this is about 1%. It says nothing
510comparable about an adaptive adversary's next submission. Calling it an attester's universal trust
511probability would be misleading.
512
513Finally, sampling without a response mechanism only produces observations. Useful operation requires
514a disagreement state, preservation of both runs, diagnosis of nondeterminism, and a rule for pausing
515dependent decisions. Automatic punishment on first mismatch risks treating an honest witness that
516exposed a flaky check as the attacker.
517
518## 10. A research program that can discriminate between designs
519
520The most useful next work is a small set of falsifiable experiments. Each should compare a concrete
521baseline, measure costs, and exercise a failure mode that normal successful builds would miss.
522
523| Experiment | Baseline and variation | What would change the design decision? |
524| ------------------------------- | ----------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
525| Reuse on real history | Recheck everything; whole-tree cache; current per-check transfer; narrower source sets | Saved compute and landing latency justify declaration complexity without changed results |
526| Controlled interference | Changes to imports, generated files, directory membership, lockfiles, platform, and check definitions | Any false reuse requires repairing the dependency or identity model before optimizing further |
527| Same-tree evidence substitution | Keep subject and check name; alter attribute, command, environment, or approved definition | Every mismatch is rejected before the unchanged-tree shortcut |
528| Local forgery | An authorized key signs a fabricated passing statement and the approved tool identifier | Demonstrates exactly which deployment profiles need a separate execution authority |
529| Genuine witness independence | Rebuild with a fresh store; shared cache; separate cache; altered environment | Distinguishes actual independent execution from repeated trust in the same cached artifact |
530| Purity stress | Vary clock, CPU count, scheduling, locale, kernel, and allowed sandbox settings | Determines which checks qualify for deterministic reuse and what platform identity must include |
531| Evaluation cost | Warm/cold caches, import-from-derivation, large flakes, many required checks | Establishes whether the integrator must cache evaluation, parallelize preparation, or restrict runner features |
532| Queue contention | Replay identical arrivals through sequential, speculative, reuse-only, and hybrid queues | Compare completed landings, wasted computation, tail latency, and starvation rather than only average throughput |
533| Evidence durability | Crash before and after each ref, evidence, memo, and log publication operation | Recovery restores a complete account without silently reclassifying an incomplete landing |
534| Revocation response | Revoke a signer or definition after several dependent integrations and releases | Every affected dependency is found, and consumers converge within a measured interval |
535
536**Hypothesis:** dependency breadth and evaluation overhead will decide the value of selective reuse
537more often than signature-verification cost. A source filter that inadvertently includes the entire
538repository may erase most of the intended advantage. This should be established by historical replay
539before designing elaborate attester economics.
540
541**Hypothesis:** checks that use many global fixtures will benefit more from speculation and batching
542than from finer evidence transfer. Conversely, isolated documentation and component checks should
543transfer frequently. A single aggregate cache-hit rate could hide this split; results should be
544reported per check family and by computation cost.
545
546One experiment must address the meaning of “passed.” The oracle literature studies how tests obtain
547an expected answer, including specifications, contracts, derived oracles, and metamorphic relations.
548It shows why automating execution does not finish automating judgment.
549[V25 — Barr et al., 2015](https://discovery.ucl.ac.uk/id/eprint/1471263/1/06963470.pdf)
550
551For the-valley, mutate both code and its candidate-supplied tests. Compare incumbent tests,
552candidate tests, external invariants, and independent review. The aim is not to assign one universal
553quality score. It is to find changes for which execution evidence looks impeccable while the
554intended requirement is no longer being tested. This is especially relevant when the same agent can
555write the implementation, test, and account of success.
556
557## 11. The promising solution space
558
559The strongest version of this architecture makes evidence portable while keeping acceptance
560contextual. Execution produces a claim with a precise computation identity. Integration checks
561whether that computation still applies and whether its evidence is currently acceptable. Release or
562deployment can impose stronger requirements than integration without discarding the earlier
563evidence.
564
565Several design choices remain legitimate:
566
567- A personal installation can trust local machine keys and use occasional independent checks to
568 catch mistakes.
569- A collaborative project can accept local results for fast feedback while requiring a protected
570 builder for selected acceptance predicates.
571- A high-assurance release can require several independent rebuilds, durable transparency evidence,
572 and explicit authorization of check-definition changes.
573- A low-conflict project can use a simple queue and rely on build-cache reuse, avoiding a more
574 sophisticated integrator until measurements justify one.
575
576The strongest objection is that existing build caches and merge queues may already capture most of
577the performance benefit. The-valley must demonstrate an additional benefit in portable authority,
578partial re-attestation, host independence, or explanatory records. Moving familiar mechanisms into
579new formats without improving one of those outcomes would not justify their operational cost.
580
581The corresponding opportunity is substantial. A transfer statement can explain exactly why earlier
582evidence still supports a new landing. That is more informative than a historical green badge
583detached from its assumptions. The research recommendation is to pursue that explanation as the core
584contribution, with conservative identity binding and explicit trust profiles. Reputation, universal
585purity claims, and mandatory transparency infrastructure should follow only where their measured
586benefit and threat model warrant them.