0
0
Fork 0
Codesys-MCP-SP21-plus/tests
Karstein Phobic Nyvold Kvistad 33363fbfd0 fix(release_project_version): stop README corruption and silent Changelog no-op
BUG 1: the README.md version replace was content.replace(/v\d+\.\d+\.\d+\.\d+/g,
newVersion) -- a blanket sweep that rewrote every version-looking string in
the file, corrupting historical fix landmarks, build-archive snapshots, and
even a different project's synced-library version (observed live on
SeaLeopard's README v1.3.0.0 -> v1.3.1.0). Replaced with updateReadmeVersion:
only touches the version token on the first "# " title heading, or a single
"**Version:**" line (Lib001 convention). If no anchor is found (or the
Version-line anchor is ambiguous), nothing is changed and the reason is
reported -- no global-replace fallback.

BUG 2: appendChangelogEntry's "ownership guard" checked for the literal text
'Auto-generated by `bump_project_version`', but the intro this same tool
seeds into new files says 'Auto-appended by `bump_project_version` on
release.' -- the strings never matched, so every one of this tool's own
previously-created Changelog.md files (SeaLeopard, since its v1.0.0.0 seed)
was treated as foreign and silently skipped. The skip only logged to
stderr while release_project_version's caller printed a fixed "Changelog.md:
appended vX" success line regardless. Separately, a genuinely hand-maintained
Keep-a-Changelog file (Lib001's CHANGELOG.md, "## [Unreleased]" / "## [x.y.z.w]
- date") was never understood at all. Confirmed via SeaLeopard commits
3c87d18 / c98c264, which hand-repaired both the missing changelog entries and
the corrupted README.

Replaced with buildChangelogUpdate (pure) + appendChangelogEntry (I/O
wrapper): detects the existing file's heading style from its own headings
(not intro wording) and emits a matching entry -- "ours" style
(## vX.Y.Z.W -- date) inserted before the first existing entry, or
Keep-a-Changelog style (## [X.Y.Z.W] - date) inserted after any
"## [Unreleased]" section (or before the first version heading if none).
An unrecognized format is left untouched with a clear skip reason. The write
is verified by re-reading the file before release_project_version reports
success; a write that didn't happen is now reported as NOT appended.

Rebuilt dist/ (tsc + scripts copy) since the MCP server runs from there.

Tests: 16 new (update-readme-version, build-changelog-update,
append-changelog-entry), full suite: npx vitest --run -- 229 passed, 1
pre-existing unrelated failure (script-manager.test.ts trips on a local
__pycache__ dir under src/scripts, present before this change too).
2026-07-23 17:20:02 +02:00
..
integration fix: project user tools log in to user management before modifying 2026-06-12 15:21:25 +02:00
unit fix(release_project_version): stop README corruption and silent Changelog no-op 2026-07-23 17:20:02 +02:00
bench-results-v5.json test(bench): v5 sweep -- fix set_pou_code params, all 10 cases pass 2026-04-26 19:30:48 +02:00
bench-results.json fix: 4 broken-tool fixes (compile json long, connect_to_device LoginMode, 2026-04-26 16:53:25 +02:00
bench.mjs test(bench): v5 sweep -- fix set_pou_code params, all 10 cases pass 2026-04-26 19:30:48 +02:00
mock_watcher.py fix(test): retry on PermissionError in mock_watcher (Win race) 2026-04-29 08:34:06 +02:00
test-fixes.mjs fix(create_folder): try project.create_folder(name, SV_POU) first; drop ScriptManager cache 2026-04-26 17:16:44 +02:00
TEST_OVERVIEW.md rename: Codesys-MCP-SP22+ -> Codesys-MCP-SP21+ + multi-install README + missing tools 2026-04-26 22:02:46 +02:00