FullStack AI Hub
Studio
lesson depth
Mastery
not started · 0%

Human Validation UI for Automated Edits

A versioned review workflow lets people inspect model-proposed edits, resolve stale changes safely, and approve an auditable commit.

Freshness: current•12 min read•AI User Experience and Human-AI Interaction
Full Technical Reference Document

Mental model

Human validation for automated edits is a versioned review workflow that shows a person the proposed change, its provenance, affected context, and consequences before any write. The reviewer’s decision is bound to the document revision the model saw; a stale revision creates a conflict, while an approved current proposal commits atomically and leaves an auditable record.

Learning outcomes

  • Model an edit as a proposal with a stable identifier, base revision, provenance, and explicit review state.
  • Explain why approval must be checked against the current document version inside the commit transaction.
  • Design a review surface that communicates exact changes and works with keyboard and assistive technology.

Theory

Treat generation and authorization as separate operations. The model creates a candidate patch; it has no write permission. A proposal should carry the target document, the revision used as input, the changed ranges, the generating model and request trace, and any policy or risk labels that affect review. These fields let an editor answer “what will change, why was it suggested, and can this still be applied?” without trusting a green badge or a chat transcript.

A useful state machine distinguishes pending, approved, rejected, stale, and applied. Approval records the reviewer and timestamp, but it does not itself mutate the document. At commit time the server checks authorization, validates the patch, and compares the stored document revision with the proposal’s base revision in the same transaction that writes the new text and audit event. If any check fails, the whole transaction is rejected. A unique decision request ID makes a retried approval safe after a network timeout; the service returns the original outcome instead of applying the patch twice.

The probability that a proposal results in a safe commit can be decomposed with the chain rule:

P(S)=P(A) P(C∣A) P(V∣A,C)P(S) = P(A)\,P(C\mid A)\,P(V\mid A,C)

Here, AA means the authorized reviewer approves, CC means the proposal’s base revision is still current, and VV means policy and patch validation succeed. Each quantity is a dimensionless probability measured over proposals in a defined cohort. If 72 of 100 proposals are approved, 95% of those still match the current revision, and 99% pass validation, the expected safe commits are 100×0.72×0.95×0.99≈68100\times0.72\times0.95\times0.99\approx68. The remaining proposals are not “failed approvals”: some were rejected, became stale, or violated a rule, and each outcome should remain visible in the audit trail.

The review interface is part of the safety mechanism. Show a unified diff alongside enough surrounding context to recognize an accidental broad replacement. Identify the source file and revision, let the reviewer open the original, and make accept, reject, and request-changes actions distinct. Color can reinforce additions and deletions, but labels, icons, and screen-reader text must convey the same distinction. Keep focus inside the review task after a decision, announce queued or committed status through an accessible live region, and never imply that a click succeeded until the server reports its durable result.

Model proposes a revision-bound patch
Interface exposes diff and provenance
Reviewer chooses an explicit outcome
Server checks revision and policy atomically
Audit record reports the durable result
Conceptual teaching model synthesized from:human-ai-guidelines,w3c-wcag22,w3c-aria-apg

Trade-offs

Reviewing every edit gives strong human oversight but adds queue time and can make routine work feel tedious. Grouping nearby hunks reduces navigation, yet a single approval for a large patch can hide one risky change. Prefer small, semantically coherent proposals and support hunk-level decisions only when the patch representation can prove that accepted hunks do not depend on rejected ones. A risk score may prioritize a queue; it should not silently grant write authority.

Optimistic concurrency keeps reviewers from holding locks while reading. It also means an edit can become stale during a long review. Rebase is not an innocent retry: moving a patch onto a different revision may alter its meaning, so produce a fresh diff and request a fresh decision. For bulk changes, show the affected-file count, representative examples, and a way to inspect every file before the single batch commit. Record outcomes and review latency by proposal size and type, then use those measurements to tune batching and staffing without optimizing for approval rate alone.

Failure modes and misconceptions

  • A current-looking card can be stale. Another editor or automation may have changed the source after generation. The server-side revision comparison, rather than the browser’s last-loaded version, decides whether a patch applies.
  • A successful button response is not proof of a commit. A timeout may occur after the database commits. Return an idempotent result for the same decision ID and expose the recorded revision when the client reconnects.
  • A text diff can conceal a semantic blast radius. A small change to a shared policy or import can affect many consumers. Show file and symbol context, and link to relevant tests or downstream references when available.
  • Color-only status is inaccessible and ambiguous. Pair visual highlighting with text labels and an announced state. Keep keyboard order predictable and preserve focus after rerendering the card.
  • “Human approved” does not mean safe by itself. Authorization, patch validity, and policy checks still run at commit. A person cannot override a missing permission or make an invalid patch atomic.

Decision scenario

An assistant proposes changing three validation rules in a shared configuration file at revision 41. The editor reviews the diff and approves it, but another maintainer commits an unrelated change first, moving the file to revision 42. Do not apply the old patch automatically or hide the conflict behind a successful toast. Mark the proposal stale, retain the reviewer’s decision and original diff, regenerate against revision 42, and ask for review of the changed context. If the approval request is merely retried because the response timed out, return its stored result by request ID; do not create revision 43 from the same decision.

Implementation pattern

This small in-memory example demonstrates the state and idempotency rules in one process. A production service should perform the revision comparison, document write, proposal transition, and audit insert in one database transaction, using a conditional update on the expected revision.

typescript
type Document = { revision: number; text: string };
type Proposal = {
id: string; documentId: string; baseRevision: number;
before: string; after: string; state: "pending" | "applied" | "rejected" | "stale";
};
type Outcome = { status: "applied" | "rejected" | "conflict"; revision: number };
type Recorded = { signature: string; outcome: Outcome };
​
const documents = new Map<string, Document>([["guide", { revision: 41, text: "timeout: 5s" }]]);
const proposals = new Map<string, Proposal>([["p-8", {
id: "p-8", documentId: "guide", baseRevision: 41,
before: "timeout: 5s", after: "timeout: 8s", state: "pending",
}]]);
const requests = new Map<string, Recorded>();
const audit: string[] = [];
​
function decide(requestId: string, proposalId: string, reviewerId: string, approve: boolean): Outcome {
const signature = `${proposalId}:${reviewerId}:${approve}`;
const prior = requests.get(requestId);
if (prior) {
if (prior.signature !== signature) throw new Error("request ID reused for another decision");
return prior.outcome;
}
const proposal = proposals.get(proposalId);
if (!proposal || proposal.state !== "pending") throw new Error("proposal is not pending");
const document = documents.get(proposal.documentId);
if (!document) throw new Error("target document not found");
if (!approve) {
proposal.state = "rejected";
const outcome: Outcome = { status: "rejected", revision: document.revision };
audit.push(`${requestId}:${reviewerId}:rejected:${proposalId}`);
requests.set(requestId, { signature, outcome });
return outcome;
}
if (document.revision !== proposal.baseRevision) {
proposal.state = "stale";
const outcome: Outcome = { status: "conflict", revision: document.revision };
audit.push(`${requestId}:${reviewerId}:stale:${proposalId}`);
requests.set(requestId, { signature, outcome });
return outcome;
}
if (document.text.split(proposal.before).length !== 2) throw new Error("patch context is not unique");
document.text = document.text.replace(proposal.before, proposal.after);
document.revision += 1;
proposal.state = "applied";
const outcome: Outcome = { status: "applied", revision: document.revision };
audit.push(`${requestId}:${reviewerId}:applied:${proposalId}:r${document.revision}`);
requests.set(requestId, { signature, outcome });
return outcome;
}
​
console.assert(decide("req-1", "p-8", "editor-2", true).revision === 42);
console.assert(decide("req-1", "p-8", "editor-2", true).revision === 42);
Reflect before revealing the guide

Prerequisites & Related Concepts (2)

Private notes

0 words
Recommended Free Track
Free · Verifiable Credential

FS-501AI Evaluation and Reliability

Turn product intent and risk into representative evaluations release gates traces service targets and continuously improving regression evidence.

17 concepts~22h self-paced
Start Free Course
Weekly Engineering Dispatch

Get the weekly systems teardown

One technical note per week covering inference bottlenecks, retrieval harnesses, and commit-pinned teardowns.

Next