fix: preserve apostrophes in fm-brief no-mistakes and secondmate scaffolds#975
Open
sparkus wants to merge 1 commit into
Open
fix: preserve apostrophes in fm-brief no-mistakes and secondmate scaffolds#975sparkus wants to merge 1 commit into
sparkus wants to merge 1 commit into
Conversation
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Fix the macOS system Bash 3.2 parse failure in firstmate's own bin/fm-brief.sh on current upstream origin/main. Preserve the brief and secondmate charter text and behavior exactly while making apostrophes such as firstmate's, owner's, and advisor's literal and safe in the scaffold. Use the minimal correct quoted-heredoc or equivalent restructuring, extend tests/fm-brief.test.sh with regression coverage that scaffolds both a ship brief and a --secondmate charter containing apostrophes, and require bash -n, the fm-brief tests, and bin/fm-lint.sh to pass. Ship the contribution as a PR targeting kunchenguid/firstmate origin/main; do not merge it because it awaits the upstream maintainer.
What Changed
bin/fm-brief.shinto arender_no_mistakes_dodfunction using a quoted (<<'EOF') delimiter outside the command substitution, so apostrophes and backticks stay literal instead of tripping macOS system Bash 3.2's lexer (issue fm-brief.sh: scaffold fails to parse on macOS system bash 3.2 (line 314: unexpected EOF while looking for matching `)') #958) — the previousDOD=$(cat <<EOF ... EOF)form brokebash -non the entire script when the body contained an apostrophe.firstmate's authority check,no-mistakes' own guidancereworded) now that the quoted heredoc no longer requires escaping.tests/fm-brief.test.shregression coverage that scaffolds both a ship brief and a--secondmatecharter/scope containing apostrophes (owner's,advisor's) and asserts they render verbatim, and refreshed the surrounding comments andtest_no_mistakes_dod_wordingassertions.Risk Assessment
✅ Low: Minimal, well-bounded fix that moves one heredoc out of a command substitution with byte-identical output and adds correct regression tests; the only note is a pre-existing latent pattern in untouched sibling branches.
Testing
Confirmed the bug and its fix under the actual macOS system Bash 3.2.57:
bash -nfails on the base with the exact issue #958 error and passes clean on the target. The full fm-brief test suite (16 tests) passes, including the new regression test that scaffolds both a ship brief and a --secondmate charter with apostrophes. bin/fm-lint.sh passes at exit 0 after fetching the pinned ShellCheck 0.11.0 native binary into a temp dir (no system install; cleaned up afterward). Captured product-level evidence as the rendered brief.md files showing "firstmate's authority check", literal backticks, and the "owner's"/"advisor's" charter lines preserved. Temp downloads removed; worktree is clean.Evidence: Ship brief — Definition-of-done section (apostrophes + literal backticks preserved)
# Definition of done ... Follow the guidance no-mistakes itself provides for the mechanics: it loads when you invoke /no-mistakes, andno-mistakes axi run --helpplus thehelplines in eachaxiresponse are authoritative... Firstmate applies the authority contract in itsAGENTS.mdand obtains any required captain decision. - Avoid--yes: it would silently bypass firstmate's authority check and any required captain escalation. After /no-mistakes reports CI green ... appenddone: PR {url} checks greenand stop.Evidence: Secondmate charter — apostrophe lines preserved
4:Supervise the owner's domain. 7:Handle the advisor's requests.Evidence: Full rendered ship brief
Evidence: Full rendered secondmate brief
Evidence: Base-vs-target bash -n parse (issue #958 repro + fix)
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
bin/fm-brief.sh:288- The direct-PR (line 288) and local-only (line 300) branches still build their DOD via the fragileDOD=$(cat <<EOF ... EOF)command-substitution + unquoted-heredoc pattern that caused issue fm-brief.sh: scaffold fails to parse on macOS system bash 3.2 (line 314: unexpected EOF while looking for matching `)') #958. They parse today only because their bodies happen to contain no apostrophes; any future apostrophe added to either body would reintroduce the exact bash 3.2 parse failure across the whole script. The fix is correctly minimal for the reported bug, but converting these two siblings to the same quoted-heredoc-function form would eliminate the trap. The added test_script_parses/test_ship_modes_generate_clean_briefs tests only catch such a regression after an apostrophe is introduced, not the structural fragility.✅ **Test** - passed
✅ No issues found.
/bin/bash -non base commit fm-brief.sh (10ee779) → reproduces issue #958 parse failure (exit 2, 'line 314: unexpected EOF while looking for matching `)'')/bin/bash -n bin/fm-brief.shon target commit → exit 0 (clean parse under system Bash 3.2.57)/bin/bash tests/fm-brief.test.sh→ all 16 tests ok, including newtest_apostrophes_render_in_ship_and_secondmate_scaffoldsbin/fm-lint.shwith pinned ShellCheck 0.11.0 (native darwin.aarch64 release) on PATH → exit 0Manual scaffold:FM_HOME=... bin/fm-brief.sh ship-demo-apos some-proj→ DOD renders literal apostrophes and backticksManual scaffold:FM_SECONDMATE_CHARTER="...owner's..." FM_SECONDMATE_SCOPE="...advisor's..." bin/fm-brief.sh mate-demo-apos --secondmate --no-projects→ charter/scope apostrophes preserved✅ **Document** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.