Skip to content

fix(init): make first-run guidance Render-aware; fix mangled signup URL#6

Merged
aaronbrethorst merged 1 commit into
mainfrom
first-run
May 10, 2026
Merged

fix(init): make first-run guidance Render-aware; fix mangled signup URL#6
aaronbrethorst merged 1 commit into
mainfrom
first-run

Conversation

@aaronbrethorst
Copy link
Copy Markdown
Member

@aaronbrethorst aaronbrethorst commented May 10, 2026

Summary

  • hooks init is run from two contexts now: a developer's laptop AND docker-entrypoint.sh on a fresh Render volume. The "Next steps" block was written for the first and is wrong/confusing on Render — it told the operator to start a server that was already running, didn't know the public URL even though HOOKS_PUBLIC_URL was set, and pointed RENDER_WEBHOOK_SECRET at "your environment" without saying which one. Detect Render via RENDER=true and branch the output accordingly; substitute the known public URL into the ingest URL and the hooksctl login --server line.
  • Recommend hooksctl login (modern device-pairing) over export HOOKS_TOKEN=… (legacy admin-token bearer) on the dev-laptop step.
  • Fix a long-standing rendering bug in the placeholder signup line: when neither --server-url nor HOOKS_PUBLIC_URL was set, the explanatory comment got concatenated into the URL, e.g. signup: http://localhost:8080 # set --server-url or HOOKS_PUBLIC_URL/signup?code=…. The fallback now prints a clean URL with a separate note. Same fix applied in runInvite.
  • docs/quickstart.md §3b updated to match the new Render-aware log output and to lead with the bootstrap signup URL (admin token framed as a legacy fallback).

Test plan

  • go vet ./...
  • go tool golangci-lint run ./cmd/hooks/...
  • go test ./...
  • Manually exercised hooks init in a tmpdir with no env, with HOOKS_PUBLIC_URL set, and with RENDER=true HOOKS_PUBLIC_URL=… set — verified each prints the right "Next steps" variant and that the signup URL is no longer mangled in the placeholder case.

Summary by CodeRabbit

Release Notes

  • Documentation

    • Updated Render Blueprint quickstart to clarify startup log outputs, explaining both bootstrap signup URL and admin token as one-time secrets and their specific use cases.
  • Improvements

    • Refined initialization and invitation command messaging with improved next-steps guidance and consistent URL handling.

Review Change Stack

The "Next steps" block printed by `hooks init` was written for a local
laptop install, but the Docker entrypoint also runs it on a fresh Render
volume. On Render most of the steps were wrong: the server is already
running, RENDER_WEBHOOK_SECRET goes in the dashboard's Environment tab
(not a local shell), and the public URL is known via HOOKS_PUBLIC_URL
but the message hardcoded `<your-host>`.

Detect Render via the platform's `RENDER=true` env var and branch the
guidance accordingly. Use the public URL when known, point at the modern
`hooksctl login` device-pairing flow instead of `export HOOKS_TOKEN=…`,
and stop telling Render users to start a server that's about to start
itself.

Also fix the fallback signup line in `init` and `invite`, which
concatenated its own explanatory comment into the URL:
  signup: http://localhost:8080  # set --server-url or HOOKS_PUBLIC_URL/signup?code=…
The fallback now prints a real URL with a separate note. Quickstart §3b
updated to match the new Render-aware log output.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 10, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d4953f8d-86d6-4af2-b58f-f3ab941efdc6

📥 Commits

Reviewing files that changed from the base of the PR and between 776bf8e and d4bf7ca.

📒 Files selected for processing (2)
  • cmd/hooks/main.go
  • docs/quickstart.md

📝 Walkthrough

Walkthrough

The PR refactors hooks init and hooks invite output handling by extracting a shared signupBase URL helper and moving runInit's post-init guidance into a new printInitNextSteps function with Render-aware conditionals. Documentation is updated to reflect the new startup log output.

Changes

Output Refactoring with Shared URL Helper

Layer / File(s) Summary
Shared URL Helper
cmd/hooks/main.go
New signupBase(serverURL) helper trims trailing slashes and returns localhost:8080 placeholder when URL is unset, with a flag to signal when real configuration is needed.
Init Command Output
cmd/hooks/main.go
runInit now uses signupBase for URL construction and calls new printInitNextSteps(publicURL, adminToken, hasBootstrapInvite) function which conditionally prints Render-aware guidance and admin token instructions based on environment and bootstrap invite status.
Invite Command Output
cmd/hooks/main.go
runInvite refactored to use signupBase for consistent URL construction and standardized informational lines (role, single-use, expiry) without embedding placeholder explanation inline.
Documentation
docs/quickstart.md
Render Blueprint quickstart updated to document container first-boot output: both bootstrap signup URL and one-time admin token as secrets shown once, plus Render-aware "Next steps" checklist with HOOKS_PUBLIC_URL prefilled.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately captures the two main changes: making first-run guidance Render-aware and fixing the mangled signup URL bug. It is concise, specific, and clearly represents the primary objectives of the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch first-run

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud
Copy link
Copy Markdown

@aaronbrethorst aaronbrethorst merged commit dfa5b60 into main May 10, 2026
7 checks passed
@aaronbrethorst aaronbrethorst deleted the first-run branch May 10, 2026 00:03
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