Fix remaining base_url usages that should use frontend_url #105

Closed
opened 2026-03-18 20:58:14 +00:00 by forgejo_admin · 3 comments

Type

Bug

Lineage

plan-wkq → Phase 11 → Discovered scope from PR #104 QA review

Repo

forgejo_admin/basketball-api

What Broke

Email links in registration confirmation (email.py line 83) and tryouts page (tryouts.py line 795) use settings.base_url (the API host) for user-facing URLs. Parents clicking these links land on the API server instead of the frontend app.

Repro Steps

  1. Register a new player and receive the confirmation email
  2. Click the "Complete Registration" link in the email
  3. Observe the URL points to basketball-api.tail5b443a.ts.net instead of westsidekingsandqueens.tail5b443a.ts.net

Expected Behavior

All user-facing links in emails should use settings.frontend_url (westsidekingsandqueens.tail5b443a.ts.net), not settings.base_url (the API host).

Environment

Production — basketball-api on k8s cluster

File Targets

  • src/basketball_api/services/email.py — line 83: reg_url uses settings.base_url
  • src/basketball_api/routes/tryouts.py — line 795: reg_url uses settings.base_url

Note: tryouts.py:509 (photo_url) is intentionally base_url — that's a MinIO photo URL served by the API, not a user-facing link. Out of scope.

Acceptance Criteria

  • All user-facing URLs in emails use settings.frontend_url
  • API-internal URLs (webhooks, callbacks) still use settings.base_url

Test Expectations

  • Existing tests still pass
  • Run command: pytest tests/

Constraints

  • Only change URLs that are user-facing (rendered in emails or returned to browsers)
  • Do not change Stripe callback URLs or internal API references

Checklist

  • PR opened
  • Tests pass
  • PR #104 — introduced frontend_url config
### Type Bug ### Lineage `plan-wkq` → Phase 11 → Discovered scope from PR #104 QA review ### Repo `forgejo_admin/basketball-api` ### What Broke Email links in registration confirmation (`email.py` line 83) and tryouts page (`tryouts.py` line 795) use `settings.base_url` (the API host) for user-facing URLs. Parents clicking these links land on the API server instead of the frontend app. ### Repro Steps 1. Register a new player and receive the confirmation email 2. Click the "Complete Registration" link in the email 3. Observe the URL points to `basketball-api.tail5b443a.ts.net` instead of `westsidekingsandqueens.tail5b443a.ts.net` ### Expected Behavior All user-facing links in emails should use `settings.frontend_url` (`westsidekingsandqueens.tail5b443a.ts.net`), not `settings.base_url` (the API host). ### Environment Production — basketball-api on k8s cluster ### File Targets - `src/basketball_api/services/email.py` — line 83: `reg_url` uses `settings.base_url` - `src/basketball_api/routes/tryouts.py` — line 795: `reg_url` uses `settings.base_url` **Note:** `tryouts.py:509` (`photo_url`) is intentionally `base_url` — that's a MinIO photo URL served by the API, not a user-facing link. Out of scope. ### Acceptance Criteria - [ ] All user-facing URLs in emails use `settings.frontend_url` - [ ] API-internal URLs (webhooks, callbacks) still use `settings.base_url` ### Test Expectations - [ ] Existing tests still pass - Run command: `pytest tests/` ### Constraints - Only change URLs that are user-facing (rendered in emails or returned to browsers) - Do not change Stripe callback URLs or internal API references ### Checklist - [ ] PR opened - [ ] Tests pass ### Related - PR #104 — introduced `frontend_url` config
Author
Owner

Scope Review: NEEDS_REFINEMENT

Review note: review-206-2026-03-27

File target inaccuracies found — 2 of 3 targets are correct, 1 is wrong:

  • email.py line 56 is wrong — the actual base_url usage is at line 83 (reg_url in send_confirmation_email). Line 56 is blank.
  • tryouts.py:509 should NOT be changedphoto_url points to an API-hosted resource (player photos). Changing to frontend_url would break photo loading. Remove from scope.
  • tryouts.py:795 is correctreg_url in roster "Copy Link" button is user-facing and needs frontend_url.

Additional findings:

  • Full base_url audit shows 5 usages total. The other 2 (admin.py:203 coach invite, coach_onboarding.py:112 Stripe callbacks) correctly use base_url.
  • Missing story:WS-S17 label on board item.
  • Scope is small enough for single-agent pass once corrections are made.
## Scope Review: NEEDS_REFINEMENT Review note: `review-206-2026-03-27` File target inaccuracies found — 2 of 3 targets are correct, 1 is wrong: - **email.py line 56 is wrong** — the actual `base_url` usage is at **line 83** (`reg_url` in `send_confirmation_email`). Line 56 is blank. - **tryouts.py:509 should NOT be changed** — `photo_url` points to an API-hosted resource (player photos). Changing to `frontend_url` would break photo loading. Remove from scope. - **tryouts.py:795 is correct** — `reg_url` in roster "Copy Link" button is user-facing and needs `frontend_url`. Additional findings: - Full `base_url` audit shows 5 usages total. The other 2 (admin.py:203 coach invite, coach_onboarding.py:112 Stripe callbacks) correctly use `base_url`. - Missing `story:WS-S17` label on board item. - Scope is small enough for single-agent pass once corrections are made.
Author
Owner

Scope Review: NEEDS_REFINEMENT

Review note: review-206-2026-03-27

Well-structured bug report. File targets verified but have issues:

  • Line number drift: email.py target says "line 56" but actual base_url usage is at line 83. Update file target.
  • photo_url should stay base_url: tryouts.py line 509 builds photo_url -- photos are served by the API (MinIO proxy), not the frontend. This line should be removed from scope. Only tryouts.py:795 (reg_url) needs the fix.
  • Board labels missing: Add arch: and story: labels to the board item for traceability.

Actual scope: 2 lines changed across 2 files. Single-agent, no decomposition needed.

## Scope Review: NEEDS_REFINEMENT Review note: `review-206-2026-03-27` Well-structured bug report. File targets verified but have issues: - **Line number drift:** email.py target says "line 56" but actual `base_url` usage is at **line 83**. Update file target. - **photo_url should stay base_url:** tryouts.py line 509 builds `photo_url` -- photos are served by the API (MinIO proxy), not the frontend. This line should be **removed from scope**. Only tryouts.py:795 (reg_url) needs the fix. - **Board labels missing:** Add arch: and story: labels to the board item for traceability. Actual scope: 2 lines changed across 2 files. Single-agent, no decomposition needed.
Author
Owner

Issue body updated per scope review corrections.

Issue body updated per scope review corrections.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
forgejo_admin/basketball-api#105
No description provided.