fix(bootstrap): enforce safe Treehouse compatibility - #1247
Conversation
|
Automated reminder: thanks for the PR! This branch currently has a merge conflict with the base branch. When you get a chance, please rebase onto (or merge) the latest base branch, resolve the conflict, and push. After that, checks will re-run and the PR will get looked at again. Noted for firstmate#1247 at |
7b90bf2 to
84f6c25
Compare
|
Rebased onto current The conflict
Resolved by folding this branch's stricter parsing into the shared helper rather than reintroducing a second parser:
The test-side diff carried through the rebase byte-for-byte; every added regression case still passes, including the version boundaries, prerelease rejection, malformed and multiline output, lease support, and the Orca exemption. Note on the history-preservation line in the descriptionThe Intent section says this branch preserves commits Verification
|
Bootstrap only checked that treehouse supported `get --lease`, so a build older than 2.0.1 - the release that adds atomic state persistence and conservative corrupt-state recovery - passed the check and left guarded cleanup exposed to malformed Treehouse state. Add a version gate alongside the lease probe: parse `treehouse --version`, reject unparseable, multiline, or trailing-line output, and report treehouse as MISSING below 2.0.1.
84f6c25 to
7cb3950
Compare
|
Fixed the portable-serial failure ( DiagnosisThe gate is not firing unconditionally, and the default backend is not being mistreated. Running identical fixtures against
Row 3 shows the check stays scoped to Treehouse-using backends: an incompatible Treehouse under The failing test is not on a default or unset backend either. The actual cause is that test's fake Treehouse stub, which implements only FixThe stub now answers I also audited every fake Treehouse stub in the suite by extracting each stub body rather than grepping the file. Thirteen test files define one and nine omit VerificationFull portable CI lanes on
|
Intent
Prevent Firstmate from accepting unsafe Treehouse versions after v2.0.0's non-atomic state persistence corrupted a shared worktree-pool record. Require Treehouse 2.0.1 or newer plus durable lease support only for backends that use Treehouse, reject malformed output including any treehouse --version output with an extra line, preserve the exact existing MISSING upgrade diagnostic and captain-consent install path, and retain the accepted focused regression. Preserve fm-teardown.sh's generic-error refusal and do not touch recovered project pools or task cleanup. This reconciled history intentionally preserves original accepted commits 6c245b2 and 0b3e604 together with every prior pipeline-generated commit through 85311e3; publish only through the authorized Moshik21/firstmate fork while keeping kunchenguid/firstmate as the official upstream and PR base.
What Changed
MISSINGupgrade diagnostic and Orca exemption.Risk Assessment
✅ Low: The sentinel-based capture now preserves and rejects trailing extra lines while retaining the Treehouse version floor, lease check, backend scoping, exact diagnostic, install-consent path, and required history.
Testing
The focused bootstrap and teardown suites passed; manual CLI evidence shows safe Treehouse is accepted, unsafe/malformed/lease-less versions receive the exact existing MISSING diagnostic, and Orca ignores unused Treehouse, while diff and ancestry checks confirmed teardown/data boundaries and required history were preserved.
Evidence: Treehouse bootstrap compatibility CLI transcript
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
🔧 **Review** - 1 issue found → auto-fixed ✅
bin/fm-bootstrap.sh:542- The required criterion says to “reject malformed output including any treehouse --version output with an extra line,” but command substitution strips all trailing newlines before the newline check. Consequently, output such asv2.0.1\n\nbecomesv2.0.1and is accepted. Capture with a sentinel or another mechanism that preserves trailing newlines, then validate exactly one line.🔧 Fix: Reject trailing lines in Treehouse version output
✅ Re-checked - no issues remain.
✅ **Test** - passed
✅ No issues found.
bash tests/fm-bootstrap.test.shbash tests/fm-teardown-endpoint-safety.test.shManual bootstrap CLI matrix covering Treehouse v2.0.1, v2.0.0, extra diagnostic/blank lines, missing lease support, and the Orca exemptiongit diff --quiet 99533c5d7d3702050e6084429dddff6ea4fe1aa0..bb774dc1ed51483d070802e9d87b6229a850bb76 -- bin/fm-teardown.shgit merge-base --is-ancestorchecks for preserved commits6c245b2,0b3e604, and85311e39Diff inspection confirming no changes underprojects,data, orstate✅ **Document** - passed
✅ No issues found.
🔧 Fix: Confirm clean lint with pinned ShellCheck 0.11.0
1 warning still open:
✅ **Push** - passed
✅ No issues found.