fix(ci): walker Js.Exn catch-arm detection + vscode E2E false-positive (closes #426)#428
Merged
Merged
Conversation
Closes #426. Fixes the 3 pre-existing test failures that have been red on main since at least 2026-05-28 10:09Z (commit c871f7f), blocking PR auto-merges. Fix 1 — walker.ml detect_untyped_exception (1 test) ==================================================== `Js.Exn.Error(_)` in a catch-arm position is parsed by tree-sitter-rescript as a compound node (constructor pattern with the `(_)` payload as a child). The previous fallback constrained matching to leaf nodes (`node.children = []`), so the compound never matched and the walker missed line 22 of `tools/res-to-affine/test/fixtures/sample.res`. Drop the leaf-only constraint. The pre-existing 32-char text length cap is sufficient guardrail — it allows the constructor-pattern node (`"Js.Exn.Error(_)"`, 15 chars) but rejects the enclosing try/match expressions. The master walker's dedupe collapses any same-line duplicate against the typed `try_expression` hit. Verified with `tools/res-to-affine/test/test_walker.exe`: walker-phase2c-parity #2 untyped-exception [OK] (was FAIL) all 7 walker tests pass (was 6/7) Fix 2 — packages/affine-vscode/mod.js doc comment (2 tests) ============================================================ The `mod.js` source is embedded at compile time per #380, then the E2E codegen tests assert that certain `require("…")` strings are NOT present in the emitted CJS under specific flag combinations: - test_vscode_extension_adapter_override (#4): expects `require("@hyperpolymath/affine-vscode")` absent when the override flag is set. - test_vscode_extension_no_lc (#5): expects `require("vscode-languageclient/node")` absent when --no-lc is set. The manual-wiring example in mod.js's header doc-comment contained both strings literally as illustrative code. The substring-based `contains` helper in `test_e2e.ml` cannot distinguish doc-comment text from generated code, so both tests false-positived on the embedded comment. Rewrite the doc comment to describe the wiring in prose with named `loadShim()` / `loadAdapter()` / `loadVscode()` / `loadLanguageClient()` placeholders, plus an explanatory note stating that the literal `require(...)` strings are intentionally omitted so the E2E substring assertions don't false-positive. Verified with `test/test_main.exe`: E2E Node-CJS Codegen #4 --vscode-extension-adapter [OK] (was FAIL) E2E Node-CJS Codegen #5 --vscode-extension-no-lc [OK] (was FAIL) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
🔍 Hypatia Security ScanFindings: 81 issues detected
View findings[
{
"reason": "Action actions/checkout@v6 needs attention",
"type": "unpinned_action",
"file": "publish-jsr.yml",
"action": "pin_sha",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Action denoland/setup-deno@v2 needs attention",
"type": "unpinned_action",
"file": "publish-jsr.yml",
"action": "pin_sha",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in affine-vscode-publish.yml",
"type": "unknown",
"file": "affine-vscode-publish.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in casket-pages.yml",
"type": "unknown",
"file": "casket-pages.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in casket-pages.yml",
"type": "unknown",
"file": "casket-pages.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in ci.yml",
"type": "unknown",
"file": "ci.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in ci.yml",
"type": "unknown",
"file": "ci.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in ci.yml",
"type": "unknown",
"file": "ci.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in ci.yml",
"type": "unknown",
"file": "ci.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in ci.yml",
"type": "unknown",
"file": "ci.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
}
]Powered by Hypatia Neurosymbolic CI/CD Intelligence |
This was referenced May 30, 2026
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
Closes #426. Two small surgical fixes that resolve the 3 pre-existing test failures blocking PR auto-merges on main.
Fix 1 — Walker
Js.Exncatch-arm detection (resolves 1 test)tools/res-to-affine/walker.ml— drop thenode.children = []constraint from the fallback indetect_untyped_exception. tree-sitter-rescript parsesJs.Exn.Error(_)in a catch-arm as a compound node (constructor pattern with the(_)payload as a child), so the leaf-only check skipped it.The pre-existing 32-char text length cap is a sufficient guardrail —
Js.Exn.Error(_)is 15 chars and the enclosing try/match expressions exceed the cap. Dedupe handles same-line duplicates.Test:
walker-phase2c-parity #2 untyped-exception[OK](was FAIL).Fix 2 — vscode E2E false-positive (resolves 2 tests)
packages/affine-vscode/mod.js— rewrite the manual-wiring example in the header doc comment. The previous text contained literalrequire(\"@hyperpolymath/affine-vscode\")andrequire(\"vscode-languageclient/node\")strings as illustrative code; oncemod.jsis embedded at compile time (per #380), the E2E codegen tests' substring-basedcontainshelper false-positived on those comment strings.New wording uses named placeholders (
loadShim()/loadAdapter()/loadVscode()/loadLanguageClient()) plus an explanatory note saying the literalrequire(...)strings are intentionally omitted so the E2E assertions don't false-positive.Tests:
E2E Node-CJS Codegen #4 --vscode-extension-adapter-override[OK](was FAIL)E2E Node-CJS Codegen #5 --vscode-extension-no-lc[OK](was FAIL)Verification (local)
Test plan
🤖 Generated with Claude Code