Commit 3f866b4
docs(affine): capture the AffineScript interface constraints durably (#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>1 parent 76b1421 commit 3f866b4
3 files changed
Lines changed: 115 additions & 0 deletions
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
17 | 21 | | |
18 | 22 | | |
19 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
27 | 50 | | |
28 | 51 | | |
29 | 52 | | |
| |||
0 commit comments