Shadow mode: anvil decides every pull request head and compares with its native suite runs (MQ-12 step 3a) #54
Loading…
Reference in a new issue
No description provided.
Delete branch "mq-12-shadow"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Step 3a ("shadow") of stage 3 of anvil: https://openproject.home.romaine.life/wp/MQ-12
anvil now runs pipeline-templates'
decide.mjsfor every pull request head, from the suites package pinned in the image, and sets each decision beside the check jobs the head's native suite runs actually ran. It starts no run and writes no status: nothing the queue or CI does changes.Removed: nothing.
Added
decide.go: on a pull requestopened,synchronizedorreopenedevent in any repository kept, once the head and base are in the clone, the repository's own detached worktree of its clone (underDATA_DIR/decide/work) is checked out at the head with--forceand cleaned, andnode suites/decide.mjs --dir --base <event's base sha> --head --repo --topics <repository's topics> --pr --tags <the clone's tags>runs. One decision per repository at a time, at most two node processes, 2-minute timeout, 768 MiB heap each, TMPDIR/HOME on the volume, no network or token for node (GIT_NO_LAZY_FETCH). The same head, base, topics and suites commit aren't decided twice.store.go: SQLite atDATA_DIR/anvil.db(modernc.org/sqlite, CGO off), versioned migrations in code (PRAGMA user_version):decisions(repo, pr, head, base, suites_sha, topics, result, error, decided_at) andshadow(repo, head, suite, pr, run, its raw job events, decided jobs, native outcome per check, mismatch, detail). Rows older than 30 days go at startup.shadow.go: job and run events of a suite's nativepull_requestrun (<suite>/ci.yml, no plan in its event) are kept per head and suite, newest run only, by job ID and attempt. Once the run ends (not cancelled), eachcheck-*job decide planned is compared with whether it ran; a matrix job counts for its check; a check its scope postedskipped"Identical inputs; passed on ..." counts as run (reused), since decide has no--passesyet. A mismatch is kept, counted (merge_queue_shadow_mismatch_total{suite}) and logged as awarnwith both job sets. A run that ends before its decision is compared once it is decided.GET /shadow(in-cluster; the route still carries only/healthand/goproxy): counts of decisions, failed decisions, comparisons and mismatches, and the newest mismatches.merge_queue_decisions_total{result}(ok, error, timeout) and the histogrammerge_queue_decide_seconds.@romaine-life/ci-suites0.1.6 (latest published; gitHead 3adae99, the v0.1.6 tag) bynpm packwith the CI job's packages sign-in as a build secret, checked against the pinned sha512 integrity,npm ci --omit=devin itssuites/; node and the package copied into the runtime stage withlibstdc++,CI_SUITES=/opt/ci-suites..npmrc(root): the registry sign-in line, which is what makes the suites give the image buildFORGEJO_PACKAGES_TOKEN(packages.mjs usesPackages). No package.json.decide.mjsand everything it imports.CI_SUITESset, skipped otherwise, so CI skips it), per-repository serialization, a timeout, which pull request events ask for a decision, store round trip and retention, mismatch detection from job events (disagreement, reuse, a run ending before its decision, cancelled runs, started runs, other runs, reruns, matrix jobs).Changed
webhook.go: reads the pull request's base sha and the run's id, status, workflow, event, link and event payload, and the job; hands pull request events to the decider and run events to the shadow comparison before the queue's own handling, which is unchanged.main.go: starts shadow mode after the landings (stops at start ifCI_SUITESnames no valid package or node is missing; off when unset).k8s/deployment.yaml: memory limit 1Gi to 2Gi.Left alone: the queue, lines, groups, landings and module proxy; CI and pipeline-templates; no run is started and no status written.
prepare.go,landing.goandgroups.go(stage 6b's work) are untouched.🤖 Generated with Claude Code