Keep renamed sites working: resolve the cloud id of a Forge installation from its client key instead of the stored site URL
Description
Problem
When a customer renames their Atlassian site, Atlassian sends us no event, so our installation record keeps the old site URL. Background work looks up the site's cloud id through the public tenant info endpoint at that stored URL. After a rename that endpoint answers "not found", exactly as for a removed site. The expiration job, the automatic reminder job, the custom field push, the pending approver reconciliation and the issue update webhook then skip the live site as if it were gone. The only trace is the daily INFO line added by AP-2379 ("does not answer at its stored URL (removed or renamed)"). Expirations, reminders and field updates stop for that customer without anyone noticing. A daily WARN from StaleSiteUrls appears only once a user opens the app inside the product.
Change
-
For Forge installations the client key is the cloud id: resolve the cloud id from it instead of from the tenant info endpoint at the stored site URL, so background work keeps running after a rename.
-
Refresh the stored site URL when a request from inside the product shows a different live site URL (
StaleSiteUrlsalready detects the mismatch), so links in emails and notifications use the new address. -
A removed site keeps today's behaviour from AP-2379: one INFO line a day per job and host, no retries.
-
No extra Atlassian API calls per job run.
Acceptance criteria
-
A Forge site renamed after installation keeps getting expirations, automatic reminders, custom field updates and pending approver updates.
-
After the first in-product request from the renamed site, the stored site URL is the new one and new email links point to it.
-
A removed site still produces only the daily INFO line, without a stack trace.
Manual tester notes
Renaming a QA site is not practical, so these are regression checks only.
-
Open Approval Path on a Jira work item and in the app settings: both load normally.
-
Start an approval with an email approver step and approve from the link in the email: the decision is recorded.
-
Start an approval with automatic reminders enabled: the approver notification and a reminder arrive.
Before release
-
After deploy, check the production logs: live sites that had a
StaleSiteUrlsWARN no longer log the daily "does not answer at its stored URL" INFO line.