Skip to content

[ai] settings: Rename ROOT_DOMAIN_URI to ROOT_DOMAIN_URL. - #40517

Open
Aditya-XR wants to merge 1 commit into
zulip:mainfrom
Aditya-XR:rename-root-domain-uri
Open

Aditya-XR wants to merge 1 commit into
zulip:mainfrom
Aditya-XR:rename-root-domain-uri

Conversation

@Aditya-XR

Copy link
Copy Markdown
Collaborator

Next step for #23380 after #40191, but it doesn't depend on it. Unlike the avatar/logo settings there, ROOT_DOMAIN_URI is always computed in computed_settings.py from EXTERNAL_URI_SCHEME and EXTERNAL_HOST, so a value in /etc/zulip/settings.py was never used and admins don't need the old name kept.

The one place that reads it by name is puppet/zulip/manifests/camo.pp, for the go-camo User-Agent. In upgrade-zulip-stage-3, zulip-puppet-apply runs from the new deployment before restart-server switches the current symlink, so get_django_setting_slow still asks the old deployment. With only the new name, the lookup fails and the User-Agent says https://zulip.com until Puppet is next applied. So the manifest tries ROOT_DOMAIN_URL first, then ROOT_DOMAIN_URI, marked TODO/compatibility. (My plan on the issue said this one wouldn't need a fallback. That's still true for admins, but not for Puppet.)

Fixes: part of #23380.

How changes were tested:

  • ./tools/lint on the changed files (includes mypy, puppet parser validate and puppet-lint).
  • ./tools/test-backend for test_home, test_email_log, test_create_video_call, test_link_embed, test_signup, test_auth_backends, test_docs and test_realm.
  • ./scripts/get-django-setting ROOT_DOMAIN_URL prints the URL in the dev environment, and the old name now fails.
  • Ran the new pick(...) with puppet apply in a sandbox, using the real get_django_setting_slow against fake deployments: an old one that only has ROOT_DOMAIN_URI, a new one, a first install (only next/), and no /etc/zulip/settings.py. All gave the expected value. Without the fallback, the old-deployment case gave https://zulip.com.

Open question: pick() evaluates both lookups, so each Puppet run makes one extra get-django-setting call (~350ms) until the fallback is removed. I kept it for readability. I can switch to an if that only does the second lookup when the first one fails, if that's preferred.

Screenshots and screen captures:

None, no visual changes.

Self-review checklist
  • Self-reviewed the changes for clarity and maintainability
    (variable names, code reuse, readability, etc.).
  • Followed the AI use policy.

Communicate decisions, questions, and potential concerns.

  • Explains differences from previous plans (e.g., issue description).
  • Highlights technical choices and bugs encountered.
  • Calls out remaining decisions and concerns.
  • Automated tests verify logic where appropriate.

Individual commits are ready for review (see commit discipline).

  • Each commit is a coherent idea.
  • Commit message(s) explain reasoning and motivation for changes.

Completed manual review and testing of the following:

  • Visual appearance of the changes.
  • Responsiveness and internationalization.
  • Strings and tooltips.
  • End-to-end functionality of buttons, interactions and flows.
  • Corner cases, error conditions, and easily imagined bugs.

Zulip's naming convention is to use "URL" rather than "URI".

This setting is always computed from EXTERNAL_URI_SCHEME and
EXTERNAL_HOST, and overrides any value in /etc/zulip/settings.py,
so the old name needs no fallback for server administrators.

The camo Puppet manifest does read it by name. During an upgrade,
Puppet runs before the "current" deployment is switched to the new
code, so asking only for the new name would fail there, and the
go-camo User-Agent would fall back to https://zulip.com. The
manifest now tries the new name first, then the old one.

Fixes part of zulip#23380.
Copilot AI balanced review requested due to automatic review settings October 28, 2026 21:17

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants