Skip to content

refactor(app-restart, test-scratch): share the mxtest guard and mxcli-run pid check via _common.sh - #370

Closed
MendixMau wants to merge 1 commit into
masterfrom
refactor/shared-mxtest-helpers
Closed

MendixMau wants to merge 1 commit into
masterfrom
refactor/shared-mxtest-helpers

Conversation

@MendixMau

Copy link
Copy Markdown
Owner

Direct lane

What changed and why (one paragraph):
mxtest_after_startup, mxtest_left and mxtest_refusal were copied into both project-bin/app-restart.sh and project-bin/test-scratch.sh. They now live once, in a new section at the end of project-bin/_common.sh. The backlog said the two copies differed by the "Otherwise restore it" echo. In fact both copies print that line. The real difference is app-restart's else branch (the "stop the live app with Ctrl+C" advice), which test-scratch never reaches because it always passes test-scratch. The existing tool-name argument already selects that branch, so no new parameter was needed. The shared function's refusal text is byte-identical to each old copy: I checked it for both callers with HEAD set to ?, empty and a microflow name. pid_is_mxcli_run (app-restart) becomes mxtk_pid_is_mxcli_run, built on mxtk_pid_args:

  • Linux with /proc: run must be a whole argument after one that names mxcli. An argument that merely contains " run " no longer counts, which is the one intended tightening.
  • macOS, and Linux without /proc: the joined ps line is matched as before.
  • Windows: the tasklist image-name check is kept, so there is no PowerShell call per check.

Both scripts now stop with exit 2 and the sync-project.sh --upgrade-bin _common.sh remedy when the installed _common.sh predates these helpers. This follows the existing mxtk_port_holder guard pattern. Each fixture gets one new case for this guard. The test-scratch case fails 3/3 against master's script, which shows it tests the guard. bin/lib/install-manifest.sh and sync need no change: both files are already in MXTK_PROJECT_BIN, an unedited _common.sh is refreshed through past-stock, and a hand-edited one holds back its callers (BIN_HOLD). The guard covers what is left.

Item 6 (mxtest/pid half) of the 2026-10-14 engineering backlog review. The lock half (holder_live/take_over) is a separate PR.

Field evidence — none yet. This is a behaviour-preserving refactor of existing instruments. The fixture outputs on the existing cases are identical to master's (a line-by-line diff of the ok/FAIL lines, with pids and ports normalised):

  • test-app-restart: 64/0 on master → 69/0 (64 identical + 5 new)

  • test-test-scratch: 46/0 → 51/0 (46 identical + 5 new)

  • test-shared-lock-takeover: 6/0 → 6/0

  • test-stack-up-local: 60/0 → 60/0

  • test-pipefail-grep-q 3/0 and test-common-windows 10/0 also pass; both scan or source _common.sh.

  • No client data anywhere in the diff

  • Size cap: 6 files, ~350 lines changed, most of it a move

  • Test tier reached: T1. Fixtures above, plus a Linux probe of mxtk_pid_is_mxcli_run against real processes (mxcli run --local → 0, mxcli "do run x" → 1, mxcli test → 1; macOS path forced: joined-line behaviour unchanged). No macOS or Git Bash run.

  • For a changed instrument: no new parser, so no golden capture needed; layouts unaffected (no path logic changed); Windows branch kept verbatim

  • For a new skill: n/a

  • CHANGELOG.md line appended, crediting the source

  • New bug entries: n/a

Checks: render-routing --check in sync, baseline 75,028 words before and after (budget 80,000); check-scripts 110/110; check-portability clean; leak guard clean; check-no-private-citations clean; check-pr-discipline clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VJgWP5vEoAsNsJYqCDMGNw


Generated by Claude Code

…-run pid check via _common.sh

mxtest_after_startup, mxtest_left and mxtest_refusal were duplicated in
project-bin/app-restart.sh and project-bin/test-scratch.sh. They now live once
in project-bin/_common.sh. The copies differed only in a refusal branch that
test-scratch never takes; the tool-name argument still selects it, so each
script prints byte-for-byte what it printed before.

pid_is_mxcli_run (app-restart.sh) becomes mxtk_pid_is_mxcli_run on
mxtk_pid_args: Linux matches a whole `run` argument after mxcli, macOS keeps
the joined ps line, Windows keeps the tasklist image check.

Both scripts exit 2 with the sync remedy when the installed _common.sh
predates the move; one fixture case each.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VJgWP5vEoAsNsJYqCDMGNw
MendixMau pushed a commit that referenced this pull request Oct 14, 2026
…rd and mxcli-run pid check via _common.sh

Review: independent review MERGE at bbc67b0 — moved helpers byte-identical to both originals (76 lines); stricter Linux pid match verified against ./mxcli run --local, -p X.mpr run --local, env prefixes, exec wrappers, absolute paths; older-_common.sh guard cannot fire on a synced project; extract-by-function fixtures unaffected. Fixtures: app-restart 69/0, test-scratch 51/0, shared-lock-takeover 6/0, stack-up-local 60/0, common-windows 10/0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VJgWP5vEoAsNsJYqCDMGNw
MendixMau added a commit that referenced this pull request Oct 15, 2026
…journey controls, fixes) (#385)

Lands #340 #363 #362 #355 #370 #368 #364 #365 #366 #372 #367 #371 #376 #369 #373 #377 #378 #380.

Review: each constituent PR independently reviewed by a fresh agent that did not write it; merged into integration/2026-10-15 only on a MERGE verdict with green CI (per-PR Review lines in the integration merge commits). After-fix rounds: #373 (env-var cap, rename/skip-loops freshness), #377 (inline URI fallback), #378 (full-pack double count, slice content). Stub diet (#369/#378/#380) behaviour A/B, 5 reps x 2 drafting tasks + 5 retrieval probes x 3 reps: trimmed context no worse than master on every scored metric (planted STOP refused 20/20, parse failures page 2/5 vs 3/5, probes 15/15); mdl Stage 5 56,236 -> 30,647 words, baseline 75,028 -> 73,233. Full suites on c9bc073: run-tests 33/0, wave2 111 fixtures 0 failing. Field evidence: none yet for the instruments (#355 warn-only, #373/#377 read-only).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VJgWP5vEoAsNsJYqCDMGNw
@MendixMau

Copy link
Copy Markdown
Owner Author

Landed on master in #385 (squash 868b3cb), after its own independent review on the night integration branch. Closing this PR.


Generated by Claude Code

@MendixMau MendixMau closed this Oct 15, 2026
MendixMau pushed a commit that referenced this pull request Oct 15, 2026
_common.sh: end-of-file conflict with the mxtest helpers (#370), both sections kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VJgWP5vEoAsNsJYqCDMGNw
@MendixMau
MendixMau deleted the refactor/shared-mxtest-helpers branch October 15, 2026 10:48
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