Skip to content

Fix interim edit clobbering Meetecho remote_instructions (#10689)#2

Open
ekr-aibot wants to merge 2 commits intomainfrom
fix-10689-meetecho-clobber
Open

Fix interim edit clobbering Meetecho remote_instructions (#10689)#2
ekr-aibot wants to merge 2 commits intomainfrom
fix-10689-meetecho-clobber

Conversation

@ekr-aibot
Copy link
Copy Markdown
Owner

Summary

  • Stop blanking remote_instructions on edit. InterimSessionModelForm.clean() no longer wipes the stored Meetecho URL whenever remote_participation=='meetecho'. The helper layer decides whether to overwrite, and only does so on successful Meetecho creation — so a failed API call now leaves the existing URL intact instead of destroying it.
  • Only recreate Meetecho conferences when scheduling actually changed. sessions_post_save now filters to sessions whose date / time / requested_duration / end_time changed. Editing the agenda on a Meetecho-backed interim leaves the existing conference alone.
  • Delete the old conference on a successful recreate. Previously any re-create would orphan the prior Meetecho conference. Now it is fetched and deleted after the replacement is in place. Failures in the cleanup are logged but do not undo the successful recreate.

Bug

Reported in ietf-tools#10689. WG chair edited an interim's agenda; the Meetecho API call in sessions_post_save failed; the session's remote_instructions URL ended up empty in the database. The secretariat had to delete and recreate the session to recover, losing uploaded slides in the process.

Root cause: clean() was blanking remote_instructions in memory on every submit with remote_participation=='meetecho', then ModelForm.save() persisted the empty value, then create_interim_session_conferences failed before it could write a replacement. That blanking was fine for the create flow (no URL to lose) but fatal on edit.

Test plan

  • New regression test test_edit_preserves_existing_meetecho_remote_instructions in tests_forms.py — exercises clean() directly; fails on main with AssertionError: '' != 'https://meetings.conf.meetecho.com/...', passes with this change.
  • New tests_helpers.py tests:
    • test_create_interim_session_conferences_preserves_url_on_failure — both exception and empty-result paths preserve the URL.
    • test_create_interim_session_conferences_deletes_previous_conference — old conference is fetched and deleted on successful recreate.
    • test_sessions_post_save_skips_meetecho_when_only_agenda_changed — helper gets an empty list.
    • test_sessions_post_save_recreates_meetecho_when_timing_changed — all four timing fields trigger recreate.
    • test_sessions_post_save_creates_meetecho_when_no_existing_url — always create when no existing Meetecho URL.
  • Full ietf.meeting test suite (384 tests) passes locally against settings_test.
  • Manual reproduction in a local dev container with a doomed MEETECHO_API_CONFIG (127.0.0.1:9) confirmed the original buggy behavior on main and confirmed the fix prevents it.

Known limitations

The "is this a Meetecho URL" check uses a substring match on "meetecho" in both the form __init__ and the post-save filter. A dedicated flag on Session would be cleaner but needs a migration and is out of scope for this bugfix.

There is a separate pre-existing oddity in sessions_post_save where the create_interim_session_conferences call is made inside the for form in forms loop, so for formsets with N>1 forms the helper runs N times. Not introduced or worsened by this change; worth a follow-up.

🤖 Generated with Claude Code

ekr-aibot and others added 2 commits April 11, 2026 15:57
…10689)

Editing an interim meeting backed by an auto-created Meetecho conference
used to lose the Remote instructions URL whenever the subsequent Meetecho
API call failed (and silently orphan the old conference when it succeeded).
The WG chair was left with an interim that pointed nowhere and had to
escalate to the secretariat to manually recover — losing uploaded slides
in the process.

Root cause: `InterimSessionModelForm.clean()` unconditionally blanked
`remote_instructions` whenever the form was submitted with
`remote_participation=='meetecho'`, on the assumption that the post-save
helper would then fill in a fresh Meetecho URL. That assumption held for
the create flow but falls apart on edit: if the helper's API call to
Meetecho fails for any reason (network, auth, rate limit), the URL is
already gone from the in-memory form data *and* has been persisted by
`ModelForm.save()`, leaving nothing to fall back on.

Fixes:

- `forms.py`: stop blanking `remote_instructions` in `clean()`. The
  helper layer decides whether to overwrite the URL and only does so on
  successful Meetecho creation. Also initialize the `remote_participation`
  radio from the stored URL on edit so a no-op resubmit doesn't flip
  modes.

- `helpers.py`: only (re)create a Meetecho conference when one of the
  scheduling fields (`date`, `time`, `requested_duration`, `end_time`)
  actually changed. Merely editing the agenda now leaves the existing
  conference alone. On a successful recreate, the old conference is
  fetched and deleted so it is not orphaned on the Meetecho side.

- Tests in `tests_forms.py` and `tests_helpers.py` cover:
  - form-level: clean() preserves the URL across a Meetecho-mode edit;
  - helper-level: failure path (exception and empty result) preserves
    the URL; success path deletes the previous conference;
  - post-save filter: skip when only non-timing fields changed,
    recreate when any timing field changed, always create when no URL
    exists yet.

Note: the "is this a Meetecho URL" check currently uses a substring
match on "meetecho"; a dedicated flag on Session would be cleaner but
requires a migration and is out of scope for this bugfix.

Fixes ietf-tools#10689.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The best-effort delete of the replaced Meetecho conference catches any
exception from fetch/delete and logs it, to ensure a successful recreate
is never undone by a cleanup hiccup. Add a test that forces fetch() to
raise and asserts the new URL still lands, delete_conference is not
invoked, and nothing propagates out. Closes the remaining uncovered
lines flagged by codecov on ietf-tools#10703.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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