Skip to content

Verification, Review and Promotion

Mission verification checks and output validation, post-checks, verdicts, independent review preparation and guards, spec-adherence and TypeSafe judges, acceptance campaigns, adversarial-QA gates, artifact schema validation with drift detection, and gated promote/land of verified work.

Depends on: Artifact Schemas (31), Mission Lifecycle and Artifact Store (25), Runtime Execution and Supervision (5), Run Control and Team Coordination (5), Runtime Adapters and In-Runtime Extensions (3), Observability, Accounting and Reporting (2)

Used by: CLI Entry, Build and Project Tooling (12), Observability, Accounting and Reporting (4), Runtime Adapters and In-Runtime Extensions (3), Runtime Execution and Supervision (3), Mission Lifecycle and Artifact Store (2), Run Control and Team Coordination (2)

(Numbers are distinct file-to-file dependencies.)

File Summary Key symbols
src/harness/acceptance.ts Acceptance campaign runner: loads the acceptance registry, computes input digests for evidence freshness, runs each entry’s mission through the CLI with injected cancel/steer actions, evaluates guard/write invariants and exercised mechanisms, and writes and rebinds evidence reports. loadAcceptanceRegistry, compareAcceptanceFacts, defaultAcceptanceInputs, acceptanceInputs, inputPatternToRegExp, listWalkedInputFiles, readInputContent, computeAcceptanceInputDigest, …
src/harness/diff-classifier.ts Pure TDD diff classifier that extracts touched paths from a unified diff and categorizes each as tests, source, or other against the mission’s glob lists, used by verify to gate test-first discipline. globToRegExp, unquoteGitPath, extractDiffPaths, classifyDiff
src/harness/independent-review-execution.ts Assignment and session guard that refuses to execute a prepared independent-review mission from the wrong root or runtime; not an OS isolation boundary. assertIndependentReviewExecution
src/harness/independent-review.ts Prepares self-contained independent-review missions that snapshot worker outputs with hashes, and collects and validates review reports for provenance and recommendation without ever approving or promoting work. readIndependentReviewReport, reviewBaseRef, changedGitPaths, snapshotWithin, prepareIndependentReview, passBlockers, validateIndependentReviewReport, collectIndependentReview
src/harness/land.ts Gated cherry-pick of verified worker branches into a target worktree, enforcing passed verification, clean independent reviews bound to the branch tip, forbidden-pattern scans, checks, and a hash-chained land decision index. defaultLandGitRunner, defaultLandCommandRunner, LandError, ReviewGateError, landWorkerBranches, listWorktrees, requirePassedVerification, requireCleanReview, …
src/harness/output-verification.ts Verifies a mission’s declared expected artifact is a non-empty regular file inside the workspace (after realpath resolution), optionally checking JSON validity and a completion marker, and returns a verification check record. verifyExpectedArtifact
src/harness/post-checks.ts Runs operator-defined post-checks (from a YAML/JSON file outside the mission) after a mission run, records only check names and outcomes into runtime-result.yaml and mission mirrors, and gates the run’s exit code on their results. postCheckExitCode, loadPostChecks, runPostChecks, recordMissionMirrors, recordPostChecks, runSingleCheck
src/harness/promote.ts Implements uh mission promote: validates a mission id and paths against symlink and traversal attacks, requires a passed verification, and writes a promotion.yaml decision plus a mission event. promoteMission, readMissionAtLocation, requirePassedVerification, requireInitializedProject, rejectSymlinkIfExists
src/harness/spec-judge.ts LLM spec-adherence judge scaffolding (UH-110): builds a judge prompt from a spec and diff, parses a structured verdict, and provides an injectable OpenAI-compatible one-shot call. buildJudgePrompt, parseJudgeVerdict, oneShotOpenAI, judgeSpecAdherence
src/harness/typesafe.ts Client for the TypeSafe System One judgment API that asks atomic Noul questions per non-deterministic acceptance criterion plus a fixed report battery, with bounded retries on 429/529, and composes a pass/fail/remediation three-verdict in code from the answers and deterministic facts. validateAnswer, validateAnswers, resolveTypeSafeModel, raceAbort, evaluateSystemOne, criterionQuestion, composeThreeVerdict, evaluateThreeVerdict
src/harness/validate.ts Schema-dispatch validator for .harness artifacts: reads YAML/JSON files, routes them by schema_version to the matching Zod validator (project, adapter, workflow, mission, runtime, team, runs, review and decision contracts), and adds mission warnings such as a missing design.md. validateFile, collectMissionWarnings, validateRootProject, validateAllWorkflows, validateAllMissions
src/harness/validate/drift/detect-options.ts Type-only module defining DriftDetectOptions, the options threaded through drift detectors (currently strictSpec to escalate spec-stale issues to errors).
src/harness/validate/drift/kinds/missing-completion-timestamp.ts Drift kind (UH-77) that detects runtime-result.yaml files with a passed/failed status but empty finished_at, and repairs them by writing the mission directory’s mtime as a best-effort finish time.
src/harness/validate/drift/kinds/orphaned-run-dir.ts Drift kind that finds per-run directories under missions//runs/ with no entry in runs/index.json and repairs them by idempotently removing the orphaned directory.
src/harness/validate/drift/kinds/orphaned-worktree.ts Drift kind that parses git worktree list –porcelain for worktrees whose paths no longer exist on disk and repairs them with git worktree prune.
src/harness/validate/drift/kinds/roadmap-linear-divergence.ts Warning-only drift kind that compares UH-N issue references in docs/ROADMAP.md against every mission’s issue_refs and reports references present in one but not the other, without any network call. collectMissionRefs
src/harness/validate/drift/kinds/spec-stale.ts Drift kind (UH-109) that inspects git diff dev…HEAD for implementation changes under src/ without a matching sibling .spec.md or specs/ update, with severity escalated to error in strict-spec mode. specStaleSeverity, neighborSpecPath, isImplementationSrcChange, listChangedPaths
src/harness/validate/drift/kinds/stale-render.ts Warning-only drift kind that flags missions whose rendered prompt and runtime-session.yaml are older than mission.yaml, meaning the mission changed after its last prompt render.
src/harness/validate/drift/kinds/stale-worker.ts Drift kind that finds team worker lock files whose recorded PID is no longer alive and repairs them by deleting the stale lock so fresh workers can spawn. isProcessAlive
src/harness/validate/drift/kinds/truncated-events-ndjson.ts Drift kind that detects events.ndjson files (legacy mission-level and per-run) whose last non-empty line is not valid JSON and repairs them by dropping the unparseable final line. scanFile
src/harness/validate/drift/registry.ts Ordered registry of all drift kinds with detectAll, groupByKind and runDrift, which runs detect-repair-redetect cycles capped at two so self-recreating drift is reported as remaining instead of looping. emptyIssuesByKind, detectAll, groupByKind, runDrift
src/harness/validate/drift/types.ts Type definitions for UH-77 drift detection and repair: the DriftKind union, severities, DriftIssue, RepairResult and the DriftKindModule contract every drift kind implements.
src/harness/verdict.ts Records a manual verdict (UH-76) on an existing runtime-result.yaml while preserving its other fields, and appends a verdict.recorded line to .harness/audit.log. recordManualVerdict
src/harness/verify.ts Mission verification pipeline: runs required checks and acceptance-criterion commands (optionally inside the mission’s sandbox) with timeouts, checks expected outputs, gathers diff, hive, independent-review and decision-receipt signals, optionally consults TypeSafe System One, and writes the verification result. verifyMission, warnConstraintsAreAdvisory, readMissionAtLocation, readRunControlPolicyStop, runCommand, runCheck, buildTimeoutNotes, buildNotes, …
src/harness/workflow/adversarial-qa.ts Deterministic adversarial-QA verdict helper (UH-74) that evaluates six evidence gates (hostile scenarios, injection handling, interrupt/resume, orphaned worktrees, redaction guardrail, leaked artifacts) and renders a PASS or NEEDS-ATTENTION markdown report. evaluateAdversarialQa, writeAdversarialQaReport, renderMarkdown