Repository navigation
feat(modules-lib): a description of the types of a module's exports, piloted on rune - #999
Conversation
…piloted on rune (#997) The format (version 1), builders, validateDescription and checkDescription, which checks a description against what a plugin exports after initialise(). rune describes its exports. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d5bbde6e94
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ption Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
@codex review |
|
Codex Review: Didn't find any major issues. Chef's kiss. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
First step of #997 (design settled in #996): the format, and a pilot on
rune.What
@sourceacademy/modules-lib/description: the format (version 1) as a JSON-serializable TypeScript type:number,integer,string,boolean,void,any, named opaque types (with optional type arguments), type parameters,list,pair,array, function types; functions and opaque types may have type parameters. Builders (opaque,fun,parameter,fn) to write one by hand.validateDescription: what is wrong with a description in itself: a name described twice, an opaque type or type parameter that is not declared (or has the wrong number of arguments), an unknown version, andintegeras a result (a module's number comes back as a float;integeris for a parameter that must be whole; a callback turns the direction around).checkDescription(description, exportedSymbols): the above, and that the described names are exactly what the plugin exports. Give itplugin.exportsafterinitialise(), notexportedNames: a plugin can export names when it is loaded.rune:src/description.ts, the 38 functions and 11 shapes, with theRuneopaque type and the callback types written by hand; anddescription.test.ts, which checks it against the real plugin'sexportsafterinitialise(), so that a function that is added to the plugin without a description fails the bundle's tests.Why this way
DataTypeis unchanged: the description is a superset (A language-neutral description of each module's exports and their types, for typed languages #996).attachModuleMethodis untouched.binary_tree,curve,matrix,repeat,scrabble,sound) are straightforward copies of py-slang's temporary descriptions.src/typecheck/module-description.tsand reads the same shape.Not in this PR (next steps of #997): the build step that publishes
description.jsonnext to a bundle'sindex.js, the generator for the generated part (names and arities fromexportedNamesandattachModuleMethodsignatures, TypeScript declarations), the other bundles, and py-slang fetching the description at run time. The format has no JSON schema file yet.Tests: 9 for the format, 2 for rune.
tscand lint pass forruneand for the new files ofmodules-lib(the remaining warnings inmodules-libare in files this PR does not touch). The repo's pre-push hook passes (run assh .husky/pre-push, about 90 s); the push itself used--no-verifybecause the SSH connection was closed while the hook ran insidegit push.🤖 Generated with Claude Code