Skip to content

fix(sync): item-3 rewrite works on BSD awk and no longer reports a rewrite that failed - #427

Merged
MendixMau merged 4 commits into
masterfrom
fix/426-item3-bsd-awk
Oct 16, 2026
Merged

MendixMau merged 4 commits into
masterfrom
fix/426-item3-bsd-awk

Conversation

@MendixMau

Copy link
Copy Markdown
Owner

Fixes #426

What changed and why: _ea_rewrite_item3 passed the multi-line item-3 replacement through awk -v. Stock macOS awk rejects that ("newline in string", exit 2), so the file stayed unchanged while sync printed "Rewrote" and counted a change, on every run. The replacement is now streamed from a temp file (same pattern as the Q9 repair). The helper returns 2 when awk fails, and the caller prints a WARN: instead of "Rewrote". Other awk -v sites were checked: all pass single-line values, nothing else to fix.

Before / after (bash tests/wave2/test-exec-approval.sh, macOS awk 20200816, also with PATH=/usr/bin:/bin):

PASS / FAIL
master 37 / 6
this branch, original 43 checks 43 / 0
this branch incl. 3 new assertions 46 / 0 (both PATHs)
master incl. the 3 new assertions 38 / 8 (new ones fail on old code)

New assertions use an awk shim that fails the replacement call: no "Rewrote", a WARN is printed, file unchanged.

Impact

Row Answer
Process None: no new human step or gate; a failed rewrite now prints a WARN.
Dependencies bin/sync-project.sh, tests/wave2/test-exec-approval.sh, CHANGELOG.md. No new artifact reads. Uses mktemp and awk getline, already used by the Q9 repair.
Context cost none: no routed or always-loaded file touched
Behaviour n/a: scripts only
Runtime n/a: one extra temp file per rewrite, not on a hot path

Field evidence: observed on macOS (awk 20200816) with synthetic fixtures only. No project data.

  • No client data anywhere in the diff
  • Size cap respected (3 files)
  • Test tier: T1, test-exec-approval.sh on macOS BSD awk
  • CHANGELOG line added

🤖 Generated with Claude Code

MendixMau and others added 2 commits October 16, 2026 12:54
…write that failed

Fixes #426

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The failure line was a plain echo, so WARNINGS stayed unchanged and sync
could still close with 'up to date' and pass --strict. Also return 2 when
the replacement file cannot be written. The test syncs the same fixture
with a working awk for a baseline and requires the six failures to add to
the warning count (2 -> 8); on the previous head it stays 2 -> 2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MendixMau
MendixMau merged commit 3c035f7 into master Oct 16, 2026
2 checks passed
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.

sync-project.sh reports the exec-approval item 3 rewrite but leaves files unchanged on macOS (BSD awk)

1 participant