Skip to content

Commit b79b0a4

Browse files
HTTP capability gateway (Phase 11) + illustrated wiki & reference docs (Phase 12) (#63)
* feat(http): outbound HTTP capability gateway with enforced deadlines Zig 0.15's std.http.Client.fetch has no timeout and owns its socket, so a hung VeriSimDB/Steam/Groove endpoint blocked the calling thread forever and the STEAM_API_TIMEOUT_MS / GROOVE_TIMEOUT_MS constants were inert. Following the estate's http-capability-gateway direction ("HTTP verbs/routes become declared capabilities, not accidents" — one policy-driven mediation layer), this applies the same idea to GSA's OUTBOUND calls. New src/interface/ffi/src/http_capability.zig is the ONLY caller of fetch in the FFI layer; every call site declares an OutboundCapability (verb, host_allow, deadline_ms, purpose/narrative, label, trust — names mirror the gateway DSL) and call() enforces a host allow-list (default-deny) and a hard wall-clock deadline. Deadline mechanism (fetch cannot be cancelled): a worker thread runs the opaque fetch; the caller waits on std.Thread.Semaphore.timedWait(deadline). This bounds the caller uniformly for plain HTTP and TLS (Steam) alike, since it sits above fetch. Ownership is a 2-count refcount on a shared RequestBox backed by c_allocator (malloc — thread-safe, process-lifetime), so a worker that outlives a timed-out caller never touches a transient allocator; the last releaser frees, with no write-after-free and no leak. A bounded MAX_OUTSTANDING worker cap fails fast (Backpressure) rather than piling up blocked threads — the client-side echo of the gateway's circuit breaker. - verisimdb/steam/groove clients: all four fetch sites collapse to one call(); their http.Client fields are removed (the worker owns a fresh client). The three timeout constants (+ new VERISIMDB_TIMEOUT_MS) are now load-bearing. A deadline hit maps to probe_timeout; other failures keep their codes. No new GsaResult variant, so no Types.idr/ABI regen. - MockHTTP added to the harness (respond_ok / never_respond / slow_respond); its teardown closes held sockets so abandoned workers unblock and drain (http_capability.waitQuiescent) before the leak check. - 5 behavioral tests: hung endpoint returns within the deadline (not forever), happy-path body, slow-respond passes/fails by deadline, default-deny without a socket, host-allow matching. 167 tests green across six suites + 104 fuzz. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TaWWedv6VQqeZaPvc94keN * docs: illustrated wiki (Mermaid) + 5 reference docs (Phase 12) Completes the remaining `planned` documentation. Two complementary layers: Illustrated wiki (docs/wikis/, GitHub-native Mermaid diagrams): Home, 02-Architecture, 03-Installation, 04-Probing-and-Games, 05-The-Proven-ABI, 06-HTTP-Capability-Gateway, 07-GUI-and-Nexus-Setup, 08-Deployment-Topology, 09-Troubleshooting, 10-Contributing. Deliberately blunt about what works today vs. what needs the estate; 09-Troubleshooting is the direct first-run "why isn't this working" guide. Reference docs (AsciiDoc): developer/FFI-MODULE-REFERENCE, developer/PANEL-EXTENSION-GUIDE, developer/ARCHITECTURE-RATIONALE, maintainer/CI-CD-GUIDE, maintainer/SECURITY-SCANNING-RUNBOOK. docs/INDEX.adoc: mark all of the above live; add the wiki map; note the standards-estate reusable pin has moved past the historically-cited SHA (NEUROSYM.a2ml still cites the stale value — flagged for follow-up). All content verified against source; tri-license SPDX headers (CC-BY-SA-4.0 on docs). No code changes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TaWWedv6VQqeZaPvc94keN * docs: make GS007 branch-count note number-agnostic The live Hypatia GS007 count drifts upward as each phase PR leaves a merged branch behind; the runbook cited a stale fixed figure. State the mechanism, not a snapshot number. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TaWWedv6VQqeZaPvc94keN --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 309accc commit b79b0a4

23 files changed

Lines changed: 3305 additions & 116 deletions

docs/INDEX.adoc

Lines changed: 46 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,12 @@ _You run and administer game servers via the Gossamer GUI and the `gsa` CLI._
2121
| `README.adoc` | live | Overview, quick-start, `gsa` CLI reference, supported games
2222
| `USER-CONFIG.md` | live | Nickel config: defaults, favourites, troubleshooting
2323
| `docs/QUICKSTART.adoc` | thin | One-liner pointer — not a real getting-started
24-
| GUI panel guide | *planned* | One section per panel (8: server-browser, config-editor, server-actions, live-logs, health-dashboard, config-history, cross-search, nexus-setup). **`nexus-setup`, the 7-step provisioning wizard, is entirely undocumented.**
25-
| Game-profile selection | *planned* | Which game → which of the 18 profiles; port/protocol table
26-
| Admin workflows | *planned* | Add a server; manage config across servers; roll back via config history
24+
| `docs/wikis/Home.md` | live | **Illustrated wiki** — narrative tour with Mermaid diagrams; start here
25+
| `docs/wikis/03-Installation.md` | live | Honest install guide: what works today, exact prereqs, verify steps
26+
| `docs/wikis/07-GUI-and-Nexus-Setup.md` | live | All 8 panels + the 7-step `nexus-setup` provisioning wizard (was undocumented)
27+
| `docs/wikis/04-Probing-and-Games.md` | live | Probe pipeline + the 18-game profile/protocol/format table
28+
| `docs/wikis/09-Troubleshooting.md` | live | Symptom → cause → fix for the common first-run failures
29+
| Admin workflows | *thin* | Covered piecewise in the wiki (server-actions, config-history); a single end-to-end runbook is still a gap
2730
|===
2831

2932
== Developers
@@ -37,11 +40,14 @@ _You build GSA, extend it, or contribute code across the Gossamer GUI → Zig FF
3740
| `docs/developer/ABI-FFI-README.adoc` | live | Idris2 ABI + Zig FFI standard; C/Idris2/Rust/Julia examples (strong)
3841
| `TOPOLOGY.md` | live | System architecture + data flow
3942
| `docs/decisions/` | live | Architecture decision records (RSR adoption)
40-
| FFI module reference | *planned* | Per-module docs for the 11 FFI modules (signatures, the 18 result codes, examples)
41-
| Panel extension guide | *planned* | The PanLL clade system; registering a new panel; inheriting base clades
42-
| Game-profile authoring | *thin* | Expand the README snippet: field types, validation, port/protocol, debugging
43+
| `docs/developer/FFI-MODULE-REFERENCE.adoc` | live | Per-module docs for the FFI modules (every `gossamer_gsa_*` symbol, the 18 result codes, the handle lifecycle)
44+
| `docs/developer/PANEL-EXTENSION-GUIDE.adoc` | live | Panel anatomy + the clade system; `nexus-setup` as the worked example; the `host.html` wiring points
45+
| `docs/wikis/05-The-Proven-ABI.md` | live | The machine-checked ABI contract (codegen pipeline, 18 codes, linear handles) — the differentiator, illustrated
46+
| `docs/wikis/06-HTTP-Capability-Gateway.md` | live | How outbound HTTP is a declared, deadline-bounded, default-deny capability
47+
| `docs/wikis/10-Contributing.md` | live | Build/test, the ABI regen rule, conventions, tri-license SPDX, branch/PR flow
48+
| Game-profile authoring | *thin* | See `docs/wikis/04-Probing-and-Games.md`; a deep field-type/validation/debugging guide is still a gap
4349
| `docs/developer/CONFIG-FORMATS.adoc` | live | The 8 formats, detection order, `addField` invariants, YAML scope, and how to add a parser
44-
| Architecture rationale | *planned* | Why Ephapax / Idris2 / Zig / VeriSimDB; when to touch each layer
50+
| `docs/developer/ARCHITECTURE-RATIONALE.adoc` | live | Why Ephapax / Idris2 / Zig / VeriSimDB; when to touch each layer
4551
|===
4652

4753
== Maintainers
@@ -56,11 +62,18 @@ _You release, run CI/CD, operate containers, and manage governance + security sc
5662
| `docs/DEPLOYMENT-RUNBOOK.adoc` | live | Build, container, VeriSimDB main+backup, health, backup/restore
5763
| `SECURITY.md` | live | Vulnerability reporting
5864
| `docs/maintainer/RELEASE-CHECKLIST.adoc` | live | CI gates (6 suites + ABI contract), version/license/docs gates, manual gates, tag steps
59-
| CI/CD guide | *planned* | `.github/workflows/` structure, standards-estate reusables (pins `4ddc926`), staleness check, adding a check
60-
| Security-scanning runbook | *planned* | Running/interpreting Hypatia + panic-attack + Scorecard; the `.hypatia-ignore` suppression mechanism (NOT `.hypatia-baseline.json` — see `NEUROSYM.a2ml`)
61-
| Container/quadlet ops | *thin* | Expand the runbook: `.container` format, systemd user units, day-to-day ops
65+
| `docs/maintainer/CI-CD-GUIDE.adoc` | live | All 16 workflows, the ABI-contract + version-drift gates, standards-estate reusable pins, adding a check
66+
| `docs/maintainer/SECURITY-SCANNING-RUNBOOK.adoc` | live | Running/interpreting Hypatia + panic-attack + Scorecard; the `.hypatia-ignore` suppression mechanism (NOT `.hypatia-baseline.json` — see `NEUROSYM.a2ml`)
67+
| `docs/wikis/08-Deployment-Topology.md` | live | Podman quadlets, the two VeriSimDB instances (`:8090`/`:8091`), the `container/` map — the illustrated deployment view
68+
| Container/quadlet ops | *thin* | The wiki covers the topology; a day-to-day systemd-unit ops guide is still a gap
6269
|===
6370

71+
NOTE: the standards-estate reusable-workflow pin cited historically as `4ddc926`
72+
has since been bumped (governance/scorecard and secret-scanner/mirror now pin
73+
newer SHAs — see `docs/maintainer/CI-CD-GUIDE.adoc` for the current values).
74+
`.machine_readable/6a2/NEUROSYM.a2ml` still cites the stale SHA and should be
75+
updated in a follow-up.
76+
6477
== Machine-readable layer
6578
_For AI agents and tooling. Read `0-AI-MANIFEST.a2ml` FIRST._
6679

@@ -70,14 +83,30 @@ _For AI agents and tooling. Read `0-AI-MANIFEST.a2ml` FIRST._
7083
* `.hypatia-ignore` — reviewed false-positive suppressions (the active mechanism).
7184
* `.claude/CLAUDE.md` — human-friendly codebase guide.
7285

73-
== Wiki status
74-
`docs/wikis/` is a stub that declares an intent to sync to a forge-hosted wiki but
75-
is **unpopulated**. The `docs/` tree also carries several empty placeholder
76-
subtrees (`theory/`, `reports/`, parts of `practice/`).
86+
== The wiki
87+
`docs/wikis/` is now the **illustrated narrative tour** of GSA — a 10-page,
88+
Mermaid-diagrammed wiki that complements the audience-segmented reference docs
89+
above. Start at `docs/wikis/Home.md`; it links every page.
90+
91+
[cols="2,4"]
92+
|===
93+
| Page | Covers
94+
95+
| `Home.md` | Landing page + ecosystem diagram + navigation
96+
| `02-Architecture.md` | The four layers, data-flow sequence, graceful degradation
97+
| `03-Installation.md` | Honest install guide (what works today)
98+
| `04-Probing-and-Games.md` | Probe pipeline + the 18-game table
99+
| `05-The-Proven-ABI.md` | The machine-checked ABI contract (the differentiator)
100+
| `06-HTTP-Capability-Gateway.md` | Outbound HTTP as a declared, deadline-bounded capability
101+
| `07-GUI-and-Nexus-Setup.md` | The 8 panels + the 7-step provisioning wizard
102+
| `08-Deployment-Topology.md` | Podman quadlets + the two VeriSimDB instances
103+
| `09-Troubleshooting.md` | Symptom → cause → fix for common first-run failures
104+
| `10-Contributing.md` | Build/test, ABI regen, conventions, tri-license, PR flow
105+
|===
77106

78-
*Decision pending:* either populate `docs/wikis/` and sync it, **or** (recommended)
79-
consolidate all narrative under `docs/` using the three audience paths above and
80-
prune the empty scaffolding. Until then, this index is the single navigation point.
107+
The wiki is written in GitHub-flavoured Markdown with native Mermaid diagrams, so
108+
it renders both in-repo and if synced to a forge-hosted wiki. The remaining `docs/`
109+
scaffolding decision (below) is unchanged.
81110

82111
NOTE: a mechanical prune is **not** clean — `verification/`, `docs/theory/`,
83112
`docs/reports/`, and `docs/wikis/` are referenced by the governance layer

0 commit comments

Comments
 (0)