Skip to content

v0.6.0 — semantic checks in the editor, engine consumed from npm - #21

Merged
jpantsjoha merged 1 commit into
mainfrom
feat/v0.6.0-semantic-checks
Aug 7, 2026
Merged

v0.6.0 — semantic checks in the editor, engine consumed from npm#21
jpantsjoha merged 1 commit into
mainfrom
feat/v0.6.0-semantic-checks

Conversation

@jpantsjoha

Copy link
Copy Markdown
Owner

Ships the seven semantic detectors from SPEC.md to users.

What users get

Diagnostics for code that compiles and is still wrong:

ID Detects Severity
S1 request.security() reading the current, forming bar — repainting Warning
S2 ta.* inside a conditional — history develops gaps Warning
S5/S6 >64 plots, >40 request.*() — TradingView rejects the script Error
S7 plot/bgcolor outside global scope — v6 scope error Error
S8 Function defined inside a block Error
S9 strategy.entry with no exit anywhere Warning

// pine-ignore: S1 suppresses one you have considered. Syntactic diagnostics are never suppressible.

Architecture — ADR-0001 enforced

Extension now consumes pinescript-v6-validator@0.2.0. I started mirroring the engine sources into src/parser/ and stopped — that is precisely the drift this project has already been bitten by. Build copies the pinned package's output into dist/engine/; the package stays the single source.

Two packaging failures caught before release

  1. The first VSIX would have died at activation. node_modules is excluded, so the engine dependency was absent. Caught by extracting the archive and executing the packaged code — the file listing looked perfectly fine.
  2. Un-ignoring node_modules made vsce walk the whole tree and hang past ten minutes.

Verification

npm test 169/169
Typecheck clean
Audit 18 pass · 2 warn · 0 fail
Sabotage disabling each of 6 check functions fails 1–4 of its own tests
Packaged VSIX extracted and executed: S1/S7 fire, clean stays clean, suppression works
Perf 1.21ms full pipeline

Real bugs found

examples/indicator.2.3.pine called bgcolor() inside if — a genuine v6 scope error. One of my own corpus fixtures called ta.highest inside if barstate.islast, the exact anti-pattern S2 exists to catch.

Ships the seven semantic detectors to users, and moves the extension onto the
published engine rather than its own copy.

WHAT USERS GET
Diagnostics for code that COMPILES and is still wrong: repainting
request.security, ta.* inside conditionals, plot/bgcolor outside global scope,
functions defined in blocks, platform-limit breaches, entries with no exit.
Suppressible with `// pine-ignore: S1` where the author has considered it;
syntactic diagnostics remain non-suppressible because a compile error is a fact.

ARCHITECTURE (ADR-0001)
The extension now consumes pinescript-v6-validator@0.2.0 rather than duplicating
the checks. I started to mirror the engine sources into src/parser/ and stopped —
that is exactly the drift this project has already been bitten by. The build
copies the pinned package's compiled output into dist/engine/; the npm package
remains the single source and the copy is a regenerated build artefact.

TWO PACKAGING FAILURES CAUGHT BEFORE RELEASE
1. The first VSIX excluded node_modules, so the engine dependency was absent and
   the extension would have installed and died at activation. Found by extracting
   the archive and EXECUTING the packaged code — the file listing looked fine.
2. Un-ignoring node_modules to fix that made vsce enumerate the entire tree and
   hang past ten minutes. Copying the engine into dist/ at build time avoids both.

Also wires the semantic source into validate-cli.js and the golden corpus, which
scripts/audit.js requires — that guard now covers a diagnostic source that lives
in a dependency rather than in src/parser/.

Tests 169. Packaged VSIX verified by execution: S1 and S7 fire, clean scripts stay
clean, suppression works, syntactic checks unaffected.
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

✅ All checks passed! Ready for review.

@jpantsjoha
jpantsjoha merged commit 9837683 into main Aug 7, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants