Skip to content

feat(cmd): hand plugins and invitation links the public address without a mail relay - #289

Merged
SirLouen merged 5 commits into
mainfrom
fix/288
Oct 25, 2026
Merged

SirLouen merged 5 commits into
mainfrom
fix/288

Conversation

@SirLouen

@SirLouen SirLouen commented Oct 25, 2026 •

Copy link
Copy Markdown
Member

Closes #288.

What

  • AlphOne reads ALPHONE_PUBLIC_URL on every start, with the same checks, and hands it to plugins with or without a mail relay. A relay still requires it.
  • An invitation link AlphOne shows for you to pass on starts with the address when it is set.
  • On an install without a relay, a malformed value now stops serve, the account commands that take -as, migrate, seed -yes and account:create-admin, and alphone check names it.
  • The configuration page lists the setting with the core settings, and the upgrade notes say what changes.

Why

A plugin that sends people to Microsoft or Google to sign in needs the public address to bring them back. Today that only works on installs that also send mail.

Testing Instructions

Run the testing toolchain.

Summary by CodeRabbit

  • New Features
    • ALPHONE_PUBLIC_URL now configures the application’s public address independently of mail settings and is available to plugins, even when no mail relay is configured.
    • Invitation links use this address when set; otherwise, they remain relative.
  • Bug Fixes
    • Invalid public URLs are rejected even without a mail relay. A public URL is required when mail is enabled.
  • Documentation
    • Updated configuration and upgrade guidance to explain public URL requirements, validation, and its use in invitation links.

@codescene-access codescene-access Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Health Improved (1 files improve in Code Health)

Gates Passed
4 Quality Gates Passed

See analysis details in CodeScene

View Improvements
File Code Health Impact Categories Improved
run.go 8.93 → 8.96 Complex Method

Quality Gate Profile: Clean Code Collective
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between ca86e6e and 3cb42de.

Files selected for processing: 14
  • .env.example
  • cmd/alphone/compose.go
  • cmd/alphone/mail.go
  • cmd/alphone/mailbuild_test.go
  • cmd/alphone/mailconfig_test.go
  • cmd/alphone/mailwiring_seam_test.go
  • cmd/alphone/mailwiring_test.go
  • cmd/alphone/publicurl_test.go
  • cmd/alphone/run.go
  • docs/src/content/docs/self-hosting/configuration.md
  • docs/src/content/docs/self-hosting/updates-and-backups.md
  • internal/graphres/graphres.go
  • sdk/sdk.go
  • test/features/features/operator-commands.feature

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Walkthrough

The application now loads and validates ALPHONE_PUBLIC_URL independently of SMTP configuration. It passes the configured URL to plugins and mail construction, and uses it for invitation links. Configuration guidance and tests cover behavior with and without a mail relay.

Changes: Public URL configuration and use

Layer / File(s) Summary
Load and validate the public URL
cmd/alphone/run.go, cmd/alphone/mailconfig_test.go, .env.example, docs/src/content/docs/self-hosting/configuration.md, docs/src/content/docs/self-hosting/updates-and-backups.md, internal/graphres/graphres.go, sdk/sdk.go, test/features/features/operator-commands.feature
ALPHONE_PUBLIC_URL is stored outside mail settings and parsed independently of SMTP configuration. A configured mail host still requires the URL. Tests and documentation cover URL validation and command behavior.
Pass the URL to application consumers
cmd/alphone/run.go, cmd/alphone/compose.go, cmd/alphone/mail.go, cmd/alphone/mailbuild_test.go, cmd/alphone/mailwiring_seam_test.go, cmd/alphone/mailwiring_test.go, cmd/alphone/publicurl_test.go
The resolved URL is passed to plugins and mail construction. SMTP HELO uses the URL, and invitation tests check relative links when unset and absolute links when configured.

Priority: Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant Environment
  participant loadPublicURL
  participant composeSettings
  participant graphResolver
  participant Plugin
  Environment->>loadPublicURL: ALPHONE_PUBLIC_URL
  loadPublicURL->>composeSettings: parsed public URL
  composeSettings->>graphResolver: publicURL
  graphResolver->>Plugin: PublicURL dependency
Loading

Possibly related issues

Suggested reviewers: codescene-access

Merge Risk: Minimal · up to 3cb42

No material issue identified prevents merging after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 39.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 28 functions across 10 files. (4 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: passing the public address to plugins and invitation links when no mail relay is configured.
Linked Issues check Passed Issue #288 is the only directly linked, active issue. Its coding requirements are met at the reviewed head (3cb42de).

1. Read and validate ALPHONE_PUBLIC_URL without a mail relay [#288]: cmd/alphone/…
Out of Scope Changes check Passed The changes map to #288 or support it. I found no unrelated change.

- run.go, compose.go, mail.go, mailbuild_test.go, mailconfig_test.go, mailwiring_seam_test.go: move the setting out of mailSettings…
Full details: Linked Issues check

Explanation

Issue #288 is the only directly linked, active issue. Its coding requirements are met at the reviewed head (3cb42de).

  1. Read and validate ALPHONE_PUBLIC_URL without a mail relay [#288]: cmd/alphone/run.go adds loadPublicURL(env, mail). It calls gonsole.Parse(env, "PUBLIC_URL", "", parsePublicURL) on every load, whether or not SMTP_HOST is set. loadComposeSettings calls it and stores the result in composeSettings.publicURL. The same validator is used in all cases.
  2. Hand the value to plugins without a relay [#288]: cmd/alphone/compose.go sets sdk.Deps.PublicURL from cfg.publicURL, not cfg.mail.publicURL. The value no longer depends on the relay.
  3. Relay still requires the setting [#288]: loadPublicURL returns an error when mail.host != "" and the URL is empty. The error names PUBLIC_URL and SMTP_HOST.
  4. Invitation link carries the full address [#288]: cmd/alphone/run.go sets graphres PublicURL from settings.publicURL. internal/graphres/invite.go deliverInvite builds link with mail.ActivationLink(m.root.PublicURL, token). When Mailer is nil, the link is returned with delivered:false. The link is absolute when the URL is set. The no-relay invitation tests in cmd/alphone/mailwiring_test.go cover this case.
  5. Configuration docs list the setting with the general settings [#288]: The docs changes are described in the AI summary of docs/src/content/docs/self-hosting/configuration.md. I did not read that file directly, so this point rests on the summary.

Tests: the summary lists new or updated tests in cmd/alphone/publicurl_test.go, mailconfig_test.go, mailwiring_test.go and the operator-commands feature file. I did not run them. No test results are reported in the PR.

Full details: Out of Scope Changes check

Explanation

The changes map to #288 or support it. I found no unrelated change.

  • run.go, compose.go, mail.go, mailbuild_test.go, mailconfig_test.go, mailwiring_seam_test.go: move the setting out of mailSettings into the composed settings. The HELO value now comes from the same URL. This follows the move and keeps behavior for relay installs.
  • run.go loadComposeSettings: the malformed-value refusal reaches serve, account commands, migrate, seed -yes and account:create-admin. These commands read the same composed settings. The refusal follows from the requirement that AlphOne validate the setting independently of the relay (#288). The PR description states this behavior.
  • publicurl_test.go, operator-commands.feature: tests for the new behavior, including the account-role refusal path. They support the validation change.
  • graphres.go, sdk.go: comment updates that match the new meaning of PublicURL.
  • .env.example, configuration.md, updates-and-backups.md: documentation for the setting and the upgrade effect. Issue #288 asks for this listing.

The refusal scope for migrate and seed is a design choice beyond the issue's literal text. It is connected to validation with the same checks and is stated in the PR description, so I did not mark it out of scope.

Full details: Docstring Coverage

Explanation

Docstring coverage is 39.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 28 functions across 10 files. (4 skipped: 4 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@gitar-bot

gitar-bot Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Passing ALPHONE_PUBLIC_URL to plugins and invitation links without a relay changes redirect destinations; a stale value could send users to the wrong host.

Reads ALPHONE_PUBLIC_URL on every start and hands it to plugins and invitation links whether or not a mail relay is configured, so plugins that redirect users to external sign-in can bring them back without SMTP. A malformed value now fails fast with a named error on installs without a relay. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@codecov

codecov Bot commented Oct 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@greptile-apps

greptile-apps Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The reviewed changes are safe to merge, with no actionable issues identified.

Summary

Makes ALPHONE_PUBLIC_URL available to plugins and invitation links without requiring a mail relay, while keeping the address required when a relay is configured. Adds coverage for links and malformed settings without a relay, and updates configuration and upgrade guidance.

Targeted execution passed for plugin address handoff, invitation links with and without a relay, relay-backed invitation activation, malformed-address rejection, and selected database-backed operator scenarios. All six selected operator scenarios passed their 37 steps. Password resets still return before creating a token or sending mail when no mailer is configured.

No actionable issues found. Safe to merge based on the reviewed changes and targeted checks. The full testing toolchain was not run.

  • Plugins get AlphOne’s public address even when no mail relay is set.
  • Hand-delivered invitation links start with the public address when it is set.

Reviews (1) · Last reviewed commit: "docs(self-hosting): list ALPHONE_PUBLIC_..." · Reviewed by Greptile

@SirLouen
SirLouen merged commit ef7c567 into main Oct 25, 2026
18 checks passed
@SirLouen
SirLouen deleted the fix/288 branch October 25, 2026 12:26
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.

Plugins get no public address on an install without a mail relay

1 participant