Skip to content

[QTI] A QTI item containing an XML comment fails the channel publish #6229

Description

@rtibblesbot

❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.

Target branch: unstable

Observed behavior

  • A native qti item whose XML contains a comment passes validate_qti_item.
  • is_perseus_derivable then raises ValueError on it. _node_is_perseus_derivable calls it from publish.py with no try.
  • _local in utils/assessment/qti/perseus_derive.py passes every node from .iter() to etree.QName, and a comment node has no tag name.
  • derive_perseus_item raises the same error through _interaction_elements.

Errors and logs

>>> xml = VALID_CHOICE_ITEM.replace("<qti-item-body>", "<qti-item-body><!-- note -->", 1)
>>> validate_qti_item(xml.encode()).is_valid
True
>>> is_perseus_derivable(xml)
ValueError: Invalid input tag of type <class '_cython_3_2_4.cython_function_or_method'>

User-facing consequences

A single item uploaded through ricecooker or written through the sync API, with a comment anywhere in its XML, blocks publishing the whole channel.

Steps to reproduce

  1. Store VALID_CHOICE_ITEM (tests/utils/qti/test_validation.py) with <!-- note --> inserted after <qti-item-body> as the raw_data of a qti AssessmentItem on an exercise.
  2. Publish the channel.

Acceptance Criteria

  • An exercise whose only item is a derivable choice item containing XML comments publishes both the QTI package and the derived Perseus archive.
  • Comments and processing instructions in an item change neither the derivability result nor the derived Perseus content.
  • A test publishes a commented item and checks both archives.

AI usage

I used Claude Code to review the #6189 branch. It reproduced this on upstream/unstable with is_perseus_derivable and a generator-level publish, and drafted this issue. The step from there to the channel publish failing comes from reading publish.py.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions