Skip to content

fix(bin): fix BSD sed -i inbox bug and record known test failures - #2851

Open
pramendra wants to merge 5 commits into
kunchenguid:mainfrom
pramendra:fm/fm-repo-preexisting-test-failures
Open

fix(bin): fix BSD sed -i inbox bug and record known test failures#2851
pramendra wants to merge 5 commits into
kunchenguid:mainfrom
pramendra:fm/fm-repo-preexisting-test-failures

Conversation

@pramendra

Copy link
Copy Markdown

Intent

Triage and reduce firstmate's whole-repo pre-existing test-suite failures on main: verify the actionlint-absence premise, fix real portability bugs found along the way (BSD sed -i incompatibility in bin/fm-inbox.sh, BSD wc -l padding in two test files' string comparisons), confirm the remaining failures (herdr/pi version drift, an fm-on.sh PATH-ordering discrepancy, a load-sensitive watcher-lock flake) reproduce identically on pristine main and are not caused by any branch, file each as its own GitHub issue, and record them durably in docs so contributors stop re-triaging the same failures.

What Changed

  • Fixed a BSD/macOS sed -i incompatibility in bin/fm-inbox.sh's queue_note: instead of relying on GNU-only in-place editing, it now writes the rewritten note to a temp file (with chmod 600) and renames it into place.
  • Fixed BSD wc -l whitespace-padding in string comparisons in tests/fm-tool-update-check.test.sh and tests/fm-voice-relay.test.sh (piping through tr -d ' '), and added actionlint-pin self-skip guards to the actionlint-dependent cases in tests/fm-lint-workflows.test.sh and tests/fm-lint.test.sh, mirroring the existing ShellCheck pinned_ready guard.
  • Added docs/verification/known-test-failures.md, cataloguing pre-existing main test failures reproduced independently of any branch (herdr/Pi version drift, an fm-on.sh PATH-ordering discrepancy, and a load-sensitive fm-watcher-lock flake) with linked GitHub issues, and wired it into CONTRIBUTING.md, docs/documentation-audiences.json, and .gitignore (.serena/).

Risk Assessment

✅ Low: Both prior review findings (accidental .serena commit, dropped 0600 permission on inbox notes) are correctly fixed in the current HEAD with no regressions; the remaining diff (actionlint self-skip guards, BSD wc -l portability, known-test-failures doc, CONTRIBUTING pointer) is well-scoped, matches the stated intent, and all four referenced GitHub issues (#2841-#2844) exist and match their doc descriptions.

Testing

All targeted tests pass on a genuine BSD (macOS) environment: the fm-inbox.sh sed rewrite and the wc -l padding fixes in fm-tool-update-check.test.sh/fm-voice-relay.test.sh are exercised and pass, and the actionlint self-skip guard was verified in both states (actionlint present → runs real checks; actionlint hidden from PATH → self-skips cleanly instead of failing). One unrelated timing-sensitive flake ('the spoken round trip did not hold') appeared on a first run of fm-voice-relay.test.sh and passed cleanly on immediate re-run with no code changes, confirming it's an environmental flake unrelated to this diff (the diff touches only fm-inbox.sh and wc -l assertions, not the voice timing path) and not one of the three failures this change documents, so no action was taken on it. No leftover artifacts; worktree is clean.

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 1 issue found → auto-fixed (2) ✅
  • ⚠️ .serena/project.yml:1 - Commit 0d0ad7f ("Verify test-failure docs already accurate; no stale facts found") adds .serena/.gitignore and .serena/project.yml — an auto-generated local Serena MCP tool config with a session-specific project_name ("01M0PW11N8HWG78YANJX18G325") — despite the commit message claiming no changes were needed. This directory does not exist on main and is unrelated to the stated verification task. Git history on this same repo shows this exact accidental-commit pattern recurring and being reverted in follow-up commits (e.g. "chore: drop accidentally committed .serena local tool config", "no-mistakes(review): Drop accidentally committed .serena local tool config"), confirming it is tool-session noise rather than an intentional deliverable.

🔧 Fix: Untrack accidentally committed .serena config; ignore .serena/
1 warning still open:

  • ⚠️ bin/fm-inbox.sh:187 - The BSD-portability fix for the id rewrite silently drops the note file's permissions from 0600 to the process umask (typically 0644, world-readable). mktemp "$INBOX/.staging-XXXXXX" on line 172 creates $tmp at mode 0600 regardless of umask, but the replacement sed "..." "$tmp" >"$tmp.rewritten" on line 187 creates $tmp.rewritten as a fresh file subject to umask, and the following mv "$tmp.rewritten" "$tmp" (line 188) then mv "$tmp" "$INBOX/$id.note" (line 189) propagate that looser mode to the final note. Verified concretely: mktemp yields -rw-------, and after sed ... > f.rewritten && mv f.rewritten f under umask 022 the file becomes -rw-r--r--. Every captain note/voice-transcribed body written by fm-inbox.sh note/say is now world-readable on a shared machine, whereas before this fix (on Linux, where GNU sed -i actually worked pre-portability-fix) the original 0600 mode was preserved by GNU sed's in-place edit. The codebase treats 0600 as a deliberate security baseline for exactly this kind of artifact (see the explicit chmod 0600 calls in bin/fm-wake-lib.sh:510,619). Fix: add chmod 600 "$tmp.rewritten" before the first mv.

🔧 Fix: Restore 0600 perms on rewritten inbox note before rename
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • bash bin/fm-test-run.sh tests/fm-voice-relay.test.sh — exercises bin/fm-inbox.sh's queue_note (BSD sed -i fix) and the wc -l padding fix; all cases pass
  • bash bin/fm-test-run.sh tests/fm-tool-update-check.test.sh — exercises the wc -l padding fix in the one-line-report assertions; all cases pass
  • bash bin/fm-test-run.sh tests/fm-lint.test.sh tests/fm-lint-workflows.test.sh — with actionlint 1.7.12 present on PATH, all actionlint-dependent regression checks run for real and pass
  • env PATH=<actionlint removed> bash bin/fm-test-run.sh tests/fm-lint-workflows.test.sh — confirms the self-skip guard actually engages (SKIP lines) instead of failing closed when the pinned actionlint is absent from PATH
  • git status --porcelain after test runs — worktree clean, no leftover test artifacts
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@greptile-apps

greptile-apps Bot commented Aug 23, 2026

Copy link
Copy Markdown

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Reviews (4): Last reviewed commit: "no-mistakes(review): Untrack accidentall..." | Re-trigger Greptile

Comment thread bin/fm-inbox.sh Outdated
@pramendra

Copy link
Copy Markdown
Author

Final whole-repo confirmation

Independently of the pipeline's targeted test step, I ran the complete bin/fm-test-run.sh --all suite (154 scripts) against this branch's final head (9113451) to confirm the overall count.

FM_TEST_SUMMARY total=154 failed=4 skipped_gate=21 duration_ms=6206604

The 4 remaining failures are exactly the ones this PR documents and files issues for:

tests/fm-calm-pi-extension.test.sh (#2842) did not fail in this particular full-suite run, but I confirmed it fails deterministically in isolation, twice, against both a fresh origin/main checkout and a feature branch, with the exact same Pi 0.84.2 install - its own e2e case is apparently timing-sensitive in the same way fm-watcher-lock.test.sh is, so its absence here doesn't change the finding in #2842, only that it (like the flake documented for #2844) doesn't fail on every run.

Net result: of the original 9 failures reported, 5 are now fixed on this branch (2 actionlint self-skips already on main before this PR, plus the 3 real bugs this PR fixes: the fm-inbox.sh sed portability bug and the two wc -l padding bugs), and the remaining 4 are durably documented in docs/verification/known-test-failures.md with a filed issue each, rather than left as folklore.

@pramendra
pramendra force-pushed the fm/fm-repo-preexisting-test-failures branch from 9113451 to 98c16c1 Compare August 23, 2026 19:05
Your Name added 5 commits August 24, 2026 05:27
… absent

Real workflow-YAML linting can't be faked with a stub binary, so 9 tests
across fm-lint-workflows.test.sh and fm-lint.test.sh invoke the genuine
actionlint on the ambient PATH. Without the pinned 1.7.12 installed
locally, fm-lint-workflows.sh fails closed and these tests failed with
it, even though CI always installs the pin first and was never at risk.

Mirror the existing pinned_ready guard already used for ShellCheck in
fm-lint.test.sh: add an equivalent actionlint_ready check and self-skip
the affected tests when the pin isn't resolved, instead of failing
closed. Coverage is unchanged wherever the pin is present (CI, or after
running bin/fm-install-actionlint.sh locally).
Whole-repo suite triage found 4 failures that reproduce identically on
a fresh, unmodified origin/main checkout and are not caused by any
branch: herdr 0.8.2 and Pi 0.84.2 version drift against e2e mitigations
verified on older releases, a real PATH-ordering discrepancy in
fm-on.sh's remote dispatch path, and a load-sensitive flake in
fm-watcher-lock.test.sh that only reproduces under full-suite
concurrent load. Each is filed as its own issue (kunchenguid#2841-kunchenguid#2844) rather
than folded into this triage, and recorded here so a contributor can
tell their own branch's failures apart from these without re-deriving
the triage from scratch.
…TRIBUTING

A local --all walk was already documented as not being no-mistakes
Test, but nothing told a contributor that a non-clean result there
might be pre-existing rather than caused by their branch.
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.

1 participant