Commit da74a5f
feat(scripts): hcg-policy-smoke.sh — §1.5 operator pre-check (Phase E) (#210)
## Summary
Lands `scripts/hcg-policy-smoke.sh` — a checked-in smoke that exercises
the HCG tier-2 live Verb Governance Spec
(`config/gateway-policy-boj.yaml`) from outside the gateway. Replaces
the manual probe sequence the rollout runbook §1.5 last open item
formerly described as "out of band — operator pre-check".
Single-lane HCG tier-2 channel (`standards#91`). Phase A (#96), B (#97),
C (#98), D (#99) are joint-closed; Phase E (`standards#100`) is the
active phase. This PR lands one tractable artefact (§1.5 operator
pre-check now checked-in and reproducible); staging soak (§2),
production traffic split (§3), and the §6.4 Trustfile flip remain
owner-driven.
## What this PR lands
- **`scripts/hcg-policy-smoke.sh`** — POSIX-conformant bash + curl, no
jq/yq dependency.
- **Deny mode (default)**: sends one no-trust-header probe to every
non-public route in the live policy (25 routes spanning the 19
authenticated and 6 internal+stealth entries) and asserts a 4xx
response. The 4xx assertion covers both bare 403 and stealth-profile
codes regardless of the gateway's `:stealth_profiles` runtime
config. Plus a default-deny verb canary (DELETE /cartridges, PUT
/health, PATCH /cartridges) confirming `global_verbs: [GET, POST]`
enforces the ADR-0004 verb-governance invariant for un-listed verbs.
Gateway-internal — BoJ does **not** have to be reachable.
- **`--with-backend` mode**: additionally probes the allow path with
`X-Trust-Level: authenticated` (and `internal` for internal+stealth
routes), asserting the response is NOT a gateway-origin 4xx (2xx /
3xx / 5xx all pass — BoJ's own status is fine; only a gateway deny
is a failure). Requires BoJ reachable at the gateway's `BACKEND_URL`
and the script to run from a trusted-proxy IP so the trust header is
not stripped by the gateway's `strip_untrusted_headers` plug.
- Exits 0 on all-PASS, 1 on any FAIL (with per-probe summary), 64 on
usage error.
- **Runbook §1.5** — last unchecked operator pre-check item flips from
a free-form "stand the gateway up ... exercise one allow + one deny
per route" sequence (which was deferred to boj-server#165's test plan
and documented as out-of-band) to a single
`scripts/hcg-policy-smoke.sh` invocation. The PASS/FAIL summary
attaches to the cut-over ticket; a single FAIL is a stop-the-rollout
condition with the three failure modes named (policy not enforcing,
BoJ unreachable, non-trusted-proxy caller stripping the header).
- **Runbook header** — version 0.3 → 0.4; date 2026-06-09 → 2026-06-10;
status line acknowledges the smoke script landing alongside the
existing live policy promotion.
- **Runbook Appendix B** — new cross-reference entry for
`scripts/hcg-policy-smoke.sh`.
## What this PR deliberately does NOT do
- **Close `standards#100`.** Per runbook §6.5 the joint-close happens
after the §6.4 Trustfile flip (`tier_2_gateway.status: PENDING →
DEPLOYED`), which itself follows the §3.3 100% production-soak
window. Using `Refs` to match the Phase E PR convention established
by #208 / #38 / #168 and documented in §6.5 ("Do not self-close
standards#100; joint-close is owner-only per the single-lane channel
discipline"). The owner remains the sole closer of `standards#100`.
- **Touch HCG.** This is a BoJ-side artefact: the script lives in
`scripts/`, reads `config/gateway-policy-boj.yaml`, and probes the
gateway over HTTP. No companion PR on the gateway repo required.
- **Run during CI deployment.** The script is checked in but only the
operator's explicit invocation against a live gateway URL exercises
it. CI does not stand up a gateway to run it (would require an
external service); the script is intentionally operator-driven, with
the PASS/FAIL summary attached to the cut-over ticket as the
evidence-of-pre-check artefact.
- **Diverge the policy from the script's route matrix.** The script's
route matrix mirrors the 25-route live policy. When the policy file
evolves (new BoJ surface routes wired in), the script must be updated
in lock-step — that is a benefit not a cost (the script doubles as a
policy-completeness checklist), but it must be observed.
## Verification
- [x] `bash -n scripts/hcg-policy-smoke.sh` — syntax check passes.
- [x] `scripts/hcg-policy-smoke.sh` (no args) — exits 64 (usage error).
- [x] `scripts/hcg-policy-smoke.sh --help` — exits 64 with full help.
- [x] Against a synthetic always-403 mock on :18443 — `PASS=28 FAIL=0`,
exits 0 (deny-only mode covers all 25 policy routes + 3 verb
canaries).
- [x] Against a closed port (no gateway up) — every probe FAILs with
`got=000 expected=deny`; exits 1 with the FAIL line summary.
- [x] SPDX header `MPL-2.0` matches repo convention (scripts/, docs/).
- [x] Runbook cross-references resolve (`§1.5`, Appendix B, sibling
docs).
## Channel position
```
standards#91 (parent, open)
├── #96 Phase A — closed (boj-server: contract + policy-authoring + example; gateway: -)
├── #97 Phase B — closed (gateway#10: mTLS primary path)
├── #98 Phase C — closed (gateway#11: strip; boj-server#106: TrustPolicy clause)
├── #99 Phase D — closed (boj-server#168 on 2026-06-01; gateway#12/#14/#22/#26/#30)
└── #100 Phase E — IN PROGRESS
├── E5 runbook draft — boj-server#128 (landed; rehearsal pending)
├── E1 loopback prereqs — boj-server#130/#131/#132/#165/#173 (landed)
├── E1 deploy spec — http-capability-gateway#38 (landed)
├── E1 live policy promotion — boj-server#208 (landed)
├── §1.5 operator pre-check smoke — THIS PR (in review)
├── E1 .ctp signing — owner follow-up
├── E2 staging cut-over — owner follow-up
├── E3 telemetry verification — owner follow-up
├── E4 production rollout — owner follow-up
└── §6.4 Trustfile flip + §6.5 joint-close — owner-only
```
Refs hyperpolymath/standards#91
Refs hyperpolymath/standards#100
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---
_Generated by [Claude
Code](https://claude.ai/code/session_01SE4pkWg8SEKsSWK9geD5r9)_
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>1 parent a289907 commit da74a5f
2 files changed
Lines changed: 250 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
| |||
312 | 312 | | |
313 | 313 | | |
314 | 314 | | |
| 315 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
0 commit comments