docs(affine): capture the AffineScript interface constraints durably#68
Merged
Merged
Conversation
The three AffineScript compiler constraints that shaped src/ui/tea/*.affine only lived in a STATE.a2ml session-log entry. Lift them into discoverable source docs so they aren't rediscovered the hard way, and guard the code against well-meaning "simplification": - New src/ui/tea/README.adoc — what the TEA interface is (pure core + cmd_* effect layer), how to typecheck (cwd-relative, `just affine-check`), the symbol-contract guard (`just affine-contract`, CI), and the three language constraints with rationale. - gsa_gui.affine — an in-context "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 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 naming convention + README. Docs/comments only. No behavioural change; the .affine sources are unchanged in logic (AffineScript has no compiler in this environment, so a blind refactor of working code was deliberately avoided). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TaWWedv6VQqeZaPvc94keN
|
hyperpolymath
marked this pull request as ready for review
July 17, 2026 05:29
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
The three AffineScript compiler constraints that shaped
src/ui/tea/*.affine(#64) only existed as a line in aSTATE.a2mlsession-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
.affinelogic is unchanged.Changes
src/ui/tea/README.adoc(new) — what the TEA interface is (pureinit/update/view/subscore + thecmd_*/ IOeffect layer), how to typecheck it (module resolution is cwd-relative →just affine-checkfromsrc/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:handleis reserved (useserver_handle); record-spread does not typecheck on nominal structs, so everyupdatearm restating all 13Modelfields is deliberate, not oversight — do not DRY it with a spread; module resolution is cwd-relative.gsa_ffi.affine— a one-line pointer to theserver_handlenaming convention and the README.Why no code refactor
The obvious "cleanup" would be
with*updater helpers to collapse the ~15 longhandupdatearms. 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 runjust affine-check) at where a real refactor would belong if the compiler ever gains record spread.RSR Quality Checklist
Required
.affinefiles unchanged)As Applicable
just affine-check/affine-contractrecipes exist andaffine-contractis wired intojust quality;Modelhas exactly the 13 fields the docs citeTesting
Docs/comments only — no build or test surface changes. Facts were verified against the repo: the two
justrecipes exist,affine-contractis part ofjust quality, and theModelfield count (13) matches the text. The.affinesources' logic is byte-for-byte unchanged apart from added comment lines.🤖 Generated with Claude Code
https://claude.ai/code/session_01TaWWedv6VQqeZaPvc94keN
Generated by Claude Code