Repository navigation
214 lines (210 loc) · 12.3 KB
/
Copy pathdde.yml
File metadata and controls
214 lines (210 loc) · 12.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
name: DDE Evidence Cycle
# The delivery/dispute boundary has its own badge-visible workflow: the DDE
# badge on the README is this file's status, so evidence surveillance is a
# first-class signal for any visitor — not a job hidden inside general CI.
# Steps are byte-identical to the former `dde` job in ci.yml, plus the fuzz
# modes now documented in the reviewer commands table (a fixed 50-round seed
# as the regression gate, a commit-seeded 25-round explorer that sees a new
# deterministic combination on every push while remaining replayable, and a
# weekly multi-seed sweep that runs several seeds in one labeled report).
# The mutation set covers the F3 closure chain (closedAtUtc series, 13
# single mutations) — kept 1:1 with the reviewer-commands table by the
# reviewer-table contract.
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
# Weekly multi-seed sweep (Saturday 03:07 UTC): wider discovery over a
# fixed seed list, independent of any push.
- cron: "7 3 * * 6"
permissions:
# contents: write — trend tracking: append perf-history.jsonl + push it.
# pages: read — WITHOUT this the workflow token gets a bare 404 from the
# Pages builds API, which pages-settle.mjs reads as "no build yet" → the
# settle guard ran BLIND in every cycle ("no-build-yet" at waitedMs:0 in
# the run log is the signature) and the median push kept cancelling the
# content build (C26 root-caused the race; the token 404 re-opened it).
contents: write
pages: read
jobs:
dde:
name: DDE evidence cycle (deterministic · replayed · adversarial)
runs-on: ubuntu-latest
steps:
# Deterministic regeneration + byte-diff proves the evidence factory is
# reproducible; the replay re-derives the fail-closed gate; the tamper
# path proves detection fires. Together: the delivery/dispute boundary
# is under continuous evidence surveillance, not a one-time capture.
- uses: actions/checkout@v7
# Lockfile guard BEFORE setup-node (class-H): setup-node's `cache: npm`
# fails opaque when package-lock.json is absent (red run 34440426922).
- name: Guard - lockfile present + workspace sync (before setup-node)
run: node scripts/check-lock-sync.mjs
- uses: actions/setup-node@v7
with:
node-version: 22
cache: npm
- name: Guard - workflow YAML (zero-jobs trap)
run: node scripts/check-workflows.mjs
- run: npm ci
- name: Deterministic regeneration produces byte-identical records
run: |
node examples/delivery-fixture/make-fixture.mjs > /dev/null
if [ -n "$(git diff --stat -- examples/delivery-fixture)" ]; then
echo "::error::regenerated fixture differs from the committed bytes — the evidence factory is not deterministic"
git diff -- examples/delivery-fixture | head -40
exit 1
fi
echo "fixture regeneration: byte-identical ✓"
- name: One-command replay of the full fail-closed gate
run: node examples/delivery-fixture/verify-fixture.mjs
- name: Tamper path — one flipped byte must fail closed
run: |
node examples/delivery-fixture/verify-fixture.mjs --tamper logo.svg > /dev/null 2>&1 && {
echo "::error::tampered fixture verified — detection did not fire"
exit 1
}
echo "tamper detection: exit 1 on one flipped byte ✓"
- name: Adversarial runner — every F/E/B check catches its own mutation
run: node examples/delivery-fixture/adversarial-runner.mjs
- name: Compound batteries — stacked mutations must never blind each other
run: node examples/delivery-fixture/adversarial-runner.mjs
- name: Fuzz mode — seed-deterministic random stacks must all be caught
run: node examples/delivery-fixture/adversarial-runner.mjs --fuzz 50 --seed 424242
# Commit-seeded fuzz: the seed is derived from the pushed commit hash,
# so every push explores a NEW deterministic stack combination while a
# given push stays perfectly replayable (sha → seed is pure arithmetic;
# anyone can re-run the exact rounds with the seed the log prints).
# 25 rounds — a named explorer, not the fixed 50-round regression above.
- name: Fuzz mode — commit-seeded exploration (new combinations per push, replayable)
run: |
SHA="$(git rev-parse HEAD)"
SEED=$((0x${SHA:0:8} % 2147483647))
echo "commit $SHA → fuzz seed $SEED"
node examples/delivery-fixture/adversarial-runner.mjs --fuzz 25 --seed "$SEED"
# Multi-seed sweep: several seeds in ONE report, every seed labeled with
# its run number — wider discovery in a single command. Weekly (plus
# every push, at a smaller round count, so the mode itself stays under
# continuous watch and cannot rot between scheduled sweeps).
- name: Fuzz mode — multi-seed sweep (one report, per-seed labeled runs)
run: node examples/delivery-fixture/adversarial-runner.mjs --fuzz 10 --seeds 424242,777,9001,31337
# Per-cycle perf budget — documented in the reviewer-commands table and
# unit-tested (fixture.test.js), so it must also run in the workflow:
# over-budget cycles print named PERF WARNINGs but never flip the
# correctness verdict (performance and correctness reported separately).
- name: Perf budget — per-cycle timing reported, correctness verdict untouched
run: node examples/delivery-fixture/adversarial-runner.mjs --fuzz 50 --budget-ms 250
- name: Agent-platform payout gate — 4 holds, 1 release (boundary arc)
run: node examples/agent-platform-integration/run-integration-demo.mjs
- name: Wire payout gate — scenario rejection over the DDE HTTP endpoint
run: node examples/agent-platform-integration/run-http-payout-gate.mjs
- name: DDE SDK perf — verify budget must hold (median < 50ms)
run: node scripts/benchmark-dde.mjs --json > /tmp/bench-sdk.json
- name: DDE wire perf — full loopback /verify round trip (median < 150ms, engine split)
run: node scripts/benchmark-dde-http.mjs --json > /tmp/bench-wire.json
# Evidence artifacts: the two runner reports (--json medians) upload as
# run artifacts so a reviewer can pull the FILES after the run — a log
# line scrolls, an artifact is evidence. 30-day retention is PINNED (an
# unpinned retention silently defaults and drifts). The upload sits
# BEFORE the trend step (which gates and may defer) so the evidence
# lands even when the gate goes red, and if-no-files-found: error fails
# a green-shaped run whose reports silently went missing — evidence is
# fail-closed, not best-effort.
- name: Upload runner reports (SDK + wire) as run artifacts
uses: actions/upload-artifact@v4
with:
name: dde-runner-reports
path: |
/tmp/bench-sdk.json
/tmp/bench-wire.json
retention-days: 30
if-no-files-found: error
# Performance trend tracking: append this push's medians to the history
# file and gate against the trailing 5-run baseline (drift beyond 2x =
# red). The file is committed back so the next push baselines against
# real CI numbers — history is evidence, append-only. PR runs gate but
# do NOT record (only main pushes write history).
- name: Performance trend — gate medians against the trailing baseline
if: github.event_name == 'push'
env:
GH_TOKEN: ${{ github.token }}
run: |
node scripts/benchmark-trend.mjs --file /tmp/bench-sdk.json
node scripts/benchmark-trend.mjs --file /tmp/bench-wire.json
# Live perf badges: regenerate from the just-appended history so the
# repo page always shows the last CI-measured medians. Part of the
# same bot commit — badge and trend point can never diverge.
node scripts/benchmark-trend.mjs --badges
# Commit the appended history so the next push baselines on real CI
# numbers. Two cases `git diff --stat` alone misses: the file is
# still UNTRACKED (first-ever recording) and appended-but-unstaged
# lines — handle both explicitly. The bot commit carries [skip ci]
# so recording does not re-trigger this workflow (no CI loop).
NEEDS_COMMIT=0
if [ -f benchmarks/perf-history.jsonl ]; then
if ! git ls-files --error-unmatch benchmarks/perf-history.jsonl > /dev/null 2>&1; then
NEEDS_COMMIT=1
elif ! git diff --quiet HEAD -- benchmarks/perf-history.jsonl; then
NEEDS_COMMIT=1
elif ! git diff --quiet HEAD -- docs/badges; then
NEEDS_COMMIT=1
fi
fi
if [ "$NEEDS_COMMIT" = "1" ]; then
# Pages-build race guard (pages-settle.mjs), called TWICE and
# PINNED BOTH TIMES to the CONTENT commit (HEAD here — the median
# is created only later):
# call 1 UNPINNED-CALL HAZARD: an unpinned settle after the
# push sees the content build in flight → "settled:
# false" → the trend defers EVERY cycle and the history
# starves. Pinning call 1 to HEAD makes the guard wait
# for the content build to register AND finish (its own
# SHA, terminal, aged) before the median is even written
# — so by the time call 2 re-checks, settling is a
# confirmation, not a wait.
# call 2 the push gate: identical pin (HEAD == the content
# commit at this moment; HEAD~1 would be the PREVIOUS
# cycle's commit, whose "not on branch" answer
# short-circuits the guard — AGENTS.md [C27]).
if PAGES_SETTLE_SHA="$(git rev-parse HEAD)" PAGES_SETTLE_SITE_REQUIRED=1 node scripts/pages-settle.mjs; then
git config user.name "coreguard-trend-bot"
git config user.email "noreply@coreguard.local"
git add benchmarks/perf-history.jsonl docs/badges
git commit -m "chore(perf): record benchmark medians [skip ci]"
# Pin the settle to the CONTENT commit being published. At this
# moment HEAD IS the content commit (the median is not created
# until after settle) — HEAD~1 would be the PREVIOUS cycle's
# commit, whose "not on branch" answer short-circuits the guard
# and re-opens the race (AGENTS.md [C27]: identity, verified
# from the actual ref state, not from an assumption).
CONTENT_SHA="$(git rev-parse HEAD)"
PAGES_SETTLE_SHA="$CONTENT_SHA" PAGES_SETTLE_SITE_REQUIRED=1 node scripts/pages-settle.mjs && git push || \
{ echo "::warning::Content build for $(git rev-parse --short HEAD) not settled — deferring the median commit (self-heals on the next push)"; git reset --hard HEAD; }
else
echo "::warning::Pages build still in flight — deferring the median commit (self-heals on the next push)"
git reset --hard HEAD
fi
fi
- name: Performance trend — PR gate (no recording)
if: github.event_name == 'pull_request'
run: |
node scripts/benchmark-trend.mjs --status
node scripts/benchmark-trend.mjs --file /tmp/bench-sdk.json --dry-run
node scripts/benchmark-trend.mjs --file /tmp/bench-wire.json --dry-run
- name: DDE HTTP endpoint — live smoke over loopback
run: |
node --input-type=module -e "
import { startDeliveryEndpoint } from './packages/delivery/http.js';
const server = await startDeliveryEndpoint({ port: 0 });
const { port } = server.address();
const h = await fetch('http://127.0.0.1:' + port + '/health');
const body = await h.json();
if (h.status !== 200 || body.status !== 'OK' || !body.boundary.includes('does not decide delivery conformity')) {
console.error('health check failed — ' + h.status + ' ' + JSON.stringify(body).slice(0, 200));
process.exit(1);
}
await server.close();
console.log('HTTP endpoint: 200 OK with boundary banner ✓');
"