Skip to content

Commit cb1b923

Browse files
hyperpolymathclaude
andcommitted
Close production gap + develop the AffineScript any-game interface
Production gap: - Fix Secret Scanner startup_failure on main (estate Bug B): grant the wrapper job the perms the pinned reusable's gitleaks job requests (pull-requests:write, actions:read) and repin standards d135b05->891b1ed — same pattern as the green Scorecard wrapper from PR #41 - Migrate deprecated metadata names per estate mandate (2026-06-30): .machine_readable/6a2/ -> descriptiles/, agent_instructions/ -> bot_directives/, all path references rewritten - Refresh STATE.a2ml / ROADMAP / CLAUDE.md to verified reality: v0.9.0, 40 exported FFI symbols, 13 modules, 140 passing tests (94/41/5), flake.nix gone (guix only), PRs #61-#63 reflected; record Instant Sync red as owner-gated blocker B5 (dead FARM_DISPATCH_TOKEN) AffineScript interface (the any-game surface): - NEW src/ui/tea/gsa_ffi.affine — full binding of all 38 libgsa C ABI exports as typed externs with / IO effect rows, opaque GsaPtr handle type, ResultCode enum mirroring Types.idr codes 0-17, and a cmd_* effect layer (bootstrap/probe/action/logs/health/profiles/provision/ drift/alert/steam) the host dispatches for the pure core - REWORK src/ui/tea/gsa_gui.affine — from disconnected skeleton to the real TEA core: 8 panels (adds NexusSetup), GameProfile registry model (18 shipped A2ML profiles + runtime adds + generic auto-detect fallback = any game), 15 Msg variants closing the host feedback loop, result-code status surface, subscriptions for log/health polling - Both files typecheck against the affinescript compiler (core face) - Guard rails: scripts/affine-ffi-contract-check.sh (no phantom bindings + 27-symbol core coverage), affine-ffi-contract job in abi-contract.yml, just affine-check / affine-contract recipes, affine-contract wired into just quality Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent b79b0a4 commit cb1b923

22 files changed

Lines changed: 806 additions & 69 deletions

.claude/CLAUDE.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
<!-- SPDX-License-Identifier: CC-BY-SA-4.0 -->
2+
<!-- Owner: Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk> -->
13
# CLAUDE.md — Game Server Admin (GSA)
24

35
## Quick Context
@@ -23,7 +25,7 @@ just run version # print version
2325
# Run unit tests (fast, no I/O)
2426
zig build test
2527

26-
# Run integration tests (36 tests, no live services)
28+
# Run integration tests (41 tests, no live services)
2729
zig build test-integration
2830

2931
# Run e2e smoke tests (full pipeline, no live services)
@@ -41,7 +43,7 @@ panic-attack assail .
4143
```
4244
Gossamer GUI (Ephapax .eph) -- src/core/, src/gui/panels/
4345
| IPC (gossamer:// protocol)
44-
Zig FFI (libgsa.so + gsa CLI) -- src/interface/ffi/src/ (11 modules)
46+
Zig FFI (libgsa.so + gsa CLI) -- src/interface/ffi/src/ (13 modules)
4547
| C ABI (18 result codes)
4648
Idris2 ABI (Types/Foreign/Layout) -- src/interface/abi/
4749
| REST (port 8090)
@@ -62,6 +64,8 @@ VeriSimDB (8-modality octads) -- container/verisimdb/
6264
| `groove_client.zig` | .well-known Groove voice alerting |
6365
| `abi_layout.zig` | Canonical C-ABI `extern struct`s + comptime Zig↔Idris layout cross-check |
6466
| `abi_serde.zig` | Binary ABI emitters + offset readers (`read_int`/`read_ptr`/…) — makes `Layout.idr` offsets a live contract |
67+
| `steam_client.zig` | Steam Web API (vanity→Steam64, player summary, ownership) |
68+
| `http_capability.zig` | HTTP capability gateway (Phase 11) — capability-scoped REST surface over the FFI |
6569
| `cli.zig` | Standalone CLI executable (status, probe, profiles, version) |
6670

6771
`abi_layout_expected.zig` is generated from `Layout.idr` by
@@ -79,13 +83,14 @@ VeriSimDB (8-modality octads) -- container/verisimdb/
7983
- **Backup** (port 8091, `GSA_BACKUP_VERISIMDB_URL`): game save metadata, snapshots, restore points
8084
- **Container images** use Chainguard Wolfi base, Podman, `Containerfile` (never Docker/Dockerfile)
8185

82-
## Current State (2026-06-21)
86+
## Current State (2026-07-07)
8387

84-
- **Completion**: 93% (15 phases built; v1.0.0 gates still open — see Remaining)
88+
- **Completion**: 96% (15 phases built; hardening phases 4–8, tri-license + 0.9.0 version SSOT, HTTP capability gateway + illustrated wiki merged via PRs #61#63; v1.0.0 gates still open — see Remaining)
89+
- **CI (2026-07-07)**: Secret Scanner startup_failure fixed (caller job-level perms + repin to standards@891b1ed); Instant Sync red is owner-gated (dead FARM_DISPATCH_TOKEN, estate-wide); `.machine_readable/` migrated 6a2→descriptiles, agent_instructions→bot_directives per estate mandate
8590
- **CI/Governance (2026-06-21, PRs #41#45)**: workflows hardened (Scorecard wrapper job perms, presence-gated instant-sync, CodeQL `actions`, scoped `deno` perms); standards reusable pins at `4ddc926`; Hypatia false positives suppressed via `.hypatia-ignore` (the inert `.hypatia-baseline.json` was removed — `hypatia scan` never applied it); advisory scan at critical=0/high=0. Doc map + gaps: `docs/INDEX.adoc`.
8691
- **Zig version**: 0.15.2 (see `.tool-versions`)
8792
- **Exported FFI symbols**: 40 (comptime linker hints in main.zig)
88-
- **Tests**: 124 Zig tests across 3 suites (unit: 80, integration: 39, smoke: 5). All passing.
93+
- **Tests**: 140 Zig tests across 3 suites (unit: 94, integration: 41, smoke: 5). All passing (verified 2026-07-07).
8994
- Security tests for command injection in server_actions
9095
- Config parser edge cases for all 8 formats
9196
- A2ML round-trip, diff, and secret redaction tests
@@ -95,7 +100,7 @@ VeriSimDB (8-modality octads) -- container/verisimdb/
95100
- **Cross-language ABI**: `abi_layout.zig` asserts (at compile time + `zig build test`) that the 8 `extern struct`s match the proven `Layout.idr` offsets/sizes; `abi_serde.zig` implements the offset readers/emitters so those offsets are a live runtime contract (was the open HIGH proof item)
96101
- **VeriSimDB**: Main on 8090 (built, running), backup on 8091 (game saves)
97102
- **Container**: Containerfile wired with real Zig build, entrypoint.sh execs gsa
98-
- **Nix/Guix**: Both flake.nix and guix.scm have real build/install phases
103+
- **Guix**: guix.scm has real build/install phases (flake.nix removed in the nix→guix migration)
99104
- **Release CI**: release.yml builds Zig, packages tarball, uploads artifacts
100105
- **Groove**: Full manifest with probe/config/drift/alert capabilities
101106
- **Icon**: SVG + 256px PNG in assets/
@@ -113,7 +118,7 @@ VeriSimDB (8-modality octads) -- container/verisimdb/
113118
| What | Where |
114119
|------|-------|
115120
| AI manifest | `0-AI-MANIFEST.a2ml` (read FIRST) |
116-
| State checkpoint | `.machine_readable/6a2/STATE.a2ml` |
121+
| State checkpoint | `.machine_readable/descriptiles/STATE.a2ml` |
117122
| Game profiles | `profiles/*.a2ml` (18 games) |
118123
| GUI panels | `src/gui/panels/` (8 panels) |
119124
| Panel clades | `panel-clades/` (9 base + game children) |
@@ -123,6 +128,9 @@ VeriSimDB (8-modality octads) -- container/verisimdb/
123128
| Main quadlet | `container/verisimdb/gsa-verisimdb.container` |
124129
| Backup quadlet | `container/verisimdb-backup/gsa-verisimdb-backup.container` |
125130
| Icon assets | `assets/icon.svg`, `assets/icon-256.png` |
131+
| AffineScript interface (pure TEA core) | `src/ui/tea/gsa_gui.affine` |
132+
| AffineScript FFI layer (libgsa externs + cmd_*) | `src/ui/tea/gsa_ffi.affine` |
133+
| AffineScript↔Zig symbol contract check | `scripts/affine-ffi-contract-check.sh` (`just affine-contract`; typecheck: `just affine-check`) |
126134
| E2E test | `scripts/e2e-test.sh` |
127135
| Gossamer chain test | `scripts/gossamer-integration-test.sh` |
128136
| CLI binary | `src/interface/ffi/zig-out/bin/gsa` |

.github/workflows/abi-contract.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,19 @@ jobs:
7575
- name: Type-check the ABI package
7676
working-directory: src/interface/abi
7777
run: idris2 --typecheck gsa-abi.ipkg
78+
79+
affine-ffi-contract:
80+
name: AffineScript ↔ Zig FFI symbols in sync
81+
runs-on: ubuntu-latest
82+
timeout-minutes: 5
83+
steps:
84+
- name: Checkout
85+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
86+
87+
# Symbol-level contract only (pure grep/comm — no toolchain): every
88+
# extern in src/ui/tea/gsa_ffi.affine must be a real Zig export, and
89+
# the operational core set must all be bound. The AffineScript
90+
# typecheck itself needs the affinescript compiler (not packaged);
91+
# run it locally with `just affine-check`.
92+
- name: AffineScript FFI symbol contract
93+
run: bash scripts/affine-ffi-contract-check.sh

.github/workflows/secret-scanner.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,15 @@ permissions:
1515

1616
jobs:
1717
scan:
18-
uses: hyperpolymath/standards/.github/workflows/secret-scanner-reusable.yml@d135b05bfc647d0c0fbfedc7e80f37ea50f49236
18+
# Explicit job-level permissions matching what the pinned reusable's
19+
# gitleaks job declares (pull-requests: write for the PR summary
20+
# comment, actions: read for its workflow-run metadata calls).
21+
# Without this grant the reusable's job-level request exceeds the
22+
# caller's workflow-level contents:read cap and the run dies at
23+
# startup ("permissions can only be reduced, not elevated").
24+
permissions:
25+
contents: read
26+
pull-requests: write
27+
actions: read
28+
uses: hyperpolymath/standards/.github/workflows/secret-scanner-reusable.yml@891b1ed6164478616cb3375f328c6487ccb13f80
1929
secrets: inherit

.machine_readable/agent_instructions/README.adoc renamed to .machine_readable/bot_directives/README.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: CC-BY-SA-4.0
2-
// Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
3-
= Agent Instructions
2+
// Copyright (c) 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
3+
= Bot Directives
44
:toc: preamble
55

66
Methodology-aware configuration for AI agents. Read by any AI agent
@@ -32,7 +32,7 @@ Methodology-aware configuration for AI agents. Read by any AI agent
3232
== Relationship to Other Files
3333

3434
* `AGENTIC.a2ml` says WHAT agents can do (permissions, gating)
35-
* `agent_instructions/` says HOW agents should work (methodology)
35+
* `bot_directives/` says HOW agents should work (methodology)
3636
* `bot_directives/` says what the gitbot-fleet does (fleet-specific)
3737
* `CLAUDE.md` says how Claude specifically should work (Claude-specific)
3838

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)