fix(homeboy): single-source homeboy_project_id and resolve real registered id#171
Merged
Merged
Conversation
…tered id homeboy_project_id() was defined twice — in lib/data-machine.sh and lib/homeboy.sh. upgrade.sh sources data-machine before homeboy, so the homeboy.sh copy won and the data-machine.sh copy (fixed in #169) was dead code. The winning copy's final fallback ran homeboy_slugify on the site domain, turning 'extrachill.com' into 'extrachill' — which is not a registered Homeboy project (the real id is 'extrachill-site'). Homeboy returned {"success": false, "code": "project.not_found"}. This was latent until #169 made the attach loop parse the JSON .success field instead of trusting the exit code: the now-truthful failure tripped upgrade.sh's 'set -e' and aborted the upgrade at exit 4, right after 'Attaching Homeboy components'. Consolidate to a single definition in lib/homeboy.sh (the one that wins by source order) that resolves in priority: $HOMEBOY_PROJECT_ID, site-root homeboy.json, then a domain match against 'homeboy project list' (the real registered id). $AGENT_SLUG and homeboy_slugify remain only as last-ditch setup-time fallbacks for projects not yet registered — they must never win over a real lookup. Remove the shadowed duplicate from data-machine.sh. Verified end-to-end on a Homeboy-enabled install: resolves 'extrachill-site' and the attach loop completes '45 attached, 0 failed' (exit 0) instead of aborting at exit 4. Setup-time unregistered domains still slugify as before. Fixes #170
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.
Summary
homeboy_project_id()(it lived in bothlib/data-machine.shandlib/homeboy.sh; the latter won by source order, silently shadowing the fix(homeboy): report attach-path results truthfully and resolve project id consistently #169 fix).lib/homeboy.shnow resolves in priority:$HOMEBOY_PROJECT_ID→ site-roothomeboy.json→ domain match againsthomeboy project list(the real registered id).$AGENT_SLUGandhomeboy_slugifyremain only as last-ditch setup-time fallbacks for not-yet-registered projects.Why
The winning
homeboy.shcopy's fallback ranhomeboy_slugifyon the site domain, turningextrachill.comintoextrachill— not a registered project (the real one isextrachill-site). Homeboy returned{"success": false, "code": "project.not_found"}.Latent until #169 made the attach loop parse
.successinstead of trusting the exit code: the now-truthful failure trippedupgrade.sh'sset -eand aborted the upgrade at exit 4, right after "Attaching Homeboy components".xtrace proof:
Verification
End-to-end on a Homeboy-enabled install:
extrachill-site; attach loop completes45 attached, 0 failed(exit 0) instead of aborting at exit 4.brandnew-site.com) still slugifies tobrandnew-site, preserving create-project behavior.homeboy_project_id()definition remains (grep -rn 'homeboy_project_id()' lib/).Fixes #170