Repository navigation
feat(ci): harden the Hermes contract gates - #30
Merged
offendingcommit merged 6 commits intoSep 21, 2026
Merged
offendingcommit merged 6 commits into
offendingcommit merged 6 commits into
Conversation
Proposal, design, and tasks for hardening the Hermes contract gates. No spec delta: this alters CI wiring and local task definitions and changes no capability-level requirement, so .openspec.yaml carries skip_specs rather than inventing a requirement to satisfy validation. The design records why each defect looks like success today -- a drift job that cannot fire on drift, a continue-on-error flag that renders green, a local lane that can only reach upstream main, and a Python 3.11 exit status that cannot distinguish a passing suite from a vanished one.
Three ways a contract run could report success without checking anything, all closed. Discovery consolidates into tests/_hermes_host.py. Nothing is auto-discovered any more: the old ~/hermes-agent fallback is what made a bare `just test` exercise whatever branch a developer had checked out while CI, which checks out nothing, skipped the module entirely. A named path stays authoritative and still raises on a bad one. Absence is only tolerated when nobody asked for a contract run. The recipes set HERMES_CONTRACT_REQUIRED, and a guard outside skipUnless fails when that signal is present and no host resolved. Without the signal the guard could only redden every push -- the blocking job checks out no Hermes revision and discovers both contract modules -- or never fire at all. Pin-targeted runs compare HEAD against the revision they claim, so a stale HERMES_AGENT_PATH is refused rather than receipting the wrong host. The suite runner asserts the executed-test count, because on Python 3.11 the exit status cannot distinguish a passing run from a vanished one. Verified against all three shapes: zero-collected refused, all-skipped refused, a genuine 16-test run accepted. Pinned and upstream lanes get separate checkout directories. Sharing one left a detached HEAD behind and the old `pull --ff-only || true` swallowed the error, so an upstream run silently re-tested the pin. Receipts observed: pinned f80f453 executed=16; upstream a6bab19 fails on the known #99220 media contract, naming the revision.
The blocking job now runs the full contract suite at the pin instead of the context-engine module alone -- 110 lines of an 853-line suite. The suite is green at f80f453, verified by running it there, so this adds coverage rather than risk. The two pin literals collapse to one, which U7 will hold against the harness constant. The drift lane moves out of test.yml into its own scheduled workflow. A job there could never fire on drift: test.yml triggers on push and pull_request, so it ran when this repo changed and never when Hermes moved. Job-level continue-on-error compounded it by rendering a failed job green in the checks list. The new workflow is daily, carries no continue-on-error, and is not a required check -- non-blocking without a flag that hides the result. Failures are classified against a committed baseline by fingerprint rather than test name. The lane launches knowingly red, because #99220 stays out of scope, and an unclassified report would name the same failure every run until nobody read it. Verified both directions: the known break classifies as known and exits 0; the same test with a changed cause classifies as new drift. The reporting step runs on always(), or the failure it reports would skip it. A push trigger sits alongside the schedule because scheduled workflows are disabled after 60 days of inactivity on a public repo -- the exact quiet period the alarm guards. That mitigates rather than removes the risk, and the design says so.
Extends the existing workflow-as-contract tests rather than adding a parallel mechanism, since that module already parses the workflows and asserts SHA pinning, just-only steps, and permissions. Seven properties, each one a way the gates could regress while still reporting green: the blocking job runs the full suite rather than the context-engine module; test.yml names exactly one Hermes pin and it equals the harness constant; the drift workflow keeps its schedule, its manual dispatch, and the push trigger that stops a 60-day quiet period disabling it; no job-level continue-on-error, which would render a failed run green in the checks list; the reporting step keeps always(), or the failure it reports skips it; the baseline exists and parses, since an empty one files every known failure as new; and the built wheel actually contains the harness module. Every one was mutation-tested rather than assumed. Narrowing the blocking job, disagreeing the pin, removing the schedule, dropping always(), adding continue-on-error, emptying the baseline, and dropping the module from the wheel each fail their guard, and the suite is green once restored. The drift workflow also joins the existing SHA-pinning, just-only, and permissions sweeps.
Four assumptions that would have failed off this machine. The drift fingerprint absorbed machine-specific text. A baseline committed from a laptop carried home directories, temp paths, ports and PIDs into the digest, so it matched where it was written and nowhere else -- every known failure would have classified as new in CI, which is exactly the noise the baseline exists to prevent. Absolute paths (POSIX, Windows, UNC), hex addresses, sha-like runs and multi-digit numbers now normalize before slugging. Small numbers are deliberately kept: "expected 3, got 5" is a different break from "expected 3, got 7", so flattening every digit would trade machine noise for lost signal. The cache location assumed a POSIX home. HERMES_PLUGIN_KIT_CACHE now overrides outright, then XDG_CACHE_HOME, then LOCALAPPDATA, then a writable home, then a temp directory. A container with no home or a read-only image no longer fails for a reason the caller cannot act on. The new checkout directories were not gitignored, so any contract run dirtied the tree. The drift workflow called python3 directly. It now goes through uv, matching the repo's own convention and avoiding an interpreter that resolves differently per platform. Tests cover each: identical fingerprints across POSIX, macOS and Windows paths, across temp directories, and across ports and PIDs; a resolvable cache location on any platform; and a missing git, an offline network, and a slow fetch each yielding the same unchecked report rather than a traceback or a hang.
…hermes-contract-gates
offendingcommit
marked this pull request as ready for review
September 21, 2026 21:07
This was referenced Sep 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #29 (
feat/plugin-contract-testing-harness). Review that first — this branch is based on it, so the diff here is only the gate work.Implements Change B of
docs/plans/2026-09-21-1406-feat-plugin-contract-testing-harness-plan.md.Why
The gate that blocks covers a tenth of the contract, and the lane that would warn about upstream drift cannot fire on drift.
push/pull_request, so it runs when this repo changes and never when Hermes moves. Job-levelcontinue-on-error: truealso renders it green in the checks list.just testauto-discovers~/hermes-agent, silently testing whatever branch a developer has; CI has no checkout and skips the module. Same command, two meanings.unittestexits 0 both when every test skips and when zero tests are collected, so a vanished contract lane is indistinguishable from a passing one.Hermes #99220 is the live proof: it broke the media contract against upstream and nothing reported it.
What changes
actions/checkoutconsumes theref:before Python exists.continue-on-error, so red is honestly red.Out of scope
The #99220 fix itself. This change makes it visible, not repaired.
Status
Draft — artifacts authored and validating; units U5, U6, U7 in progress.