TS→ReScript migration (session 1: stale/{scanner,react})#13
Closed
hyperpolymath wants to merge 3 commits intomainfrom
Closed
TS→ReScript migration (session 1: stale/{scanner,react})#13hyperpolymath wants to merge 3 commits intomainfrom
hyperpolymath wants to merge 3 commits intomainfrom
Conversation
Per the ReScript-and-Deno language policy in .claude/CLAUDE.md. - @accessibility-everywhere/react: Button + Modal (forwardRef, focus trap, portal, WCAG-compliant ARIA) with hand-rolled DOM FFI; React.useId replaces @reach/auto-id. - @accessibility-everywhere/scanner: Scanner module with typed FFI to puppeteer/ playwright/axe-core/fs. Method bodies preserved as TODOs to mirror the TS stubs. - Per-package rescript.json with esmodule output, in-source .mjs. - Root rescript.json stub (pointed at non-existent src/) removed. - gitignore extended for nested ReScript build dirs. Both packages compile cleanly with rescript@11. Remaining TS to port: core/arangodb (409 LOC), cli, github-action, monitoring-api. 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. |
- @accessibility-everywhere/core (Arangodb.res): full port of arangodb.ts (409 LOC) including all type interfaces, DB initialization, index creation, WCAG 2.1 criteria data, and 7 query methods (getSiteByUrl, getRecentScansForSite, getViolationsForScan, getTopSites, getCommonViolations, getSiteViolationTrend, getOrganizationSites). Tagged-template aql queries converted to bind-vars-form db.query() for cleaner FFI. - @accessibility-everywhere/github-action (Action.res): full port of src/index.ts. FFI for @actions/core (getInput, info, warning, setFailed, setOutput, summary) and @actions/github (context, getOctokit, octokit.rest.issues.createComment). - @accessibility-everywhere/cli (Cli.res): full port of src/cli.ts. FFI for commander, chalk, ora, cli-table3, fs-extra, path. All three subcommands (scan, ci, batch) ported with the same UX as the TS original. Workspace dep "@accessibility-everywhere/scanner" referenced via @module externals; package.json runtime dep dropped pending workspace setup. Tests deferred: action_test.ts, cli_test.ts (Deno.test rewrite separate session). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Replaces 7 TS files (server + 6 routes, 659 LOC) with a single Server.res that mounts all six routers, plus shared FFI modules: - Express.res — Router, app, req/res accessors, middleware (cors, helmet, compression, rate-limit, json-parser). - Joi.res — schema builder + validator. - Db.res — service + collection methods (save/update/document/byExample/count) and scanner FFI, both backed by @module externals to the workspace packages. All six route surfaces preserved with the same paths: - POST /v1/scan, GET /v1/scan/:scanId - POST /v1/violations, GET /v1/violations/common, GET /v1/violations/site/:k, PATCH /v1/violations/:id/fixed - GET /v1/leaderboard, GET /v1/leaderboard/category/:c - GET /v1/badge/:domain (json + svg formats; SVG template inlined) - GET /v1/stats, GET /v1/stats/site/:k - GET /v1/dashboard/:orgId Tests deferred: 4 jest-style suites (e2e, property, aspect, benches; 1313 LOC). This completes the ReScript src migration for all 6 TS-bearing packages. Test ports across cli/github-action/monitoring-api remain. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Owner
Author
|
Discarded — TS deletions cherry-picked to ts-removal branch (PR forthcoming). Replacement port will use AffineScript per the actual hyperpolymath language policy (the .claude/CLAUDE.md prescription of ReScript was stale). |
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
Full TS→ReScript src migration mandated by
.claude/CLAUDE.md's language policy (TypeScript banned; ReScript primary).All 6 TS-bearing packages now ported and compiling under
rescript@11:tools/stale/packages/stale/components/react/tools/stale/packages/scanner/tools/stale/packages/core/tools/github-action/tools/cli/tools/monitoring-api/Total: ~1863 LOC of TS source converted to ReScript + extensive hand-rolled FFI bindings.
FFI surface written
Deferred (separate sessions)
tools/cli/tests/cli_test.ts(299 LOC, Deno.test)tools/github-action/tests/action_test.ts(376 LOC, jest)tools/monitoring-api/tests/{e2e,property,aspect,benches}/*.ts(1313 LOC, jest)failwith("TODO")placeholderspackage.jsonworkspaces globtools/*doesn't reachtools/stale/packages/*; cross-package npm refs (@accessibility-everywhere/scanner,@accessibility-everywhere/core) currently resolve only via@module(...)externals at compile time. To make the runtime imports work, set up a workspaces config that includes the nested package paths.deno.json, notpackage.json. All packages still usepackage.jsonfor npm-distributed deps. Migrating todeno.jsonimport maps withnpm:specifiers is a separate cleanup.Caveats / known rough edges
Modal.resuses oneObj.magicforJsxEvent.Mouse.target→Dom.element(an upstream rescript-react typing gap).Server.resuses%raw(...)blocks forprocess.exit(1)and a couple ofprocess.envdefaults — typed wrappers exist but plain%rawwas faster.npm installneeded--no-workspacesbecause the root workspace glob doesn't see the nestedtools/stale/packages/*packages, and one of them references@accessibility-everywhere/core@^1.0.0which isn't on the npm registry. Once the workspace structure is fixed, this flag won't be needed.Test plan
tools/stale/packages/stale/components/react:npx rescript build— cleantools/stale/packages/scanner:npx rescript build— cleantools/stale/packages/core:npx rescript build— cleantools/github-action:npx rescript build— cleantools/cli:npx rescript build— cleantools/monitoring-api:npx rescript build— clean🤖 Generated with Claude Code