Skip to content

Release v0.5.0#155

Merged
thiagoralves merged 14 commits into
mainfrom
development
Jun 1, 2026
Merged

Release v0.5.0#155
thiagoralves merged 14 commits into
mainfrom
development

Conversation

@thiagoralves
Copy link
Copy Markdown
Contributor

Promote development to main for the v0.5.0 release.

Since v0.4.22:

Tagging v0.5.0 after merge kicks the release build.

🤖 Generated with Claude Code

thiagoralves and others added 14 commits June 1, 2026 14:46
These 82 tests each parsed a snippet and asserted only `ast` defined +
`errors` empty — no AST-structure or codegen assertions. The constructs
they touch (arithmetic/comparison/logical operators, control flow,
literals, variable/type declarations, multi-POU) are all exercised far
more rigorously by the codegen-*.test.ts and cpp-compile/st-validation
suites, which parse *and* generate *and* assert real C++ output. A
parse-only "no errors" check is strictly weaker and adds no coverage
those provide.

Removed in full: Function/FB Parsing, Expression Parsing, Chained
Expression, Literal Types, Direct Address, Type Declaration, Additional
Expression Edge Cases, Multiple POU, Variable Declaration, Control Flow
Parsing, Edge Case. Trimmed: Parse Function Tests and Complex Program
Tests keep only their non-shallow cases.

Deliberately KEPT (not shallow): the negative test (`returns errors for
invalid syntax`), the empty-input edge test, and the compile()-based
VAR_GLOBAL/VAR_EXTERNAL success test.

Supersedes #79, which missed the two function-parsing sections (they sit
before its "keep first 536 lines" cutoff) and over-removed the
compile()-based Complex Program test. 136 -> 54 tests; full suite green
(1917 passed), typecheck clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…tests

test: remove shallow parse-only smoke tests from compile.test.ts (#72)
Two of the three issues in #75 are still valid; the third was already
fixed.

1. oscat-gpp-compile.test.ts — the "compiles and runs full OSCAT" test
   silently `return`ed when no transpiled output existed, so it could
   pass without testing anything. The suite is already gated by
   `describe.skipIf(!hasGpp || !oscatStlibAvailable)`, so a missing
   artifact means the preceding transpile test failed — a real failure.
   Replaced the silent return with `expect.fail(...)`, and removed a
   dead `return` after an existing `expect.fail`.

2. located-variables.test.ts — "error on located variable in FB" asserted
   `message.includes('FUNCTION_BLOCK')`, a generic token any unrelated FB
   error would satisfy (vacuous match). Anchored it to the distinctive
   rule text "Located variables can only be declared …" so the test fails
   if a different error fires or the located-var check regresses.
   (CompileError has no populated `code` field — introducing an
   error-code taxonomy across the analyzer would be a much larger change,
   out of scope here.)

3. codesys-import.test.ts "V3 vs V2.3 counts" — already uses
   `toBeGreaterThan(...)` tolerance checks, not the brittle exact
   `toBe(v23fn)` equality the issue described. No change needed.

Supersedes the stale, conflicting PR #83. Affected files pass (76 tests).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…tions

test: fix fragile/vacuous assertions (#75)
Two test files lived in the wrong layer:

- tests/semantic/references.test.ts — only calls parse() (17 calls, no
  semantic analysis), so it's a parser-level test → moved to tests/frontend/
- tests/frontend/ast-utils.test.ts — runs the full analysis pipeline via
  analyze() to exercise findEnclosingPOU → moved to tests/integration/

Pure git renames (100% content unchanged). All test dirs are at depth 2,
so the `../../src/index.js` imports stay valid; vitest discovery is glob
(tests/**/*.test.ts), so location doesn't affect collection. Full suite
unchanged: 1917 passed / 7 skipped.

Supersedes PR #82, which moved only references.test.ts (1 of the 2 files)
and was based on a stale March commit.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
test: move misplaced test files to correct directories (#74)
Hovering a built-in IEC 61131-3 type name (INT, TIME, LREAL, …) now shows
a markdown tooltip with the full name, category, value range, bit size,
and literal syntax where applicable.

- New server/src/iec-type-docs.ts: IEC_TYPE_DOCS map (26 elementary types)
  + getIecTypeDoc(word). Sizes reflect how STruC++ actually lowers each
  type per src/runtime/include/iec_types.hpp.
- hover.ts getHover: resolve a built-in type name from the source word at
  the cursor (type names are reserved keywords, so they never collide with
  user symbols and often have no AST symbol node). The server already
  advertises hoverProvider and routes onHover → getHover, so no wiring
  change was needed.

Implemented fresh against the current hover architecture rather than
reviving the closed PR #56, which targeted a stale feature branch, added a
separate hover-provider.ts that doesn't fit today's getHover/handler flow,
and — critically — documented TIME/DATE/TOD/DT as 32-bit, whereas STruC++
represents all temporal types as signed int64 (TIME/LTIME/TOD/DT in ns,
DATE in days). The new docs are corrected accordingly.

Tests: unit coverage for getIecTypeDoc (all 26 types, case-insensitivity,
null cases, int64 temporal regression guard) + getHover integration
(hovering INT/TIME shows docs; hovering a variable name does not). Full
extension suite green (252 tests); tsc build clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
feat(vscode): hover docs for built-in IEC data types (#55)
The Phase 3.2/3.3 "validation example" tests (derived from old phase
docs) re-tested constructs already covered by the dedicated codegen
tests in the same files, with equal-or-weaker assertions. Removed 8:

codegen-control-flow.test.ts (5): nested IF with ELSIF, FOR loop with
EXIT, WHILE loop, REPEAT-UNTIL, CASE with ranges. Each duplicates a
dedicated Phase 3.2 test (e.g. "EXIT as break" is actually stronger — it
also asserts the exit label; REPEAT-UNTIL was byte-identical).

codegen-composite.test.ts (3): the "Phase 3.3: Validation Examples"
section (array access Test 1, structure access Test 2, array of
structures Test 3) — kitchen-sink re-tests of the dedicated Array Element
Access / Structure Member Access / Combined Access tests (Test 3 was
identical to "array of struct access in loop").

Coverage preserved: the only non-identical case — that a CASE range
(90..100) expands to *intermediate* labels — is already covered by the
"CASE with range expansion" test (case 4..6 → case 5); for extra rigor I
also added a `case 91:` assertion to "CASE with mixed labels and ranges"
when removing the validation copy.

Full suite: 1917 → 1909 (−8), 7 skipped; no coverage lost.

Supersedes the stale PR #81, which conflicts against current development,
re-adds an already-present compileST helper, and blind-deleted the CASE
test without preserving the intermediate-expansion assertion.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…odegen-tests

test: remove duplicate codegen test sections (#73)
…ke (#71)

Behavior tests were importing the compiled dist/ output. Because coverage
is collected on src/** (dist/ excluded, not remapped), those tests
contributed ZERO to src/ coverage — e.g. codegen-composite alone now
attributes ~46% to src/backend/codegen.ts where before it counted 0%.
The "fails without a build" rationale in the issue is moot (the vitest
globalSetup runs tsc first), but the coverage-attribution problem is real.

- Convert all 14 dist-importing test files to ../…/src/… (vite resolves
  the .js specifiers to .ts, as the rest of the suite already relies on).
  The grep-based pass found 13; the new guard caught a 14th at the tests/
  root (diagnostic-pou-context.test.ts, one ../ deep).
- Add tests/no-dist-imports.test.ts: a guard test that fails if any test
  imports dist/. Implemented as a test rather than ESLint because
  `npm run lint` only covers src/ and tests are excluded from tsconfig, so
  type-aware ESLint can't lint them without a separate project.
- Add tests/integration/package-smoke.test.ts: the one deliberate dist/
  consumer — imports the shipped dist/index.js and asserts the public API
  surface + a trivial end-to-end compile, validating tsc emit/exports/ESM
  resolution that src/ tests (vite-transpiled) don't. Allow-listed by the
  guard.

Full suite: 74 files, 1913 passed / 7 skipped.

Supersedes the stale PR #77 (8 of 13 files, conflicts on current dev).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
test: import src/ not dist/ in tests + dist guard & package smoke (#71)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@thiagoralves thiagoralves merged commit f11d629 into main Jun 1, 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.

1 participant