Skip to content

Commit 9342b15

Browse files
committed
Merge #376: fix(pipefail): here-strings for the last grep -q pipelines in sync-project, review-module, conformance-check
Review: independent review MERGE — 8 producer|grep -q sites → here-strings verified equivalent (trailing newline, empty-$_q guard, inner pipeline status, `--` only helps); T3 static check flags exactly the 8 master sites; fixtures pipefail-grep-q 3/0, bug12-sync 61/0 ×3 (60/1 flake not reproduced), sync-dup-heading 6/0, sync-past-stock 22/0, conformance suites green; baseline 75,028 words; leak checks clean. Nit: CHANGELOG "one pipe buffer" (race can start ~4 KB). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VJgWP5vEoAsNsJYqCDMGNw
2 parents 8f89ad2 + 89ed1b2 commit 9342b15

5 files changed

Lines changed: 12 additions & 10 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Sections dated before 2026-09-19 predate the cycle and stay as they are. Named m
3131
- learn(lint): **known answers for four stock-rule findings on the toolkit's own conventions, and four modelling-error rule candidates.** New table in `lint-that-actually-runs.md`, with one entry for each finding. QUAL004 on a `DS_` flow used only as a Data grid 2 datasource (seen on v0.26.0 although the rule counts `datasource` refs) is accepted into the baseline with a reason, never renamed or given a fake caller (#360, BUG-DRAFT-qual004-dg2-datasource). QUAL004 on `TEST_` helpers and CUSTOM002 on `TEST_`/`GET_`/`PRS_`/`STUB_` are handled by baselining them with a reason, or (CUSTOM002) by `enabled: false` recorded in `PROJECT.md` (#241). QUAL002 on import mappings and published REST services, which MDL cannot document (MDL089), is handled by the rule's existing per-kind options (`check_import_mappings`, `check_published_rest_services`; #246). `process-coherence-pass.md` warns against deleting either QUAL004 kind. Upstream drafts for all three are in `bug-logs/pending-github-issues/`. `process/lint-backlog.md` Batch 7 adds the four missing #169 candidates (rows 51–54), and its inbox file is promoted and deleted. — joshuamoesa (#360), MendixMau (#241, #246, #169)
3232
- fix(test-agent): **the test-agent brief now names `journeys/` as a write location** ([#359](https://github.com/MendixMau/mxcli-project-toolkit/issues/359)). The brief confined writes to `{{TEST_DIR}}` (filled as `tests/e2e/`), while `verify-module.sh`, `fixture-manifest.sh`, `journey-proof.md` and the Stage-6 artifact gate read journeys from `${JOURNEY_DIR}` (default `journeys/`). A test-agent that obeyed its brief wrote `tests/e2e/journeys/*.journey.json`, which the gate never found, so the journey row stayed owed until the project added a root symlink. The brief and its workflow step now send journeys to `journeys/<Module>.journey.json` at the project root and say not to relocate them (`fixture-manifest.sh` reads only `journeys/`, whatever `JOURNEY_DIR` says); `agent-roles.md` says nothing fills `{{TEST_DIR}}` and how to fill it. A project's already-completed `test-agent.md` keeps its old text: `bin/sync-project.sh <project> --diff-completed` shows the change to copy in. No auto-fill: `init-agents.sh` and `sync-project.sh`'s pristine-stub comparison would both have to apply it, and the test directory is a project fact. Field evidence: an existing-app project (Ollama connector app, macOS) whose journey row cleared only after `ln -s tests/e2e/journeys journeys`. — joshuamoesa
3333
- learn(design-spacing, module-review): **breadcrumbs are links, and the LOOK asks "can I get back?" and "does every tile go somewhere?"** ([#232](https://github.com/MendixMau/mxcli-project-toolkit/issues/232), the still-open part). `design-spacing.md` §3 prescribed the page-header crumb as one plain-text `dynamictext`, so every wireframe and page copied it and `page-fidelity.js` scored the text crumb as correct. The scaffold now builds the crumb the way the StyleGallery does (`crumbs` container, `btn-link` link buttons, `crumb-sep` separators), with the current page and non-page sections as text, plus a rule that each crumb's target is in the wireframe's binding table, that an ancestor still open underneath is reached by close page (pointer to `examples/stylegallery/.../18-breadcrumbs.mdl`), and that a stepper says per step whether it is navigable. `module-review.md` §4c (the one LOOK question list) gains the two questions, the second pointing at `wiring-sweep.md` for the does-it-do-anything half. The ✅ example in `oneshot-page-structure-patterns.md` (on-demand) now shows a linked crumb. Baseline: +131 words (75,028 → 75,159). Field evidence: an 81-script Stage-5 build where every gate went green and a user found text-only crumbs and a menu entry opening one record instead of a list. — MendixMau
34+
- fix(sync-project, review-module, conformance-check): **the last eight `producer | grep -q` pipelines in these three scripts are here-strings, so pipefail cannot turn a match into a miss.** `grep -q` exits on its first match; a producer still writing then dies of SIGPIPE and, under `set -o pipefail`, the pipeline reports failure. `review-module.sh` read `SHOW MODULES` this way, and on a large app that output is over one pipe buffer, so a real module could be reported unknown. Five sites in `sync-project.sh` (one a `| head -1 | grep -q` chain), one in `review-module.sh`, two in `conformance-check.sh` (one short line each, cannot race; changed so the static check stays absolute). Same 1:1 rewrite as #328/#329. `test-pipefail-grep-q.sh` T3 now covers the three files (15 scripts); against master it lists all eight sites. Field evidence: none yet. — r-eng-backlog item 2, MendixMau
3435
- process(build): **Stage 5 drafts the ready set in parallel and applies serially.** The runbook dispatch row said "sequential within a module", which serialised drafting even for independent scripts; it now points to `iterative-build-loop.md` → Gate cost, the single statement of the rule. The unit is the build-plan row: every `BUILD` row whose "Depends on" rows are all applied, minus overlapping writers (two rows that replace, alter or drop+create the same document never share a ready set, and no row is drafted while it overlaps a queued unapplied one; `brd-to-build-plan.md` has Produces name every document a row writes), runs at once, its scripts in order, one `mdl-agent` per script. Applies stay one at a time through `bin/exec.sh`, and the ready set is recomputed after each. A queued draft made before a sibling apply landed is re-checked with `mxcli diff --format struct` (preflight STOP rule 23); any removal line (checked against `describe` per BUG-146) or STOP rule 21 target means re-draft, never patch, because a stale restatement of a shared document is exactly rule 21's silent seed-call loss and passes `check --references`. Report `ready set N, drafted N, applied k`; the `mdl-agent` template says a drafter never applies and never depends on an unapplied draft. Field evidence: none yet. — MendixMau
3536
- fix(platform-link): **CLI commits now show their changed documents in Studio Pro History.** Studio Pro's History → Model changes pane reads a `ModelChanges` array from the commit's `refs/notes/mx_metadata` note. Trap 6c's hand-written template set it to `[]`, so every mxcli/agent commit showed "Model changes 0" (field project: 270 of 270 notes empty). New `project-bin/mx-metadata-note.py` (stdlib only) computes the array from the commit's changed `.mxunit` files, in Studio Pro's entry shape: Status, UnitID, UnitType, UnitName and Module (walked up the `.mpr` Unit tree). It has `changes` / `write` / `backfill` / `sync <remote>` subcommands. `install-project-hooks.sh` now also installs post-commit and post-rewrite hooks that write the note and never block, and `--check` covers them, so `sync-project.sh` rolls them out to wired projects. Notes are published with `mx-metadata-note.py sync <remote>` after the branch push. Push config is never touched. With mxcli v0.26+ in the project root the hooks call `mxcli git note --write` instead (mendixlabs/mxcli#1337); the Python script is the fallback for older pins, and on 160 field commits both wrote the same 3,594 entries. Trap 6c rewritten. Measured against Studio Pro's own notes, 51 commits in 5 apps: 3387/3389 entries exact on all five fields. Field run on a 357-commit Mendix 11.15.0 app: 158 notes backfilled and pushed, and Studio Pro History lists the documents per revision. Review fixes: an earlier revision added `HEAD` + the notes ref to `remote.<r>.push`. It was dropped because any push refspec replaces `push.default`. A branch tracking a differently named upstream got a new same-named branch on Team Server where `simple` refuses, a missing local notes ref failed the whole push, and nobody knows whether Studio Pro's own push reads that config. The installer now only fetches the remote's notes (non-forced). It removes that exact `HEAD` + notes pair if present, and leaves and reports any other entry. `sync` handles a remote with no notes ref (it used to exit 1) and retries a rejected push once after re-merging. A note that already lists changes (Studio Pro's) is never overwritten by `write`/`backfill` without `--force`, and `sync` keeps a colleague's non-empty note over ours. The mxcli probe greps `git note --help` for `--write`. Hooks and docs call the script through `resolve_py`. Fixture `tests/wave2/test-mx-metadata-note.sh` (40 cases, over real captured template units; single- and two-tree layouts, amend, backfill and `--force`, push exit codes identical to a no-hooks clone, leftover-refspec cleanup, sync to an empty remote and its retry, notes fetch at install, a diverged notes merge; green under `init.defaultBranch` master and main). — field project (Mendix 11.15 app), MendixMau
3637
- learn(fixture-seeding): **explore the data structure first, choose rows by use case, scan actions for resets before any run.** Two seeding runs on public template apps: seeding raised journey passes 33 -> 58 and 20 -> 51 of the same sets (FAIL 93 -> 68, 163 -> 132; INVALID unchanged), and a "Reset all demodata" journey wiped accounts so 104 of 127 journeys reported `The username or password you entered is incorrect`, identical on empty and seeded databases. Skill gains three questions a seed must answer, a use-case checklist, a destructive-action scan, a generic traps table with symptoms, measured expectations and a denominator checklist; routing trigger now fires on seed/test/demo data and empty pages. Independent review fixes: object ids follow the Mendix bigint pattern with a business-key guard (no uuids), associations are seeded where the page's path stores them, four new traps (enum names, inheritance chain, calculated attributes, view/external entities), and the port-offset and container-label traps moved to `harness-architecture.md`. — MendixMau

‎bin/sync-project.sh‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ AGENTS="$MXTK_AGENTS"
9898
is_pure_stub() {
9999
local f="$1"
100100
grep -q "STUB GENERATED" "$f" || return 1
101-
sed 's/{{DOUBLE_BRACE}}//g' "$f" | grep -q '{{[A-Z_]*[^}]*}}'
101+
grep -q -- '{{[A-Z_]*[^}]*}}' <<<"$(sed 's/{{DOUBLE_BRACE}}//g' "$f")"
102102
}
103103

104104
DIFF_COMPLETED=0
@@ -342,7 +342,7 @@ elif [ -n "$INTAKE" ]; then
342342
echo "Updated: $INTAKE — appended Q9 (interview mode). Answer it this session."
343343
fi
344344
CHANGES=$((CHANGES + 1))
345-
elif ! q9_section "$INTAKE" | grep -q 'Answered\|Unverified'; then
345+
elif ! grep -q -- 'Answered\|Unverified' <<<"$(q9_section "$INTAKE")"; then
346346
# Present, but ungradeable by gate-check's Stage P check.
347347
Q9_TMP=$(mktemp "${TMPDIR:-/tmp}/q9sec.XXXXXX") || exit 2
348348
Q9_REF=$(mktemp "${TMPDIR:-/tmp}/q9ref.XXXXXX") || exit 2
@@ -358,7 +358,7 @@ elif [ -n "$INTAKE" ]; then
358358
# into the "edited, NOT touching it" warning below.
359359
q9_current_text > "$Q9_REF"
360360
if cmp -s "$Q9_TMP" "$Q9_REF" \
361-
|| sed -n '2,$p' "$Q9_TMP" | grep -v '^[[:space:]]*$' | head -1 | grep -q '^_Not yet asked\._'; then
361+
|| grep -q -- '^_Not yet asked\._' <<<"$(sed -n '2,$p' "$Q9_TMP" | grep -v '^[[:space:]]*$' | head -1)"; then
362362
echo "Note: $INTAKE Q9 is the unanswered template text — Stage P will FAIL until"
363363
echo " the kickoff interview happens. That is correct; nothing to repair."
364364

@@ -428,7 +428,7 @@ elif [ -n "$INTAKE" ]; then
428428
MISSING_N=0
429429
while IFS= read -r _q; do
430430
[ -n "$_q" ] || continue
431-
if ! sed -n 's/^## [0-9][0-9]*\. //p' "$INTAKE" | grep -Fxq "$_q"; then
431+
if ! grep -Fxq -- "$_q" <<<"$(sed -n 's/^## [0-9][0-9]*\. //p' "$INTAKE")"; then
432432
MISSING_Q="$MISSING_Q$_q
433433
"
434434
MISSING_N=$((MISSING_N + 1))
@@ -1368,7 +1368,7 @@ _ea_rewrite_item3() { # $1=file $2=start-prefix $3=end-prefix $4=replacemen
13681368
{ if (skip) { if (index($0, endp) == 1) { exit }; print; next }
13691369
if (index($0, start) == 1) { print; skip = 1 } }
13701370
' "$f" | tr '\n' ' ' | tr -s ' ')"
1371-
printf '%s' "$_blk" | grep -qF -- "$needle" || return 1
1371+
grep -qF -- "$needle" <<<"$_blk" || return 1
13721372
fi
13731373
[ "$DRY_RUN" -eq 1 ] && return 0
13741374
_tmp="$(mktemp "${TMPDIR:-/tmp}/eaitem3.XXXXXX")" || return 1

‎project-bin/conformance-check.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,9 @@ runnable() {
282282
*…*|*"..."*) return 1 ;; # elided placeholder, not a real command
283283
esac
284284
# Must be VERB [NOUN...] OPERAND — i.e. end in something that looks like an identifier.
285-
printf '%s' "$c" | grep -Eq '^(SHOW|DESCRIBE)( +[A-Z]+)+ +[A-Za-z_][A-Za-z0-9_.]*( .*)?$' && return 0
285+
grep -Eq -- '^(SHOW|DESCRIBE)( +[A-Z]+)+ +[A-Za-z_][A-Za-z0-9_.]*( .*)?$' <<<"$c" && return 0
286286
# SHOW <PLURAL> with no operand is legitimate (e.g. "SHOW MODULES", "SHOW PAGES").
287-
printf '%s' "$c" | grep -Eq '^SHOW +[A-Z]+$' && return 0
287+
grep -Eq -- '^SHOW +[A-Z]+$' <<<"$c" && return 0
288288
return 1
289289
}
290290

‎project-bin/review-module.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ if [ -f "$ROOT/.mxcli/catalog.db" ] && command -v sqlite3 >/dev/null 2>&1; then
281281
fi
282282
if [ "$MODULE_KNOWN" -eq 0 ]; then
283283
MODLIST="$(with_timeout 60 "$(find_project_mxcli 2>/dev/null || echo ./mxcli)" -p "$MPR" -c "SHOW MODULES" 2>/dev/null)"
284-
printf '%s\n' "$MODLIST" | grep -qE "^\| *$MODULE +\|" && MODULE_KNOWN=1
284+
grep -qE -- "^\| *$MODULE +\|" <<<"$MODLIST" && MODULE_KNOWN=1
285285
fi
286286

287287
if [ "$MODULE_KNOWN" -eq 0 ]; then

‎tests/wave2/test-pipefail-grep-q.sh‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,16 @@ for f in bin/lib/skill-routing.sh bin/lib/obligation-check.sh bin/lib/triage-tem
8484
bin/gate-check.sh bin/check-portability.sh \
8585
project-bin/_common.sh project-bin/check-design-portability.sh project-bin/check-page-shell.sh \
8686
project-bin/close-task.sh project-bin/check-sp-health.sh project-bin/app-restart.sh \
87-
project-bin/test-stack-up.sh; do
87+
project-bin/test-stack-up.sh \
88+
bin/sync-project.sh project-bin/review-module.sh project-bin/conformance-check.sh; do
8889
[ -f "$TK/$f" ] || { hits="$hits
8990
$f: missing"; continue; }
9091
h="$(grep -nE '(^|[^|])\|[[:space:]]*grep[[:space:]]+(-[A-Za-z]*q|[^|]*[[:space:]]-[A-Za-z]*q)' "$TK/$f" \
9192
| grep -vE '^[0-9]+:[[:space:]]*#' | grep -v 'find_artifact' | sed "s|^|$f:|")"
9293
[ -n "$h" ] && hits="$hits
9394
$h"
9495
done
95-
if [ -z "$hits" ]; then ok "0 pipelines into grep -q across 12 scripts"
96+
if [ -z "$hits" ]; then ok "0 pipelines into grep -q across 15 scripts"
9697
else bad "pipeline into grep -q found (use a here-string: grep -q -- PAT <<<\"\$x\")" "${hits#?}"; fi
9798

9899
echo

0 commit comments

Comments
 (0)