feat(affinescript): step (a) — design lock-in for Node-bound packages#16
Merged
hyperpolymath merged 2 commits intomainfrom May 4, 2026
Merged
feat(affinescript): step (a) — design lock-in for Node-bound packages#16hyperpolymath merged 2 commits intomainfrom
hyperpolymath merged 2 commits intomainfrom
Conversation
…ckages Per the migration plan d→c→a, this is step (a): write AffineScript .affine sources alongside the JS fallback (PR #14) for each Node-bound package, so the playbook re-decomposition is captured while context is fresh. Bodies remain TODO until the Node-target lands (affinescript#35); the type-level contract is the design lock-in. All files conform to the locked AffineScript conventions (see feedback_affinescript_conventions.md): - Q1 face = canonical (// comments, fn keyword, brace blocks, -{Effects}-> arrow) - Q2 ext = .affine - Q3 effects = domain-specific (DOM/Fs/Process/Net/Db/IO/Action per the table) - Q4 cross-pkg = per-package Externs.affine shim (interim, pending .affex) 14 new .affine files across the 5 packages: scanner/ Externs.affine Browser + Fs + Clock effects, opaque puppeteer/playwright types Scanner.affine ScanOptions/ScanResult records + make_scanner + scan Index.affine re-exports core/ Externs.affine Db + Process effects, opaque arangojs types Arangodb.affine Site/Scan/Violation/WcagCriterion/Organization records; Service owned record; 7 query fns matching arangodb.ts; tagged-template aql lifted to bind-vars per the playbook Index.affine re-exports github-action/ Externs.affine Action + Github effects, opaque Octokit/Context types Action.affine parse_wcag_level, generate_summary, post_pr_comment, run Index.affine re-export run cli/ Externs.affine IO/Process/Fs/Path/Commander/Spinner/Style/TableBuilder effects Cli.affine scan_action, ci_action, batch_action, build_program, main Index.affine re-export main monitoring-api/ Externs.affine Net + Joi + Dotenv + IO + Process + Clock effects; Express App/Router/Req/Res opaque Server.affine AppState (replaces module-level db/scanner singletons), respond_error helper, 13 route handlers (one per route in src/routes/*.ts), boot() Key playbook re-decompositions captured at the type level: * Module-level `db` / `scanner` singletons → owned AppState threaded as ref * try/catch around handlers → effect rows make impurity visible * `'A' | 'AA' | 'AAA'` string unions → AffineScript sum types * tagged-template aql → bind-vars Db.query * forwardRef class (in React.affine, prior PR) → standalone fn with own return Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
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
Step (a) of the migration plan: AffineScript
.affinedesign files for all 5 Node-bound packages, written alongside the JS fallback (PR #14). Bodies remain TODO until the Node-target lands (affinescript#35) — the type-level contract is the design lock-in.Conformance: every file follows the locked AffineScript conventions (see
feedback_affinescript_conventions.mdresolution log). Q1=canonical face, Q2=.affineextension, Q3=domain-specific effect names, Q4=per-packageExterns.affineshim (interim, pending.affexcompatibility filesystem).What's in this PR
14 new
.affinefiles across the 5 Node-bound packages:scannerBrowser,Fs,ClockcoreDb,Processgithub-actionAction,GithubcliIO,Process,Fs,Path,Commander,Spinner,Style,TableBuildermonitoring-apiNet,Joi,Dotenv,IO,Process,Clock(+ re-declaredDb/Scannerfrom cross-pkg shims)Key playbook re-decompositions captured at the type level
Per the migration playbook Cardinal Rule (re-decompose, don't transliterate):
server.ts's top-leveldb/scanner) → ownedAppStatethreaded asrefparameter through route handlers — kills the service-locator pattern the playbook flags.try/catcharound every handler → handler effect rows (Net + Db + Joi + Clock + …) make impurity visible at the signature.aql\…`queries** → bind-vars-formDb.query[B](db, str, bindVars) -> Cursor` per the playbook recommendation.'A' | 'AA' | 'AAA'literal-string unions → AffineScript sum types (A | AA | AAA).ArangoDBService) → ownedServicerecord + standalone fns takingref Service/mut Service.React.forwardRefclass (in PR #15) → standalonemake_buttonfn returningown Element.Caveats
// TODO: implement when Node-target landspluslet _ = …; ()-style placeholders. This is the agreed shape of "step (a) design lock-in" — type-level contract captured, runtime impl a separate session.ServiceandDbeffect, or scanner'sScanResult) are currently re-declared as opaqueextern type+ a slim re-declared effect in each consumer. When.affexlands, those re-decls collapse touse Core/use Scannerand the duplication disappears.String.join,List.fold,Int.to_string, etc.) are referenced but not yet pinned to a specific stdlib path — to settle when the language's stdlib path scheme is finalised.pubvisibility on top-levellet/typeis used perstdlib/Core.affineprecedent; if the canonical face has different export semantics in some constructs, those are renamings.How this fits the four PRs
js-strip-typesreact-affinescript-pilotaffinescript-node-design.affinedesign for the 5 Node-bound packagesPR #14 keeps the runtime working today; PR #15 + this PR capture the AffineScript design while context is fresh. The two layers (
.js+.affine) coexist until the Node-target lands; at that point the.jsfiles retire and.affinebecomes canonical.Test plan
affinescript check <file>once a working environment is set up — couldn't run in this session.affexper the parking-lot entry; collapse cross-package type re-decls🤖 Generated with Claude Code