Add explicit overwrite for challenge transfers - #1118
Conversation
## Problem Removing a module can leave its physical challenge rows behind. When the same module and challenge IDs are later used as transfer destinations, the loader reuses those stale rows and leaves the source challenge IDs and solves in place. Always bypassing an existing destination would change established transfer behavior and could replace the wrong challenge unexpectedly. ## Summary - add an optional `overwrite` flag to challenge transfers - keep destination reuse as the default behavior - resolve overwritten sources through their exact dojo associations - preserve ownership checks for imported and shared challenges ## Testing - create and remove a destination challenge to leave a stale row - verify the default transfer reuses the stale destination - verify `overwrite: true` preserves the source challenge ID - verify the overwritten transfer remains stable on replay - verify Python syntax and whitespace checks
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 55a067b998
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if destination_challenge and not (transfer and transfer["overwrite"]): | ||
| return destination_challenge |
There was a problem hiding this comment.
Honor overwrite when the destination is still present
When an update renames old into new while new is still part of the current dojo, the earlier existing_challenges guard returns the existing new challenge before this overwrite check is reached, so transfer: {challenge: "old", overwrite: true} silently keeps the destination challenge and drops the source challenge_id/solves. This only works after a separate update first removes the destination, as in the new regression; direct overwrites of active destinations should bypass existing_challenges too.
Useful? React with 👍 / 👎.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Problem
Removing a module can leave its physical challenge rows behind. When the same module and challenge IDs are later used as transfer destinations, the loader reuses those stale rows and leaves the source challenge IDs and solves in place.
Always bypassing an existing destination would change established transfer behavior and could replace the wrong challenge unexpectedly.
Summary
overwriteflag to challenge transfersTesting
overwrite: truepreserves the source challenge ID