Skip to content

Use Conference.hostname in .ics export instead of hardcoded host#4663

Merged
marcoacierno merged 1 commit into
mainfrom
ics-export-use-hostname
Jun 1, 2026
Merged

Use Conference.hostname in .ics export instead of hardcoded host#4663
marcoacierno merged 1 commit into
mainfrom
ics-export-use-hostname

Conversation

@marcoacierno
Copy link
Copy Markdown
Member

Summary

The favourites-calendar .ics export hardcoded https://2026.pycon.it in two places — the event description Info: line and the URL property. This builds the URL from the per-conference hostname field (added in #4662) so the link is correct for any conference.

Changes

  • backend/schedule/views.py — build event_url once from conference.hostname, reuse for the description and the url property.
  • backend/schedule/tests/test_views.py — pin ConferenceFactory(hostname="2026.pycon.it") and assert both URLs via conference.hostname (factory default hostname is conference{n}.example.com), so the test would fail if the host were re-hardcoded.

Verification

  • schedule/tests/test_views.py — 4 passed
  • ruff check clean
  • No 2026.pycon.it literal left in views.py

🤖 Generated with Claude Code

The favourites-calendar .ics export hardcoded https://2026.pycon.it for
the event description Info line and the URL property. Build the URL from
the per-conference hostname field (added in #4662) so the link is correct
for any conference.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 1, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pycon Error Error Jun 1, 2026 4:18pm

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Jun 1, 2026

This PR replaces two hardcoded https://2026.pycon.it strings in backend/schedule/views.py with a dynamic conference.hostname-based URL, and updates the corresponding test.

Issues

1. Silent malformed URL when hostname is blank (High)

Conference.hostname is blank=True, default="". Any conference without a hostname will silently produce https:///event/<slug>/ — a malformed URL placed in both the description and url iCalendar fields. No guard, no raise, no fallback.

2. url iCalendar property not tested (Medium)

backend/schedule/tests/test_views.py asserts the description field but never checks event.get("url"). The PR description mentions reusing event_url for the url property as a motivation, but that property has zero test coverage. Hardcoding that line would not break any test.

3. https scheme still hardcoded (Low)

The rest of the codebase uses settings.FRONTEND_URL for frontend-relative URLs (e.g., grants/tasks.py, schedule/tasks.py, api/submissions/mutations.py), which includes the scheme. Constructing the URL as f"https://{conference.hostname}/..." deviates from that convention and breaks on http-only dev/staging environments.

4. Pinned hostname weakens the regression test (Low)

backend/schedule/tests/test_views.py:23 pins hostname="2026.pycon.it". A regression where the view uses a different hardcoded host (e.g., 2025.pycon.it) would still pass because the assertion resolves conference.hostname to whatever string was passed to the factory. Using an obviously synthetic hostname (e.g., the factory default) would guarantee no accidental match with any future hardcoded value.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.52%. Comparing base (c4fa598) to head (3fe409a).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4663   +/-   ##
=======================================
  Coverage   92.52%   92.52%           
=======================================
  Files         359      359           
  Lines       10799    10800    +1     
  Branches      821      821           
=======================================
+ Hits         9992     9993    +1     
  Misses        696      696           
  Partials      111      111           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@marcoacierno marcoacierno disabled auto-merge June 1, 2026 16:25
@marcoacierno marcoacierno merged commit 0ff7947 into main Jun 1, 2026
7 of 8 checks passed
@marcoacierno marcoacierno deleted the ics-export-use-hostname branch June 1, 2026 16:25
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