| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
… engine parity The WhatsApp/tree-sitter-erlang npm devDependency was removed in #1478 (GHSA-rphw-c8qj-jv84 malware advisory). This left the WASM engine without an Erlang grammar, causing parity-compare to report 39 node diffs and 66 edge diffs on every run (native has built-in Erlang support; WASM gets 0). The WASM file that was present before removal has been validated clean: - correct magic bytes (0061736d) - exactly one tree_sitter_erlang export - no disallowed WASM imports Add a .gitignore negation rule (!grammars/tree-sitter-erlang.wasm) so this specific file is tracked in the repo without relying on the removed devDep. Update the build-wasm.ts comment to reflect the new committed-WASM approach and document how to rebuild it from a safe source if the grammar is updated. Closes #1582
Greptile SummaryThis PR restores Erlang WASM engine parity by committing the pre-validated tree-sitter-erlang.wasm binary directly alongside a .gitignore negation rule, sidestepping the malicious npm package (GHSA-rphw-c8qj-jv84) that was removed in #1478.
Confidence Score: 5/5Safe to merge — the change commits a pre-validated binary and tightly scopes git tracking to that single file, with no build logic changes that affect other grammars. The .gitignore negation is correctly ordered, the build script comment is accurate, and the Erlang entry is intentionally omitted from the grammars array so normal builds cannot accidentally overwrite the committed file. The only open question is whether a future binary swap would be caught automatically, but that is a forward-looking hardening gap rather than a defect in the current change. grammars/tree-sitter-erlang.wasm — pre-built binary with no companion checksum; worth a second set of eyes if the team wants ongoing tamper-detection. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[npm run build:wasm] --> B{Erlang entry in grammars array?}
B -- No\n(current state) --> C[Committed grammars/tree-sitter-erlang.wasm\nuntouched — used as-is]
B -- Yes\n(during rebuild) --> D[build-wasm.ts runs\nnpx tree-sitter build --wasm]
D --> E[validateGrammar:\nmagic bytes ✓\nsingle tree_sitter_erlang export ✓\nno disallowed imports ✓]
E -- Pass --> F[New WASM overwrites committed file]
E -- Fail --> G[WASM deleted, error logged]
C --> H[WASM engine loads Erlang grammar\nParity with native engine restored]
F --> H
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
A[npm run build:wasm] --> B{Erlang entry in grammars array?}
B -- No\n(current state) --> C[Committed grammars/tree-sitter-erlang.wasm\nuntouched — used as-is]
B -- Yes\n(during rebuild) --> D[build-wasm.ts runs\nnpx tree-sitter build --wasm]
D --> E[validateGrammar:\nmagic bytes ✓\nsingle tree_sitter_erlang export ✓\nno disallowed imports ✓]
E -- Pass --> F[New WASM overwrites committed file]
E -- Fail --> G[WASM deleted, error logged]
C --> H[WASM engine loads Erlang grammar\nParity with native engine restored]
F --> H
Reviews (3): Last reviewed commit: "fix: remove executable bit from tree-sit..." | Re-trigger Greptile |
Sorry, something went wrong.
| // from a clean source (e.g. after a tree-sitter-erlang grammar update): | ||
| // 1. npm install github:the-mikedavis/tree-sitter-erlang | ||
| // 2. Add this entry back to the grammars array | ||
| // 2. Add this entry back to the grammars array temporarily |
There was a problem hiding this comment.
The rebuild instructions in step 2 don't include the actual array entry that needs to be added temporarily, which would force a future developer to hunt through git history to reconstruct it. Adding the entry inline makes the instructions fully self-contained.
| // 2. Add this entry back to the grammars array temporarily | |
| // 2. Add this entry temporarily to the grammars array: | |
| // { name: 'tree-sitter-erlang', pkg: 'tree-sitter-erlang', sub: null }, |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Sorry, something went wrong.
There was a problem hiding this comment.
Applied — the entry is now inline in the comment so the instructions are fully self-contained.
Sorry, something went wrong.
…ld comment grammars/tree-sitter-erlang.wasm: 100755 → 100644 (data file, not executable). scripts/build-wasm.ts: include the actual array entry inline in the rebuild instructions so future developers don't need to hunt through git history.
|
Addressed Greptile feedback:
|
Sorry, something went wrong.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
Test plan
Closes #1582