feat(container): Phase E E1 — k9-svc deployment spec (standards#100)#38
Merged
Conversation
The integration plan in boj-server prescribes
container/gateway-deploy.k9.ncl by exact path (`docs/integration/
http-capability-gateway-plan.md` § Phase E, E1), and the rollout runbook
gates Phase E §2 staging cut-over on its existence (`docs/integration/
hcg-tier2-rollout-runbook.md` § 1.5 gateway-side prerequisites — the
checkbox for this file was the open item).
Shape mirrors the boj-server reference (`boj-server:container/
deploy.k9.ncl`) so the canonical k9-validate-action regex finds the
top-level `pedigree = { ... metadata = { name = ..., version = ... } ... }`
without traversing `let` bindings. The five-level pedigree (Snout /
Scent / Leash / Gut / Muscle) is filled in for the gateway: Hunt
security level, Linux + Podman target, MPL-2.0 licensed.
Per-environment config is sourced from the Phase A contract
(`http-capability-gateway-boj-contract.md` § 1, Transport):
- staging: BACKEND_URL=http://127.0.0.1:7700 (TCP loopback to BoJ).
- production: BACKEND_URL=http://unix:/run/boj/gnosis.sock:/
(loopback Unix domain socket; back-side TCP port never opened).
Trust source defaults to "header" in staging per plan § E2, flipped to
"mtls" in production after the §2.4 staging cert-rotation rehearsal.
Three TLS material env vars (MTLS_CA_CERT_PATH, GATEWAY_CERT_PATH,
GATEWAY_KEY_PATH) are declared so that a missing owner-supplied value
fails the deploy precheck rather than silently disabling mTLS.
`max_unavailable = 0` preserves the gateway's atomic policy-swap
guarantee across replica churn. Failure mode `fail-closed` matches the
boj-server `Trustfile.a2ml [SEAMS]` declaration for the gateway↔BoJ
seam (`failure_mode: "fail-closed (circuit breaker)"`).
Scripts are thin orchestration over the existing `Justfile` recipes
(`just container-build`, `just container-up`, `just container-down`);
the substantive rollback procedure lives in the runbook § 5 and is
not duplicated here.
The `signature` and `validation.checksum` fields are PLACEHOLDER —
they are populated at cerro-torre `.ctp` signing time per rollout
runbook § 1.5. This commit lands the declarative artefact; signing,
staging soak, percentage split, and the final Trustfile flip remain
owner-driven follow-ups.
Refs hyperpolymath/standards#91
Refs hyperpolymath/standards#100
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
🔍 Hypatia Security ScanFindings: 43 issues detected
View findings[
{
"reason": "Issue in boj-build.yml",
"type": "missing_timeout_minutes",
"file": "boj-build.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in casket-pages.yml",
"type": "missing_timeout_minutes",
"file": "casket-pages.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in casket-pages.yml",
"type": "missing_timeout_minutes",
"file": "casket-pages.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in codeql.yml",
"type": "missing_timeout_minutes",
"file": "codeql.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in dogfood-gate.yml",
"type": "missing_timeout_minutes",
"file": "dogfood-gate.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in dogfood-gate.yml",
"type": "missing_timeout_minutes",
"file": "dogfood-gate.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in dogfood-gate.yml",
"type": "missing_timeout_minutes",
"file": "dogfood-gate.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in dogfood-gate.yml",
"type": "missing_timeout_minutes",
"file": "dogfood-gate.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in dogfood-gate.yml",
"type": "missing_timeout_minutes",
"file": "dogfood-gate.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in governance.yml",
"type": "missing_timeout_minutes",
"file": "governance.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
}
]Powered by Hypatia Neurosymbolic CI/CD Intelligence |
Hypatia `code_safety: ncl_http_url` (CWE-319) flagged the two literal loopback URLs in the staging/production `backend_url` fields. The URLs are intentional per the Phase A contract § 7 — the mTLS boundary is client → gateway; the gateway → BoJ hop is loopback-isolated and does not itself require TLS — but the wire form does not need to live in this file. The contract document is its canonical site. Replaces `backend_url = "http://127.0.0.1:7700"` and `backend_url = "http://unix:/run/boj/gnosis.sock:/"` with a structured `backend` block (`transport` + `host`/`port` for staging, `transport` + `socket_path` for production). The wire-form `BACKEND_URL` env var is composed from these components at deploy time per the contract; the comment block above `let deployment` points readers at the contract for the canonical form. Same load-bearing facts; no literal http:// string in the file. Refs hyperpolymath/standards#91 Refs hyperpolymath/standards#100 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
🔍 Hypatia Security ScanFindings: 42 issues detected
View findings[
{
"reason": "Issue in boj-build.yml",
"type": "missing_timeout_minutes",
"file": "boj-build.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in casket-pages.yml",
"type": "missing_timeout_minutes",
"file": "casket-pages.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in casket-pages.yml",
"type": "missing_timeout_minutes",
"file": "casket-pages.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in codeql.yml",
"type": "missing_timeout_minutes",
"file": "codeql.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in dogfood-gate.yml",
"type": "missing_timeout_minutes",
"file": "dogfood-gate.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in dogfood-gate.yml",
"type": "missing_timeout_minutes",
"file": "dogfood-gate.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in dogfood-gate.yml",
"type": "missing_timeout_minutes",
"file": "dogfood-gate.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in dogfood-gate.yml",
"type": "missing_timeout_minutes",
"file": "dogfood-gate.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in dogfood-gate.yml",
"type": "missing_timeout_minutes",
"file": "dogfood-gate.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in governance.yml",
"type": "missing_timeout_minutes",
"file": "governance.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
}
]Powered by Hypatia Neurosymbolic CI/CD Intelligence |
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.
Summary
Lands
container/gateway-deploy.k9.ncl— the Phase E E1 deliverable the integration plan prescribes by exact path (boj-serverdocs/integration/http-capability-gateway-plan.md§ Phase E, E1: "Add a k9-svc deployment spec atcontainer/gateway-deploy.k9.nclin the gateway repo").Phase D (
standards#99) joint-closed via boj-server#168 on 2026-06-01. Phase E (standards#100) is now the active phase in the single-lane HCG tier-2 wiring channel rooted atstandards#91. The rollout runbook (boj-server:docs/integration/hcg-tier2-rollout-runbook.md) § 1.5 "Gateway-side prerequisites" listed this file's existence as an open checkbox; this PR flips that single prereq and only that prereq — staging soak (§ 2), production traffic split (§ 3) and the finalTrustfile.a2ml [CLOUDFLARE_EDGE_SECURITY].rate_limiting.tier_2_gatewayflip (§ 6.4) remain owner-driven follow-ups gated on real infrastructure.What this PR lands
container/deploy.k9.ncl. Top-levelpedigree = { ... metadata = { name = ..., version = ... } ... }shape matches the canonicalhyperpolymath/k9-validate-actionline-based regex.http-capability-gateway-boj-contract.md):staging:BACKEND_URL=http://127.0.0.1:7700(TCP loopback to BoJ on:7700).production:BACKEND_URL=http://unix:/run/boj/gnosis.sock:/(loopback Unix domain socket; back-side TCP port never opened).Both forms are single-backend and within the gateway proxy module's current capability per the contract.
"header"in staging (plan § E2), flipped to"mtls"in production after the runbook § 2.4 staging cert-rotation rehearsal. The flip is a config change, not a code change — the mTLS code path landed in Phase B: mTLS as the primary trust-level path #10 (Phase B).MTLS_CA_CERT_PATH,GATEWAY_CERT_PATH,GATEWAY_KEY_PATH) declared so a missing owner-supplied value fails the deploy precheck rather than silently disabling mTLS.max_unavailable = 0preserves the gateway's atomic policy-swap guarantee across replica churn.failure_mode = "fail-closed"matches the boj-serverTrustfile.a2ml [SEAMS]declaration for the gateway↔BoJ seam (failure_mode: "fail-closed (circuit breaker)").Justfilerecipes (just container-build,just container-up,just container-down). The substantive rollback procedure lives in the runbook § 5 and is not duplicated here; the script covers the immediate-bypass step and points at § 5 for permanent-disable.What this PR deliberately does NOT do
pedigree.security.signatureandpedigree.validation.checksumarePLACEHOLDER— they are populated at cerro-torre.ctpsigning time per runbook § 1.5 ("Gateway Containerfile built and signed as a.ctpbundle via cerro-torre"). Signing is a separate operator action with its own key-handling discipline.standards#100. The runbook § 6.5 prescribes that close-out happens after the §6.4 Trustfile flip, which itself follows the §3.3 100% soak window. This PR lands one of many gating artefacts; usingRefsnotClosesper that single-lane discipline (and matching the Phase D pattern of multipleRefsPRs ending in oneClosesPR — perf(d-2): real loopback backend fixture for proxy-200 scenario (standards#99) #14, perf(d-3): dedicated trust-header rewrite + mTLS handshake scenarios (standards#99) #22, perf(d-4 bootstrap): workflow_dispatch automation for baseline collection (standards#99) #26, perf(d-3 followup): harden compare.exs against schema drift (standards#99) #30 allRefs'd #99 before boj-server#168 closed it).BojRest-side artefact. All boj-side prereqs (loopback bind in #130/#131/#132, NetworkPolicy in #173, policy-file SSE-route coverage in #165) are already merged; this PR is gateway-side only.Verification
boj-server:container/deploy.k9.ncl(verified by side-by-side comparison of thepedigreeblock structure).MPL-2.0matches repo convention (mix.exs,.formatter.exs,config/*.exs).nickel typecheck container/gateway-deploy.k9.ncl— to be run by maintainer before bundle-signing (Nickel toolchain not in CI for this repo yet).k9-svc validate container/gateway-deploy.k9.ncl— same; gates the cerro-torre.ctpstep.Channel position
Refs hyperpolymath/standards#91
Refs hyperpolymath/standards#100
🤖 Generated with Claude Code
Generated by Claude Code