Skip to content

Add explicit overwrite for challenge transfers - #1118

Open
fluffy-flufff wants to merge 1 commit into
pwncollege:masterfrom
fluffy-flufff:feat/challenge-transfer-overwrite
Open

Add explicit overwrite for challenge transfers#1118
fluffy-flufff wants to merge 1 commit into
pwncollege:masterfrom
fluffy-flufff:feat/challenge-transfer-overwrite

Conversation

@fluffy-flufff

Copy link
Copy Markdown
Contributor

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

  • add a regression that creates and removes 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

## 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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread dojo_plugin/utils/dojo.py
Comment on lines +389 to +390
if destination_challenge and not (transfer and transfer["overwrite"]):
return destination_challenge

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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