0
0
Fork 0
Codesys-MCP-SP21-plus/src
Karstein Kvistad b42e10411f fix(bump_project_version): cross-check pi.version against GVL, take the max
Recurring "GVL misread" bug in release_project_version: when
Project Information.Version drifts BEHIND the runtime-anchor GVL
(_MCP_PROJECT_VERSION.sVersion), the bump used the stale pi.version
as the resume point and silently regressed the version, often
colliding with an existing v* tag.

Observed twice on the MCPTest2 sandbox:

  1. v1.0.4.0 (2026-04-26): bump from on-disk 1.2.0.0 read pi.version
     as 1.0.3.0 -> revision -> 1.0.4.0. Tag deleted; recovered as
     v1.2.1.0 via manual finish script.

  2. v1.1.0.0 collision (2026-04-26): bump from on-disk 1.2.1.0 read
     pi.version as 1.0.0.0 -> minor -> 1.1.0.0. Tag already existed,
     git tag step failed, release pipeline aborted. Recovered by
     two manual minor bumps (1.1.0.0 -> 1.2.0.0 -> 1.3.0.0) and an
     amended commit, released as v1.3.0.0.

Root cause: the MCPTest2 v1.2.0.0 and v1.2.1.0 releases were
finished by external (non-MCP) Node scripts that updated the GVL
via inject-once but never wrote pi.version back through the
bump_project_version pathway. So pi.version stayed pinned at
whatever value the LAST true bump_project_version run left it at
(in MCPTest2's case, ~1.0.0.0), while the GVL kept moving forward.

Fix: in the pi-present branch, read both pi.version and the GVL
sVersion, parse both as 4-tuples, and take the max as the resume
point. The max is always safe: both sides only ever move forward
in the normal case, so the higher of the two is by construction
the true latest version. When a drift is detected (pi behind GVL),
emit a WARNING and self-heal pi.version forward to the GVL value
before the bump so the warning doesn't recur on the next call.

The pi-missing branch is unchanged (still falls back to GVL).

Documented inline in the function with the regression scenario for
future maintainers. No new test (the affected logic runs inside
CODESYS's IronPython and doesn't have a unit-test scaffold here);
the inline comment + this commit message are the regression record.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-26 16:19:27 +02:00
..
scripts fix(bump_project_version): cross-check pi.version against GVL, take the max 2026-04-26 16:19:27 +02:00
bin.ts Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00
headless.ts Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00
ipc.ts Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00
launcher.ts shutdown_codesys: kill orphan CODESYS.exe when launcher has no tracked PID 2026-04-26 01:20:39 +02:00
logger.ts Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00
script-manager.ts Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00
server.ts classifier + orchestrator: see untracked files, re-mirror after bump 2026-04-26 02:12:36 +02:00
types.ts Initial release: MCP server for CODESYS with persistent UI instance 2026-02-08 18:59:16 +10:00