Skip to content

Close production gap + develop the AffineScript any-game interface#64

Merged
hyperpolymath merged 1 commit into
mainfrom
claude/prod-gap-affinescript-interface
Jul 7, 2026
Merged

Close production gap + develop the AffineScript any-game interface#64
hyperpolymath merged 1 commit into
mainfrom
claude/prod-gap-affinescript-interface

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Production gap

  • Secret Scanner startup_failure on main → fixed. The wrapper pinned standards@d135b05, whose gitleaks job requests pull-requests: write + actions: read above the caller's contents: read cap (estate Bug B — the reusable is startup-failing estate-wide, including in standards itself). Fix: explicit job-level permissions in the wrapper matching the reusable's requests (the same pattern that keeps our Scorecard wrapper green since PR harden: address actionable Hypatia advisory findings #41) + repin to current standards main (891b1ed).
  • Estate naming mandate applied: .machine_readable/6a2/descriptiles/, agent_instructions/bot_directives/; every path reference rewritten (docs/INDEX, 3 maintainer guides, .claude/CLAUDE.md).
  • Metadata brought back to reality (STATE.a2ml, ROADMAP.adoc, .claude/CLAUDE.md): v0.9.0, 40 exported FFI symbols, 13 FFI modules, 140 tests (unit 94 / integration 41 / smoke 5) — all verified passing on this tree, flake.nix reference removed (guix-only), PRs Hardening phases 4–8: behavioral tests, config cleanup + YAML, CLI, coherence, docs #61HTTP capability gateway (Phase 11) + illustrated wiki & reference docs (Phase 12) #63 reflected. Instant Sync red recorded as owner-gated blocker B5 (dead FARM_DISPATCH_TOKEN, estate-wide).

AffineScript interface — serve any game

  • New src/ui/tea/gsa_ffi.affine — complete 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 / fingerprint / server_action / logs / health / list+add profiles / extract config / provision / drift / alert / steam) that the Cadre Router / Gossamer host dispatches on behalf of the pure core.
  • src/ui/tea/gsa_gui.affine reworked from a disconnected skeleton into the real TEA core: 8 panels (adds NexusSetup), a GameProfile registry model — 18 shipped A2ML profiles, runtime add_profile, and generic auto-detect fallback via probe fingerprinting = any game without interface changes — 15 Msg variants closing the host feedback loop, result-code status surface, and subscriptions for log/health polling.
  • Both files typecheck against the affinescript compiler (core face). Gotchas encoded in STATE: handle is a reserved word; record spread fails on nominal structs; module resolution is cwd-relative (check from src/ui/tea/).
  • Guard rails: scripts/affine-ffi-contract-check.sh (declared ⊆ exported, no phantom bindings + 27-symbol operational core coverage), new affine-ffi-contract job in abi-contract.yml, just affine-check / just affine-contract recipes, contract check wired into just quality.

Issue #20 triage (owner: one click to close)

All 8 panic-attack findings verified resolved or false-positive against this tree (posting to the issue was outside this session's permissions):

Finding Verdict Evidence
fli-gauge.js innerHTML resolved only dynamic SVG content passes escapeXml() (fli-gauge.js:154,211)
fli-editable.js innerHTML resolved no innerHTML left; direct DOM / replaceChildren (PR #41)
fli-tooltip.js innerHTML resolved escapeHtml() on data-tip content (fli-tooltip.js:44)
fli-terminal.js innerHTML resolved escapeTermHtml() before span-wrapping (fli-terminal.js:82)
run.js Deno -A resolved no -A anywhere; scoped --allow-read --allow-run --allow-env (Justfile:677)
wizard.sh hardcoded secret false positive prompts for STEAM_PASS at runtime, echo off — scanner matched doc comments
steam-stage.sh hardcoded secret false positive same (steam-stage.sh:151-161)
flake.nix unpinned inputs obsolete flake.nix removed in the nix→guix migration

Verification

  • zig build test / test-integration / test-smoke: 140/140 passing
  • affinescript check on both .affine files: passing
  • scripts/affine-ffi-contract-check.sh: 38 declared / 38 exported, 27 core bound
  • Both edited workflows: valid YAML
  • panic-attack not installed in this environment — relying on CI

🤖 Generated with Claude Code

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>
@hyperpolymath
hyperpolymath merged commit b75df69 into main Jul 7, 2026
28 checks passed
@sonarqubecloud

sonarqubecloud Bot commented Jul 7, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 1 issues detected

Severity Count
🔴 Critical 0
🟠 High 0
🟡 Medium 1
View findings
[
  {
    "reason": "Repository has 21 non-main remote branch(es). Policy: single main branch only.",
    "type": "GS007",
    "file": ".",
    "action": "delete_remote_branches",
    "rule_module": "git_state",
    "severity": "medium"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

hyperpolymath added a commit that referenced this pull request Jul 17, 2026
…68)

<!-- SPDX-License-Identifier: CC-BY-SA-4.0 -->
## Summary

The three AffineScript compiler constraints that shaped
`src/ui/tea/*.affine` (#64) only existed as a line in a `STATE.a2ml`
session-log entry. This PR lifts them into discoverable source docs and
adds an in-context guardrail, so a future contributor doesn't rediscover
them the hard way or try to "simplify" code that is the way it is on
purpose.

This is the follow-up cleanup I flagged after closing out the completion
roadmap. **It is docs/comments only** — the `.affine` logic is
unchanged.

## Changes

- **`src/ui/tea/README.adoc`** (new) — what the TEA interface is (pure
`init`/`update`/`view`/`subs` core + the `cmd_*` `/ IO` effect layer),
how to typecheck it (module resolution is cwd-relative → `just
affine-check` from `src/ui/tea`), the symbol-contract guard (`just
affine-contract` / `affine-ffi-contract-check.sh`, also in CI), and the
three language constraints with rationale.
- **`gsa_gui.affine`** — an in-context "AffineScript constraints (read
before editing)" header block: `handle` is reserved (use
`server_handle`); record-spread does not typecheck on nominal structs,
so every `update` arm restating all 13 `Model` fields is **deliberate**,
not oversight — do not DRY it with a spread; module resolution is
cwd-relative.
- **`gsa_ffi.affine`** — a one-line pointer to the `server_handle`
naming convention and the README.

## Why no code refactor

The obvious "cleanup" would be `with*` updater helpers to collapse the
~15 longhand `update` arms. I deliberately **did not** do that:
AffineScript has no compiler in this environment and CI only checks the
FFI symbol contract, not a typecheck, so the files currently compile but
a refactor could not be verified here — a bad trade against working
code. The docs instead make the constraint explicit and point the next
editor (who *can* run `just affine-check`) at where a real refactor
would belong if the compiler ever gains record spread.

## RSR Quality Checklist

### Required

- [x] No banned language patterns / functions
- [x] SPDX headers present (CC-BY-SA-4.0 on the new doc; existing AGPL
headers on the `.affine` files unchanged)
- [x] No secrets/credentials included

### As Applicable

- [x] Documentation updated (this PR is documentation)
- [x] Verified: `just affine-check` / `affine-contract` recipes exist
and `affine-contract` is wired into `just quality`; `Model` has exactly
the 13 fields the docs cite

## Testing

Docs/comments only — no build or test surface changes. Facts were
verified against the repo: the two `just` recipes exist,
`affine-contract` is part of `just quality`, and the `Model` field count
(13) matches the text. The `.affine` sources' logic is byte-for-byte
unchanged apart from added comment lines.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01TaWWedv6VQqeZaPvc94keN

---
_Generated by [Claude
Code](https://claude.ai/code/session_01TaWWedv6VQqeZaPvc94keN)_

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant