Skip to content

fix(variables): accept %MX memory-bit locations for BOOL (v4.2.10)#961

Merged
thiagoralves merged 1 commit into
developmentfrom
bugfix/iec-location-any-area
Jul 25, 2026
Merged

fix(variables): accept %MX memory-bit locations for BOOL (v4.2.10)#961
thiagoralves merged 1 commit into
developmentfrom
bugfix/iec-location-any-area

Conversation

@thiagoralves

@thiagoralves thiagoralves commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Problem

Forum report "%MX locations now invalid - Runtime v4": BOOL variables mapped to %MX memory bits (e.g. Modbus coils) are rejected as "Location is invalid. Valid locations: %QX0.0..7, %IX0.0..7"%MX is a legitimate IEC 61131-3 memory bit and is explicitly exposed by the Modbus TCP server as coils.

Root cause

BOOL_LOCATION_REGEX = /^%[QI]X\d+\.\d$/ omitted the memory area (M), while WORD/DWORD/LWORD regexes already accept %[QIM]. So %MX was the only valid IEC area silently rejected (for BOOL).

Fix

  • BOOL_LOCATION_REGEX/^%[QIM]X\d+\.\d$/ — accepts every valid IEC area prefix (I/Q/M), consistent with the word-width regexes.
  • BOOL hint message now lists %MX0.0..7.
  • Added validation tests for %QX/%IX/%MX.
  • Bumped APP_VERSION + package.json to 4.2.10 (patch release).

Verification

  • Unit tests pass (incl. new %MX cases).
  • Browser-tested in openplc-web (dev:local): %MX0.0 now accepted on a BOOL; an invalid %MZ0.0 is still rejected — validation intact.

Shared surfaces are byte-identical with the openplc-web PR.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Boolean variable locations now support %MX memory addresses alongside input and output addresses.
    • Validation accepts valid %MX bit locations, including addresses such as %MX0.0 and %MX3.7.
  • Bug Fixes

    • Updated validation guidance to accurately list supported Boolean address ranges.
  • Chores

    • Updated the application and package version to 4.2.10.

BOOL_LOCATION_REGEX only allowed %QX/%IX, so valid IEC memory bits
(%MX0.0 — e.g. Modbus coils) were rejected as "Location is invalid",
while the word-width regexes already accepted the memory (M) area.
Add M so every valid IEC area prefix (I/Q/M) is accepted for BOOL,
matching WORD/DWORD/LWORD, and update the BOOL hint to list %MX.

Reported: forum "%MX locations now invalid - Runtime v4". Verified in
openplc-web: %MX0.0 now accepted on a BOOL; %MZ0.0 still rejected.

Also bump APP_VERSION + package.json to 4.2.10 for the patch release.

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

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c352a11f-bdb8-4b62-b832-b7ff4190d5d2

📥 Commits

Reviewing files that changed from the base of the PR and between 246a90f and 0070948.

📒 Files selected for processing (5)
  • package.json
  • src/frontend/data/constants/app-version.ts
  • src/frontend/store/__tests__/project-validation-variables.test.ts
  • src/frontend/store/slices/project/validation/variables.ts
  • src/frontend/utils/PLC/address-constants/types.ts

Walkthrough

BOOL variable validation now accepts %MX memory addresses, with updated messaging and parameterized coverage. Package and frontend version values are synchronized from 4.2.9 to 4.2.10.

Changes

BOOL memory validation

Layer / File(s) Summary
Extend BOOL address support
src/frontend/utils/PLC/address-constants/types.ts
Adds the %MX BOOL memory prefix and accepts %M addresses in the BOOL location regex.
Update validation messaging and coverage
src/frontend/store/slices/project/validation/variables.ts, src/frontend/store/__tests__/project-validation-variables.test.ts
Adds %MX to the valid-location message and tests valid %QX, %IX, and %MX addresses.

Application version

Layer / File(s) Summary
Synchronize version metadata
package.json, src/frontend/data/constants/app-version.ts
Updates package and frontend application versions to 4.2.10.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: dcoutinho1328, joaogsp

Poem

I’m a rabbit with bits in my toes,
%MX now validates wherever it goes.
The version hops forward, neat and bright,
From 4.2.9 to 4.2.10 tonight.
Tests nibble addresses—everything’s right!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the fix well, but it omits required template sections like References and the DOD checklist. Reformat it to match the template, add any issue or Jira references, and include the full DOD checklist items.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change: accepting %MX BOOL memory-bit locations.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bugfix/iec-location-any-area

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@thiagoralves
thiagoralves merged commit 0335117 into development Jul 25, 2026
20 of 23 checks passed
@thiagoralves
thiagoralves deleted the bugfix/iec-location-any-area branch July 25, 2026 14:19
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