fix(status): stop saying "not-provisioned" for every connector failure - #3
Merged
Conversation
`connectorState` was initialised to "not-provisioned" and printed verbatim, so
any failure before the service measured anything reported as unprovisioned.
That is not a neutral default — it is a specific claim that tells the reader to
run `bb cf-tunnel provision`. On 2026-08-15 the real cause was cloudflared
missing from launchd's PATH, and both mgrin and an agent ran provision
repeatedly against a tunnel that had been fully provisioned for weeks. A wrong
instruction is worse than none, because it consumes the reader's next move.
Three changes:
- Provisioning is now read from STORED STATE (is there a connector token?)
rather than from a flag a failed service may never have set. A token present
with the connector down is "provisioned and broken", which needs a different
action from "never set up".
- The initial value is "unknown". Where the plugin cannot tell, it says so
instead of guessing — the same rule checkout-drift.sh follows for a stale
fetch.
- Whatever the service threw is captured and printed as an `error:` line, so
the reason travels with the state. The reason was the whole answer here and
status could not show it.
The rule lives in lib/connector-state.ts as two pure functions rather than
inline, because the failure path cannot be exercised against a live tunnel
without breaking it — extracting it is what makes it testable at all. Four tests
cover it, including the exact regression: provisioned + never measured must
report "unknown", never "not-provisioned".
77 tests pass. Verified live: status still reports connected with no error line
while cloudflared is up.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
connectorStatewas initialised to"not-provisioned"and printed verbatim, so any failure before the service measured anything reported as unprovisioned.That is not a neutral default — it is a specific claim telling the reader to run
bb cf-tunnel provision. On 2026-08-15 the real cause was cloudflared missing from launchd's PATH (fixed in #2), and both mgrin and an agent ranprovisionrepeatedly against a tunnel that had been fully provisioned for weeks. A wrong instruction is worse than none, because it consumes the reader's next move.Three changes
unknown. Where the plugin cannot tell, it says so rather than guessing — the same rulecheckout-drift.shfollows for a stale fetch.error:line, so the reason travels with the state. The reason was the whole answer here, and status had no way to show it.Why the rule is a pure function
It lives in
lib/connector-state.tsrather than inline, because the failure path cannot be exercised against a live tunnel without breaking it — extracting it is what makes it testable at all.Four tests cover it, including the exact regression: provisioned + never measured must report
unknown, nevernot-provisioned.77 tests pass. Verified live: status still reports
connectedwith no error line while cloudflared is up.🤖 Generated with Claude Code