fix(vscode-ext): pass real callbacks to registerCommand (affinescript#35 P2)#60
Merged
Merged
Conversation
…#35 P2)
src/extension.affine called registerCommand("my-lang.run", 0) with an
Int "wasm-table index" — a Phase-1 assumption. The Phase-2 (#35) stdlib
binding is `registerCommand(name: String, handler: fn(Unit) -> Int)`, so
the Int literal produced `Unify.TypeMismatch ((Unit -> Int), Int)` and
the extension would not compile at all.
Pass the handlers as real callbacks using the canonical pattern from
affinescript's examples/vscode_extension_minimal.affine:
`registerCommand("my-lang.run", fn(u: Unit) => handler_run())` (×3), and
replace the now-obsolete wasm-table-index comment.
Verified: `affinescript compile --vscode-extension src/extension.affine
-o out/extension.cjs` succeeds (against affinescript origin/main stdlib);
regenerated out/extension.cjs passes `node --check`; src/index.cjs wires
it via require("../out/extension.cjs"). The upstream Vscode stdlib
bindings already type-check on affinescript main — no affinescript change
needed; this was purely the my-lang port using the stale contract.
Refs affinescript#35
Refs affinescript#64
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
hyperpolymath
added a commit
that referenced
this pull request
May 18, 2026
…#61) `vsce` 2.15.0 (the deprecated package) predates `.cjs`-entrypoint support, so `vsce package` failed looking for `src/index.cjs.js`. Migrated devDependency to the renamed, maintained `@vscode/vsce` ^3.2.0 (same `vsce` binary, so the `package` script is unchanged). Also corrected the README "Status" block, which #58 left stale: the extension DOES compile and the affinescript Vscode stdlib bindings DO type-check on affinescript main (#35 P2 effectively complete) — the only real bug was my-lang's own extension.affine (fixed in #60). Documented that packaging needs a registry-reachable env (WSL npm is unreachable here, so package/publish must run on CI or a non-WSL host) and that `.vsix` packaging needs no Azure PAT (only `vsce publish` does). Refs affinescript#35 Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Closed
3 tasks
🔍 Hypatia Security ScanFindings: 35 issues detected
View findings[
{
"reason": "Issue in quality.yml",
"type": "missing_workflow",
"file": "quality.yml",
"action": "create",
"rule_module": "workflow_audit",
"severity": "high"
},
{
"reason": "Issue in security-policy.yml",
"type": "missing_workflow",
"file": "security-policy.yml",
"action": "create",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Action hyperpolymath/standards/.github/workflows/governance-reusable.yml@main needs attention",
"type": "unpinned_action",
"file": "governance.yml",
"action": "pin_sha",
"rule_module": "workflow_audit",
"severity": "high"
},
{
"reason": "unwrap_or(0) with dangerous default (1 occurrences, CWE-754)",
"type": "unwrap_dangerous_default",
"file": "/home/runner/work/my-lang/my-lang/_exploratory/me-scaffolding/crates/parser/src/lib.rs",
"action": "flag",
"rule_module": "code_safety",
"severity": "critical"
},
{
"reason": "expect() in hot path (80 occurrences, CWE-754)",
"type": "expect_in_hot_path",
"file": "/home/runner/work/my-lang/my-lang/_exploratory/me-scaffolding/crates/parser/src/lib.rs",
"action": "flag",
"rule_module": "code_safety",
"severity": "medium"
},
{
"reason": "unwrap() without prior check -- DoS via panic (1 occurrences, CWE-754)",
"type": "unwrap_without_check",
"file": "/home/runner/work/my-lang/my-lang/my-ssg/src/generator.rs",
"action": "flag",
"rule_module": "code_safety",
"severity": "high"
},
{
"reason": "expect() in hot path (5 occurrences, CWE-754)",
"type": "expect_in_hot_path",
"file": "/home/runner/work/my-lang/my-lang/crates/my-mir/src/lib.rs",
"action": "flag",
"rule_module": "code_safety",
"severity": "medium"
},
{
"reason": "unwrap() without prior check -- DoS via panic (26 occurrences, CWE-754)",
"type": "unwrap_without_check",
"file": "/home/runner/work/my-lang/my-lang/crates/my-fmt/src/lib.rs",
"action": "flag",
"rule_module": "code_safety",
"severity": "high"
},
{
"reason": "unwrap() without prior check -- DoS via panic (1 occurrences, CWE-754)",
"type": "unwrap_without_check",
"file": "/home/runner/work/my-lang/my-lang/crates/my-hir/src/lib.rs",
"action": "flag",
"rule_module": "code_safety",
"severity": "high"
},
{
"reason": "unwrap() without prior check -- DoS via panic (3 occurrences, CWE-754)",
"type": "unwrap_without_check",
"file": "/home/runner/work/my-lang/my-lang/crates/my-llvm/src/lib.rs",
"action": "flag",
"rule_module": "code_safety",
"severity": "high"
}
]Powered by Hypatia Neurosymbolic CI/CD Intelligence |
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.
The VS Code extension now compiles. Root cause was not the affinescript toolchain or upstream stdlib (those type-check fine on affinescript
origin/main) — it was my-lang's ownsrc/extension.affineusing a stale Phase-1 contract.Bug
registerCommand("my-lang.run", 0)passed anInt"wasm-table index", but the Phase-2 (#35) binding is:→
Unify.TypeMismatch ((Unit -> Int), Int); the extension would not build at all.Fix
Handlers passed as real callbacks, mirroring affinescript's own
examples/vscode_extension_minimal.affine:registerCommand("my-lang.run", fn(u: Unit) => handler_run())(×3); obsolete index comment replaced.Verification
affinescript compile --vscode-extension src/extension.affine -o out/extension.cjs→ succeeds (tested against affinescriptorigin/mainstdlib in an isolated worktree; the live affinescript clone was never touched).out/extension.cjspassesnode --check;src/index.cjswires it viarequire("../out/extension.cjs").Builds on #58 (correct
--vscode-extensioninvocation). With this,vsce packageproduces an installable.vsix(no Azure PAT needed; onlyvsce publishdoes).Refs affinescript#35
Refs affinescript#64
🤖 Generated with Claude Code