<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: 倪晨钦（wagahai）</title>
    <description>The latest articles on DEV Community by 倪晨钦（wagahai） (@wagahai_dd0eeb5e9646).</description>
    <link>https://dev.to/wagahai_dd0eeb5e9646</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3478118%2Fc5c29b29-dedf-4ea7-96c0-7e76b1a66c39.jpg</url>
      <title>DEV Community: 倪晨钦（wagahai）</title>
      <link>https://dev.to/wagahai_dd0eeb5e9646</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/wagahai_dd0eeb5e9646"/>
    <language>en</language>
    <item>
      <title>How we built the delivery evidence chain</title>
      <dc:creator>倪晨钦（wagahai）</dc:creator>
      <pubDate>Wed, 22 Jul 2026 02:09:29 +0000</pubDate>
      <link>https://dev.to/wagahai_dd0eeb5e9646/how-we-built-the-delivery-evidence-chain-3dd1</link>
      <guid>https://dev.to/wagahai_dd0eeb5e9646/how-we-built-the-delivery-evidence-chain-3dd1</guid>
      <description>&lt;p&gt;&lt;em&gt;AI agents can write an app in ten minutes. Proving what actually shipped is a harder, older problem. This is how we built Appaloft's evidence chain — and where we deliberately stopped.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;Everyone building with coding agents hits the same wall. The agent produces something that works on your machine. Then someone — usually you — copies files to a server, restarts a process, eyeballs a log line, and declares victory. Two weeks later, when production is serving the wrong build at 2am, nobody can answer the simplest question in software delivery: &lt;strong&gt;what exactly is running, and who approved it?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This problem predates AI. But agents make it acute, for two reasons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Throughput.&lt;/strong&gt; A human writes one deployable change at a time and usually remembers what was in it. An agent can produce twenty candidates in an afternoon. Your deployment memory does not scale.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Trust.&lt;/strong&gt; The moment you let an agent drive deployment directly — hand it SSH keys, a Docker socket, cloud credentials — you've given production access to a stochastic process with a confident tone.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Appaloft is an open-source (Apache-2.0) delivery platform built around one idea: &lt;strong&gt;promotion must be explicit, and delivery must leave evidence.&lt;/strong&gt; Not "the agent says it deployed." Verifiable observations, recorded at each step, that link the exact artifact you approved to the workload actually serving traffic.&lt;/p&gt;

&lt;p&gt;We call this the delivery evidence chain. This post is about how it works, mechanically — and about the claims we deliberately do &lt;em&gt;not&lt;/em&gt; make.&lt;/p&gt;

&lt;h2&gt;
  
  
  What an evidence chain is (and isn't)
&lt;/h2&gt;

&lt;p&gt;Let's get the disclaimer out of the way first, because it's a design principle, not legal cover: the evidence chain is &lt;strong&gt;not&lt;/strong&gt; formal verification, not a correctness proof, not a security certification. It is a chain of custody. It answers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Which exact bytes were frozen as a candidate?&lt;/li&gt;
&lt;li&gt;Who — what kind of principal — approved promoting them, and when?&lt;/li&gt;
&lt;li&gt;After deployment, does observed reality (the running container, its configuration, the route serving traffic) match what was approved?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If any link in that chain breaks, the system says so, explicitly, with a reason code. Absent or unavailable evidence can never silently pass a check. That fail-closed property is the whole point.&lt;/p&gt;

&lt;p&gt;The chain has four links: &lt;strong&gt;freeze → preview → promote → verify&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Link 1: Freezing the workspace into a content-addressed artifact
&lt;/h2&gt;

&lt;p&gt;A coding agent works in a sandbox — a gVisor-isolated container with a deny-by-default network policy. When its work looks good, you freeze the workspace into a &lt;em&gt;source artifact&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;The obvious implementation is "tar the directory, hash the tarball." We didn't do that. The artifact digest is a &lt;strong&gt;SHA-256 over a canonical JSON manifest&lt;/strong&gt; — a sorted, deduplicated list of &lt;code&gt;{path, sha256-of-file-bytes, sizeBytes}&lt;/code&gt; entries. The archive itself (a plain uncompressed ZIP) is just a transport. Identity lives in the manifest.&lt;/p&gt;

&lt;p&gt;Why? Because manifest-of-hashes gives us properties a tarball hash can't:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Dedupe that's meaningful.&lt;/strong&gt; We can look up &lt;code&gt;findArtifactByDigest&lt;/code&gt; and return the existing artifact when the agent's "new" output is byte-identical to a previous one — including when two freezes race each other (the loser of the race deletes its copy; the caller gets the winner's descriptor either way).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mutation detection.&lt;/strong&gt; After reading each file during capture, we re-check its size. If the workspace changed mid-freeze, capture fails: &lt;em&gt;"Source Artifact changed during capture."&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Path safety.&lt;/strong&gt; Every entry is validated against the source root; symlinks and &lt;code&gt;..&lt;/code&gt; escapes are rejected outright.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Two more design decisions worth mentioning:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Freezing requires quiescence.&lt;/strong&gt; Capture is rejected if any agent run is active in that sandbox. You cannot freeze a workspace mid-edit. This sounds obvious; enforcing it in the state machine (rather than documenting it) is what makes it true.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Secret scanning happens at freeze time, fail-closed.&lt;/strong&gt; Before anything becomes immutable, we scan for a filename denylist (&lt;code&gt;.env*&lt;/code&gt; except documented templates, &lt;code&gt;id_rsa*&lt;/code&gt;, &lt;code&gt;credentials.json&lt;/code&gt;) and content patterns (PEM private keys, AWS/GitHub/OpenAI token shapes, &lt;code&gt;password = …&lt;/code&gt;-style assignments). If it looks like a secret, the freeze fails. Secrets cannot enter an immutable candidate — because everything downstream (preview, promotion, deployment) will treat that artifact as trustworthy-by-identity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Link 2: Preview what you froze, exactly
&lt;/h2&gt;

&lt;p&gt;A frozen artifact feeds a &lt;em&gt;candidate preview&lt;/em&gt;: a temporary, expiring URL serving that exact build. Every preview response carries an &lt;code&gt;x-appaloft-artifact-digest&lt;/code&gt; header, and the control plane verifies the gateway echoes the same &lt;code&gt;previewId&lt;/code&gt; and &lt;code&gt;artifactDigest&lt;/code&gt; it expects — a preview that can't prove which artifact it's serving is treated as unverified evidence and blocks promotion.&lt;/p&gt;

&lt;p&gt;Preview tokens are HMAC-hashed, compared with &lt;code&gt;timingSafeEqual&lt;/code&gt;, revocable, and GET/HEAD only. Small TCB, deliberately: the preview gateway is a standalone service with a few hundred lines of security-relevant code, not a framework.&lt;/p&gt;

&lt;h2&gt;
  
  
  Link 3: Promotion as a state machine, with an approval gate that isn't a UI
&lt;/h2&gt;

&lt;p&gt;This is the link most tools get wrong, because they treat approval as a button in a dashboard. Our approval gate is a &lt;strong&gt;principal check in the domain layer&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The promotion aggregate has an explicit state machine:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;planned → accepted → creating-resource → deploying → verifying → completed
   │                                                            │
   ├── expired (30-min TTL)                        failed ──→ retry ──→ deploying
   └── (no approval, nothing happens — ever)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A few properties fall out of making this explicit:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Plan expires in 30 minutes.&lt;/strong&gt; A plan references a digest and a verified preview. If you don't act on it, it goes stale — &lt;code&gt;sandbox_promotion_plan_expired&lt;/code&gt;. Approval decisions should be made against fresh evidence, not yesterday's candidate.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Accept requires the exact digest.&lt;/strong&gt; &lt;code&gt;acceptPromotion&lt;/code&gt; takes an &lt;code&gt;expectedArtifactDigest&lt;/code&gt;. If the candidate drifted since you looked at it, you get &lt;code&gt;sandbox_promotion_artifact_mismatch&lt;/code&gt;. You approve &lt;em&gt;these bytes&lt;/em&gt;, not "whatever's latest."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The gate rejects machine principals.&lt;/strong&gt; &lt;code&gt;requireExternalApprovalActor&lt;/code&gt; refuses &lt;code&gt;deploy-token&lt;/code&gt; identities with &lt;code&gt;sandbox_agent_external_approval_required&lt;/code&gt;. A sandbox-scoped identity — the kind an agent or an MCP session holds — &lt;em&gt;structurally cannot&lt;/em&gt; accept a promotion. This isn't a permission toggle an agent could talk its way past; the operation catalog doesn't offer the capability to that principal kind. The agent can prepare everything up to the gate. A human (or an external system acting with human-delegated credentials) walks it through.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Idempotency is built into accept and retry.&lt;/strong&gt; Re-accepting with the same idempotency key is a no-op that re-enqueues the work, so a flaky client can't double-promote. Retry is deliberately narrow: it reuses the &lt;em&gt;same&lt;/em&gt; resource and artifact, clears only the deployment ID, and makes a new attempt. &lt;code&gt;recordResource&lt;/code&gt; refuses to attach a &lt;em&gt;different&lt;/em&gt; resource ID to a promotion that already has one — the chain of custody can't be silently rewired mid-flight.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Every intermediate state is persisted.&lt;/strong&gt; The async worker (&lt;code&gt;reconcilePromotion&lt;/code&gt;, driven by a database-backed durable work queue with a dedupe key and bounded attempts) persists after each step: resource created, deployment created, proof read. Crash anywhere, resume from the last honest state.&lt;/p&gt;

&lt;h2&gt;
  
  
  Link 4: Proof beats exit codes
&lt;/h2&gt;

&lt;p&gt;Here's an uncomfortable truth about deployment tooling: &lt;code&gt;exit 0&lt;/code&gt; proves the deploy &lt;em&gt;script&lt;/em&gt; finished. A green health check proves &lt;em&gt;a&lt;/em&gt; container is healthy. Neither proves the thing serving traffic is the thing you approved. So the final link is a read-back verification engine, exposed as &lt;code&gt;deployments.proof&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Proof is &lt;strong&gt;computed on read&lt;/strong&gt; by comparing the &lt;em&gt;planned&lt;/em&gt; state (an immutable admission-time snapshot: artifact identity, configuration fingerprint, expected effects) against &lt;em&gt;observed&lt;/em&gt; evidence gathered from the target:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Workload identity.&lt;/strong&gt; We SSH to the target and &lt;code&gt;docker inspect&lt;/code&gt; the container labeled with this deployment's ID, then compare the image's &lt;code&gt;sha256:&lt;/code&gt; digest and the container's generation against the plan.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Configuration fingerprint.&lt;/strong&gt; Labels and environment key-set comparison — a drifted env var is a mismatch, not a footnote.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Health.&lt;/strong&gt; Container running state plus Docker health status.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Route identity.&lt;/strong&gt; This one's subtle and worth dwelling on. A healthy container with the right labels proves nothing about which deployment the reverse proxy is &lt;em&gt;actually serving&lt;/em&gt;. So our managed edge stamps a deployment-identity header on responses, and verification fetches the public URL (raw TLS client, bounded retries, redirect-following) and checks the stamped identity equals the planned deployment ID. &lt;em&gt;"Managed public route served deployment X instead of Y"&lt;/em&gt; is a first-class failure.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The verdict vocabulary is deliberately honest: &lt;code&gt;verified | partially-verified | unverified | stale | failed&lt;/code&gt;. Unavailable evidence is explicit and &lt;strong&gt;can never satisfy a required gate&lt;/strong&gt;; health success or access success alone can never produce &lt;code&gt;verified&lt;/code&gt;. Mismatches come with machine-readable reason codes — &lt;code&gt;artifact_identity_mismatch&lt;/code&gt;, &lt;code&gt;configuration_fingerprint_mismatch&lt;/code&gt;, &lt;code&gt;access_route_workload_mismatch&lt;/code&gt; — each carrying recommended remediation operations. The point isn't the verdict; it's that a downstream system (or a tired human) can trust &lt;code&gt;verified&lt;/code&gt; because every way it could have been cheated is enumerated.&lt;/p&gt;

&lt;p&gt;Only a &lt;code&gt;verified&lt;/code&gt; proof moves a promotion to &lt;code&gt;completed&lt;/code&gt;. The promotion descriptor literally derives its &lt;code&gt;proofVerdict&lt;/code&gt; from that status — there's no code path where an unverified deployment reads as a successful promotion.&lt;/p&gt;

&lt;h2&gt;
  
  
  The ledger underneath: audit events and operator work
&lt;/h2&gt;

&lt;p&gt;Underneath the chain sits a general audit sink: every mutating operation in the audited domains — projects, deployments, sandboxes, credentials, and more — is recorded as an audit event with the operation key (e.g. &lt;code&gt;sandboxes.promotions.accept&lt;/code&gt;), the aggregate it touched, and a redacted payload (anything matching a secret-like key pattern is stripped before persistence). Retention, pruning, immutable archives with their own content digests, and legal holds are separate, boring, deliberate subsystems (ADRs 048/057/058, if you're reading along in the repo).&lt;/p&gt;

&lt;p&gt;&lt;code&gt;appaloft audit-event list&lt;/code&gt; and &lt;code&gt;appaloft work list&lt;/code&gt; are the operator-facing read paths. When something looks wrong at 2am, the question "what happened, in what order, triggered by what" is a query, not an archaeology project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the boundaries are
&lt;/h2&gt;

&lt;p&gt;Honesty section, because we read the comments too:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Deploy &amp;amp; Verify is stable.&lt;/strong&gt; Folders, Git repos, zips, images, Compose bundles, static artifacts, health, logs, rollback, proof readback — in production use today, self-hosted or on our cloud.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Agent sandboxes, source artifacts, and promotion are private preview.&lt;/strong&gt; The domain model, state machine, proof engine, and operation catalog are in the public repo; the managed capture/preview/delivery adapters currently ship in our cloud distribution. The README carries a capability maturity table, and we'd rather you hold us to it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A cheap VPS is not automatically sandbox-capable.&lt;/strong&gt; gVisor isolation requires &lt;code&gt;runsc&lt;/code&gt; registered with Docker; our provider probes for it and fails closed if it's missing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The evidence chain is not a correctness argument.&lt;/strong&gt; It won't tell you the agent's code is good. It tells you the code you approved is the code that's running, and proves it continuously.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why build it this way?
&lt;/h2&gt;

&lt;p&gt;We could have shipped "one-click AI deploy" a year earlier. The market is full of those, and they all share the same shape: an agent with too many credentials, a deploy script with too much trust, and a success message with too little evidence.&lt;/p&gt;

&lt;p&gt;The bet behind the evidence chain is that the agent era needs &lt;em&gt;less&lt;/em&gt; trust, not more convenience. Agents should operate through governed operations — the same operation catalog a human uses, over CLI, MCP, SDK, OpenAPI, or GitHub Action — with capability boundaries enforced by principal type, artifact identity enforced by content digest, and success defined as observed-reality-matches-approval rather than process-exited-cleanly.&lt;/p&gt;

&lt;p&gt;If that bet sounds right to you, the repo is &lt;a href="https://github.com/appaloft/appaloft" rel="noopener noreferrer"&gt;github.com/appaloft/appaloft&lt;/a&gt;, Apache-2.0. The 5-minute hello example walks the full deploy loop on your own server. And if it sounds wrong — if you think approval gates will dissolve under agent autonomy, or that content-addressed promotion is ceremony without payoff — that's the argument we want to have, in the issues or the comments below.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Appaloft is an open-source AI application delivery platform: run agents in isolated sandboxes, freeze exact candidates, promote explicitly, deploy to your own servers, and verify with evidence. Self-host with one install script; hosted cloud starts free.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>devops</category>
      <category>ai</category>
      <category>opensource</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
