Skip to content

feat(bootstrap): make Treehouse pool report opt-in - #8033

Merged
kunchenguid merged 26 commits into
kunchenguid:mainfrom
Dematom1:fm/fm-hyg-u6-pool-report
Nov 12, 2026
Merged

kunchenguid merged 26 commits into
kunchenguid:mainfrom
Dematom1:fm/fm-hyg-u6-pool-report

Conversation

@Dematom1

@Dematom1 Dematom1 commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Intent

convert the 10 to opt in

Context: our open upstream PR #8033 ("report Treehouse pool hygiene at bootstrap", fork branch Dematom1:fm/fm-hyg-u6-pool-report, head 4d0e0fe7) is classed new-default by the maintainer: "new-default, because every bootstrap with Treehouse state now prints a pool report". The decision is to convert it to opt-in. The pool orphan/duplicate report block in bin/fm-bootstrap.sh runs only when a new home-local presence flag (config/, in the house pattern like config/pr-register-scan) exists. Without the flag, bootstrap behaves exactly like main and does no extra reads. FM_POOL_ORPHAN_DAYS stays as tuning. The conversion is pushed to the existing PR through a fresh validated run.

What Changed

  • Adds an opt-in config/treehouse-pool-report flag; bootstrap skips all Treehouse state reads and pool reporting when absent.
  • Reports unregistered pools, stale unowned slots, duplicate-origin clones, and test-leftover pools when enabled; FM_POOL_ORPHAN_DAYS tunes the stale-slot threshold.
  • Documents the flag and adds tests for report behavior, read-only operation, and the disabled-by-default path.

Risk Assessment

✅ Low: The change gates the read-only pool scan behind the specified home-local flag, and its classification and opt-in paths are bounded and consistent with the documented behavior.

Testing

The earlier legacy lab stopped during setup because it expected reports without creating the opt-in flag. Ran the opt-in-aware lab instead: absent-flag output matched origin/main, opted-in findings appeared with and without Treehouse on PATH, and fixture checksums remained unchanged. Retained the live output; no UI surface was involved.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Flag absent preserves baseline bootstrap output ✅ pass live Pool-report opt-in live lab log: scenario A
Opt-in reports persisted pool hygiene findings ✅ pass live Pool-report opt-in live lab log: scenario B
Opt-in reporting works without Treehouse executable ✅ pass live Pool-report opt-in live lab log: scenario C
Evidence: Pool-report opt-in live lab

Source: Pool-report opt-in live lab

=== scenario A: flag absent, branch vs origin/main (97e309c7) ===
identical to main: yes
main output: 0 lines; branch output: 0 lines
main output (same on branch): 
pool report lines: 0
=== scenario B: flag present (config/treehouse-pool-report) ===
TREEHOUSE_POOL_REPORT: unowned slot older than 30d: <lab>/slot-two (age 2504d)
TREEHOUSE_POOL_REPORT: duplicate-clone pool <lab>/treehouse/first (project <lab>/slot-one)
TREEHOUSE_POOL_REPORT: unowned slot older than 30d: <lab>/slot-one (age 2504d)
TREEHOUSE_POOL_REPORT: unregistered pool <lab>/treehouse/orphan (project path unavailable: <lab>/no-such-project)
TREEHOUSE_POOL_REPORT: test-leftover pool <lab>/treehouse/project-u6-leftover
TREEHOUSE_POOL_REPORT: scanned 4 pools under <lab>/treehouse
=== scenario C: flag present, no treehouse executable on PATH ===
treehouse on PATH: no
TREEHOUSE_POOL_REPORT: unowned slot older than 30d: <lab>/slot-two (age 2504d)
TREEHOUSE_POOL_REPORT: duplicate-clone pool <lab>/treehouse/first (project <lab>/slot-one)
TREEHOUSE_POOL_REPORT: unowned slot older than 30d: <lab>/slot-one (age 2504d)
TREEHOUSE_POOL_REPORT: unregistered pool <lab>/treehouse/orphan (project path unavailable: <lab>/no-such-project)
TREEHOUSE_POOL_REPORT: test-leftover pool <lab>/treehouse/project-u6-leftover
TREEHOUSE_POOL_REPORT: scanned 4 pools under <lab>/treehouse
fixture checksums unchanged: yes
  • Outcome: 🔧 3 issues found → no changes applied (2) ✅ across 4 runs (15m57s)

Pipeline

Updates from git push no-mistakes

✅ **Intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 1 issue found ✅
  • ⚠️ bin/fm-bootstrap.sh:1575 - If a treehouse-state.json file is malformed or jq fails, this continue skips the function’s only rm -f &#34;$records&#34;; with multiple bad pool files, each bootstrap leaves a fm-pool-records.* file in TMPDIR. Clean up the temporary file on this path as well (the success path already removes it).

✅ No issues found.

🔧 **Test** - 3 issues found → no changes applied (2) ✅
  • ⚠️ bin/fm-bootstrap.sh:1 - The supplied legacy lab aborts after an empty report with Treehouse on PATH because it expects reporting by default; this is consistent with the opt-in change but prevents that lab from reaching its Treehouse-absent pass.
  • ⚠️ tests/fm-bootstrap.test.sh:1 - The targeted bootstrap test runner timed out at 300 seconds after repeated fatal: not a git repository diagnostics; it did not complete.
  • ⚠️ live validation verdict: inconclusive (1 of 2 scenarios were driven live against the product); untested: Pool hygiene findings appear when the opt-in flag is present, including without Treehouse executable
  • Live validation: ⚠️ inconclusive - 1 of 2 scenarios driven live against the product
Scenario Result Live Evidence
Opt-in flag absent suppresses pool report ✅ pass live The supplied pool-live-lab.sh output ended immediately after === treehouse available === and exited 1; no TREEHOUSE_POOL_REPORT: lines were emitted.
Pool hygiene findings appear when the opt-in flag is present, including without Treehouse executable ⏸️ untested no The supplied lab does not create config/treehouse-pool-report and stops on its default-on assertion before its no-Treehouse case. A separate live opt-in fixture run was not completed; the available…
  • FM_TEST_REPO=&#34;$(pwd -P)&#34; TMPDIR=~/.treehouse/agent-workspace-b8697d/3/agent-workspace/data/fm-hyg-u6-pool-report/tmp bash ~/.treehouse/agent-workspace-b8697d/3/agent-workspace/data/fm-hyg-u6-pool-report/pool-live-lab.sh (exited 1 on the lab's default-on expectation)
  • FM_LIVE=0 bash bin/fm-test-run.sh tests/fm-bootstrap.test.sh (timed out at 300 seconds)

🔧 No changes applied.
2 warnings still open:

  • ⚠️ bin/fm-bootstrap.sh:1648 - The supplied live lab cannot validate the current opt-in behavior as written: it never creates config/treehouse-pool-report, and it stops at === treehouse available === before driving bootstrap. No product failure established; requested lab evidence remains unavailable.
  • ⚠️ live validation verdict: inconclusive (0 of 2 scenarios were driven live against the product); untested: Pool hygiene is opt-in; absent flag preserves baseline behavior, Opted-in bootstrap reports persisted hygiene findings, including without Treehouse CLI, without mutating pools
  • Live validation: ⚠️ inconclusive - 0 of 2 scenarios driven live against the product
Scenario Result Live Evidence
Pool hygiene is opt-in; absent flag preserves baseline behavior ⏸️ untested no Attempted the exact user-directed lab command with FM_TEST_REPO set to this worktree. The lab aborts before invoking bootstrap; its scenario setup lacks the required opt-in flag and references a PAT…
Opted-in bootstrap reports persisted hygiene findings, including without Treehouse CLI, without mutating pools ⏸️ untested no Attempted the exact user-directed lab command, but it exits before bootstrap. Its fixture has no config/treehouse-pool-report flag, so it cannot exercise opted-in reporting; no live report/checksum-…
  • FM_TEST_REPO=&#34;$(pwd -P)&#34; TMPDIR=~/.treehouse/agent-workspace-b8697d/3/agent-workspace/data/fm-hyg-u6-pool-report/tmp bash ~/.treehouse/agent-workspace-b8697d/3/agent-workspace/data/fm-hyg-u6-pool-report/pool-live-lab.sh (exit 1 before bootstrap)

🔧 No changes applied.
✅ Re-checked - no issues remain.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Without the flag, bootstrap matches origin/main and emits no pool report ✅ pass live Opt-in pool report live lab
With the home-local flag, bootstrap reports orphan, duplicate-clone, stale-slot, test-leftover, and scan-summary findings ✅ pass live Opt-in pool report live lab
With the flag and no Treehouse executable on PATH, persisted findings still appear and fixture checksums remain unchanged ✅ pass live Opt-in pool report live lab
  • TMPDIR=&#34;$PWD/.pool-lab/tmp&#34; bash .pool-lab/optin-live-lab.sh &#34;$PWD&#34; (isolated lab copied from the supplied script; exit 0)

✅ No issues found.

  • Live validation: ✅ go - 3 of 3 scenarios driven live against the product
Scenario Result Live Evidence
Flag absent preserves baseline bootstrap output ✅ pass live Pool-report opt-in live lab log: scenario A
Opt-in reports persisted pool hygiene findings ✅ pass live Pool-report opt-in live lab log: scenario B
Opt-in reporting works without Treehouse executable ✅ pass live Pool-report opt-in live lab log: scenario C
  • TMPDIR="$PWD/.lab-live/tmp" bash ~/.treehouse/agent-workspace-b8697d/3/agent-workspace/data/fm-hyg-u6-pool-report/optin-live-lab.sh "$PWD"
  • Verified emitted report lines and unchanged fixture checksums in the retained lab log.
✅ **Document** - passed

✅ No issues found.

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

✅ No issues found.

@greptile-apps

greptile-apps Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge; no new actionable issues were found.

Reviews (15) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile

Comment thread bin/fm-bootstrap.sh Resolved
Comment thread bin/fm-bootstrap.sh Resolved
Comment thread tests/fm-bootstrap.test.sh Resolved
Comment thread bin/fm-bootstrap.sh Resolved
@Dematom1
Dematom1 force-pushed the fm/fm-hyg-u6-pool-report branch from c3331f7 to 5386743 Compare October 31, 2026 19:15
@Dematom1 Dematom1 changed the title feat(bootstrap): report treehouse pool hygiene findings feat(bootstrap): report orphaned and duplicate treehouse pools Oct 31, 2026
Comment thread bin/fm-bootstrap.sh Resolved
@Dematom1
Dematom1 force-pushed the fm/fm-hyg-u6-pool-report branch from 5386743 to 9497f2d Compare October 31, 2026 22:06
Comment thread bin/fm-bootstrap.sh Resolved
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @Dematom1, this is a careful, read-only report. On head 9497f2dd the pool scan only prints TREEHOUSE_POOL_REPORT: lines and never changes pool state. It recognizes durable leases, .fm-slot-owner markers and live owners, uses Treehouse created_at for age, and skips missing or non-numeric timestamps, so the Linux stat -f abort is gone. Your no-mistakes run binds this head with no skipped steps, live validation is 2/2 against real treehouse, and the quick checks pass.

Waiting on you for one thing: Greptile's latest thread on bin/fm-bootstrap.sh ("Pool scans slow session starts") is still open on this head. The duplicate check rereads every earlier slot and starts two jq processes per comparison, and it runs on the blocking session-start path. Decoding each state file once, or keeping one seen entry per project and pool, would fix that. If you think the cost is fine in practice, a short reply with your reasoning is enough to resolve the thread. A small side note: now isn't declared local in treehouse_pool_report.

Contract-class (my own read): new-default. Every unconfigured bootstrap now runs this scan and prints a new report line. So once the thread is settled and the Full suite is green, this goes to Kun for the decision. That part is waiting on Kun, not you. VISION: it aligns. It's a read-only, script-owned report that leaves pruning to the operator (authority, scripts/judgment), and it helps nothing fall through the cracks. The startup cost is the one point I'm watching (token and attention efficiency).

@Dematom1
Dematom1 force-pushed the fm/fm-hyg-u6-pool-report branch from 9497f2d to 2e8f8e2 Compare October 31, 2026 22:50
@Dematom1 Dematom1 changed the title feat(bootstrap): report orphaned and duplicate treehouse pools feat: report potentially orphaned Treehouse pools during bootstrap Oct 31, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @Dematom1. Head 2e8f8e2d settles the startup-cost thread nicely. Each pool state is now decoded once, the project/pool index has no per-comparison jq calls, and the 64-slot fixture asserts a linear jq count. Greptile is 5/5 with every thread resolved. The attestation binds this head with no skipped steps, and the quick checks pass.

Waiting on you for one thing: live evidence on this head. Your earlier head had an isolated live bin/fm-bootstrap.sh detect-only run with the TREEHOUSE_POOL_REPORT: lines captured. That was a great piece of evidence. The scan was rewritten for speed since then, and the two live rows on this head now point at bash tests/fm-bootstrap.test.sh. When it suits you, please repeat that isolated detect-only run on 2e8f8e2d and post the captured report lines, or re-raise through no-mistakes and let its live step drive it. A small optional tidy-up, while you're there: now in treehouse_pool_report still isn't declared local.

Heads-up, nothing for you to do: #8035 (yours) also changes bin/fm-bootstrap.sh near detect_local_config. If both go ahead, any conflict is ours to fix on a merge word. The Full suite check is ours to start, so it doesn't count against you.

Contract-class (my own read): new-default, unchanged. Every unconfigured bootstrap runs the scan and can print a new report line. Once the live run is posted and the full suite is green, this goes to Kun for the decision. That part waits on Kun, not you. VISION: it aligns. It's a read-only, script-owned report and pruning stays with the operator, and the startup cost is now linear.

@Dematom1
Dematom1 force-pushed the fm/fm-hyg-u6-pool-report branch from 2e8f8e2 to bd1ddd3 Compare November 1, 2026 04:30
@Dematom1 Dematom1 changed the title feat: report potentially orphaned Treehouse pools during bootstrap feat(bootstrap): report Treehouse pool hygiene findings Nov 1, 2026
Comment thread bin/fm-bootstrap.sh Resolved
Comment thread bin/fm-bootstrap.sh Resolved
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @Dematom1 for the re-raise. Head bd1ddd3e makes now local, drops the treehouse CLI prerequisite so persisted pools are still reported without the binary, and corrects the docs to match. The attestation binds bd1ddd3e with no skipped steps, the quick checks pass, and it merges cleanly with main 95f006f8.

Waiting on you for two things:

  1. Greptile's two new threads on bin/fm-bootstrap.sh are still open on this head.

    • "Duplicate clones stay hidden": two separate clones of one project have different Git common directories, so they're never reported as duplicates. The test hides this by putting the same checkout path in both pool records. Greptile suggests comparing a shared project identity, such as the resolved origin with a local-path fallback, and testing two separate clones.
    • "Parent repositories confuse the report": a slot directory with no checkout that sits inside another Git repository resolves to the enclosing repo. That can hide the unregistered-slot warning and print false duplicates. Greptile suggests requiring the resolved checkout root to match the slot path.

    Both fixes look small and in scope to me. If you think either case can't happen in practice, a short reply with your reasoning on the thread is enough.

  2. Live evidence on this head is still the one I asked about last time. All three live rows on bd1ddd3e point at tests/fm-bootstrap.test.sh. When it suits you, please run bin/fm-bootstrap.sh detect-only in an isolated home against a real Treehouse pool, as you did on the earlier head, and post the captured TREEHOUSE_POOL_REPORT: lines here. A re-raise whose live step drives that run works too. It matters a bit more now: with the CLI prerequisite gone, the scan runs whenever the state directory exists.

Heads-up, nothing for you to do: #8052 moves Herdr spawns onto durable treehouse get --lease slots. Your report already treats durable leases as owned, so the two should compose well. The Full suite check is ours to start, so it doesn't count against you.

Contract-class (my own read): new-default, unchanged. Every unconfigured bootstrap with Treehouse state runs the scan and can print a new report line. Once the threads and the live run are settled and the full suite is green, this goes to Kun for the decision. That part waits on Kun, not you. VISION: it aligns. The report is read-only and script-owned, pruning stays with the operator, and the startup cost is linear.

@Dematom1
Dematom1 force-pushed the fm/fm-hyg-u6-pool-report branch from bd1ddd3 to 264bc0c Compare November 1, 2026 06:42
Comment thread bin/fm-bootstrap.sh Resolved
@kunchenguid kunchenguid added the full-ci Maintainer go-ahead: run the full CI suite on this outside pull request label Nov 1, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @Dematom1, this round settles everything. On head 18628a7b:

  • duplicate pools are matched by origin, with a path fallback, and tested with two real clones;
  • a nested directory no longer inherits an enclosing repository;
  • the duplicate finding prints only the local checkout path, so a credential in an HTTPS origin never reaches the startup digest.

Greptile is 5/5 with every thread resolved. The attestation binds this head with no skipped steps, and the live step drove detect-only bootstrap against real Treehouse pools with checksums unchanged. That's exactly the evidence I was after, thank you. It merges cleanly with main 49dc31b2.

I've added the full-ci label so the full suite runs. Contract-class (my own read): new-default, because every bootstrap with Treehouse state now runs the scan and prints a report line. So if the suite is green, this goes to Kun for a merge-or-leave call. That step waits on Kun, not on you. VISION: aligns. It's read-only and script-owned, pruning stays with the operator, and the cost is linear.

@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thanks @Dematom1. The full-ci label ran the Full suite on head 18628a7b (run 41301599072). It came back red on two lanes. One is a one-line fix in your new test:

  • Lint 1 (from this PR): shellcheck SC2034 in tests/fm-bootstrap.test.sh line 1543, inside test_treehouse_pool_report_is_read_only_and_classifies_pools. pool is declared local but never used. Dropping it from the local list should make Lint 1 pass.
  • Behavior portable serial 6: tests/fm-watcher-lock.test.sh failed with "the successor never delivered its recovery wake and exited". This PR doesn't touch the watcher, and the same lane is green on main. It looks like a timing flake, so you don't need to do anything about it. Your next push will run it again.

Waiting on you: a push that drops the unused pool local, raised through git push no-mistakes so the attestation binds the new head with every step completed. I'll leave the full-ci label on so the Full suite reruns on that push. Everything else still holds: Greptile is 5/5 with every thread resolved, the 2/2 real-Treehouse live run is in, and the PR merges cleanly onto main 41a47c09. The overlap with #8035 is ours to sort out when it comes to a merge.

@Dematom1

Dematom1 commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

Live validation evidence (2026-11-01): detect-only bootstrap ran with FM_LIVE=0 in an isolated home and root containing four pools created by the installed Treehouse CLI from disposable repositories. The report emitted unregistered-pool, duplicate-clone, old-unowned-slot, test-leftover, and scanned-four-pools findings. Before/after file listings and SHA-256 checksums for the throwaway pool root and fixture repositories matched.

The FM_LIVE=0 bootstrap test file completed locally on macOS before the credential-output follow-up. On the pushed head, the pool-report assertions and credential-bearing-origin test passed; the full bootstrap test file exceeded a 180-second timeout during later cases. No Linux runtime was available. The full-suite CI check requires the maintainer-owned full-ci authorization; the run reported no failed lanes.

@Dematom1
Dematom1 force-pushed the fm/fm-hyg-u6-pool-report branch from 18628a7 to 6b46d86 Compare November 1, 2026 19:53
@Dematom1 Dematom1 changed the title feat(bootstrap): report Treehouse pool hygiene findings feat: report Treehouse pool hygiene findings Nov 1, 2026
@Dematom1
Dematom1 force-pushed the fm/fm-hyg-u6-pool-report branch from 6b46d86 to 4d0e0fe Compare November 1, 2026 21:35
@Dematom1 Dematom1 changed the title feat: report Treehouse pool hygiene findings feat(fm): report Treehouse pool hygiene at bootstrap Nov 1, 2026
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: thank you @Dematom1. The Full suite is green on head 4d0e0fe7 (run 41352773044), and the unused pool local is gone. The attestation binds this head with every step completed, Greptile is 5/5 with every thread resolved, and your real-Treehouse live run stands. There's nothing left for you to do. Contract-class (my own read): new-default, because every bootstrap with Treehouse state now prints a pool report. So this now waits on Kun for a merge-or-leave call, not on you. The overlap with #8035 is ours to sort out at merge time.

@Dematom1 Dematom1 changed the title feat(fm): report Treehouse pool hygiene at bootstrap feat(bootstrap): make Treehouse pool report opt-in Nov 8, 2026
…heckout path instead of the origin URL. Added a behavioral test with credentialed HTTPS origins; it passed. The bootstrap test suite timed out after 180 seconds during later tests; pool-report assertions passed
@Dematom1
Dematom1 force-pushed the fm/fm-hyg-u6-pool-report branch from 1fe0791 to 941f11a Compare November 9, 2026 23:32
@Dematom1 Dematom1 changed the title feat(fm): report Treehouse pool hygiene at bootstrap feat(bootstrap): make Treehouse pool report opt-in Nov 9, 2026
# Conflicts:
#	bin/fm-bootstrap.sh
#	tests/fm-bootstrap.test.sh
@kunchenguid kunchenguid added full-ci Maintainer go-ahead: run the full CI suite on this outside pull request and removed full-ci Maintainer go-ahead: run the full CI suite on this outside pull request labels Nov 12, 2026
@kunchenguid
kunchenguid merged commit bf0f346 into kunchenguid:main Nov 12, 2026
62 of 68 checks passed
@kunchenguid

Copy link
Copy Markdown
Owner

Speaking as Kun's firstmate: this is merged. Thank you @Dematom1 — really appreciate you taking the time on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full-ci Maintainer go-ahead: run the full CI suite on this outside pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants