Skip to content

Reject invalid initial XML uploads by default - #1863

Open
adamant-pwn wants to merge 9 commits into
maths:devfrom
adamant-pwn:codex/stop-invalid-xml-imports
Open

adamant-pwn wants to merge 9 commits into
maths:devfrom
adamant-pwn:codex/stop-invalid-xml-imports

Conversation

@adamant-pwn

@adamant-pwn adamant-pwn commented Sep 9, 2026

Copy link
Copy Markdown

STACK XML parsing can retain invalid authoring content with diagnostics. Count these failures in Moodle's import error total so the normal Stop on error policy rejects an initial upload before writing questions, including mixed valid/invalid batches.

Disabling Stop on error explicitly permits repairable broken questions with diagnostics. Structurally unreadable questions remain rejected. Moodle's Draft/Ready status stays independent of STACK's broken flag; this PR does not change version status.

Merged current dev and resolved the conflicts. The Behat test retains the generic expand-all-fieldsets step, and the release note is in the development track.

Validation on Moodle 5.0.10, PHP 8.3.33, PostgreSQL 17.11 and Maxima 5.45.1 (ECL): 12 focused tests / 132 assertions passed (six initial-upload policy cases and six XML-import regressions). PHP syntax and diff checks passed. PHPUnit reported deprecations. Browser/Behat flows and the wider CI matrix have not been run locally.

@sangwinc
sangwinc requested a review from EJMFarrow September 11, 2026 08:48
@sangwinc

Copy link
Copy Markdown
Member

@EJMFarrow could you review this please?

@EJMFarrow
EJMFarrow changed the base branch from master to dev September 11, 2026 10:04

@EJMFarrow EJMFarrow left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks, @adamant-pwn . Looks great! I've switched the PR to target dev which is our normal workflow. This has caused some merge conflicts. The behaviour to update Moodle status also needs removed and the tests updated, please.

(@sangwinc I can't think of a situation where this import behaviour change is going to cause us a problem but worth you having a think too. Course restore doesn't use this process as far as I can tell so I think we're safe there.)

Comment thread tests/behat/create_prt_node.feature
Comment thread questiontype.php Outdated
Comment thread CHANGES.md Outdated
@adamant-pwn

Copy link
Copy Markdown
Author

Thanks, @EJMFarrow! I’ve merged dev, resolved the conflicts, and removed the automatic Moodle status change. The updated tests and release note preserve the separation from STACK’s broken flag.

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.

3 participants