kolibri icon indicating copy to clipboard operation
kolibri copied to clipboard

[QTI] The string value NULL is read as a null value

Open rtibblesbot opened this issue 1 month ago • 3 comments

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

Target branch: develop

Observed behavior

The QTI viewer coerces the string NULL to null for every base type, including string:

QTI 3 has no NULL literal; qti-is-null (https://www.imsglobal.org/spec/qti/v3p0/info/#OpIsNull) treats only empty containers and empty strings as NULL.

User-facing consequences

  • A text entry question whose correct answer is NULL (e.g. a SQL question) has no correct response.
  • A learner who types NULL submits a null response.

Steps to reproduce

  1. Call coerceValueWithBaseType('NULL', 'string').
  2. It returns null.

Acceptance Criteria

  • [ ] coerceValueWithBaseType('NULL', 'string') returns 'NULL'.
  • [ ] A text entry item with correct response <qti-value>NULL</qti-value> scores a learner response of NULL as correct.
  • [ ] Null, undefined, and the empty-string rules in coerceValueWithBaseType are unchanged.

AI usage

Raised by AlexVelezLl in Studio PR #6285, where Studio dropped the same check. Claude Code drafted this issue from the Kolibri source.

rtibblesbot avatar Oct 06 '26 22:10 rtibblesbot

def coerce_value_with_base_type(value, base_type):

if value is None or value == "":
    return None

if base_type == "string":
    return str(value)  

# migilina baseTypes kosam...
if base_type in ("integer", "float", "boolean"):
    # ... existing logic
    pass

return value

class QTIVariable: def coerce_value(self, raw_value): # No special handling for "NULL" string return coerce_value_with_base_type(raw_value, self.base_type)

Venkatpasupuleti18 avatar Oct 08 '26 06:10 Venkatpasupuleti18

Hi! 👋

Thanks so much for your interest! This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues. If there are no unassigned 'help wanted' issues available, please wait until new ones are added.

We really appreciate your willingness to help. 😊

Are you preparing for Google Summer of Code? See our GSoC guidelines.

learning-equality-bot avatar Oct 08 '26 06:10 learning-equality-bot

Plan: NULL is an ordinary value in the QTI viewer, so a text entry item whose correct response is NULL scores a learner's NULL as correct.

  • [ ] Treat NULL as a value in both coercion guards
  • [ ] Self-review the produced code

Assumptions — the issue did not settle these; say so if one is wrong.

  • 'NULL' stops being null for every base type, not just string-like ones; if wrong, <qti-value>NULL</qti-value> on numeric/boolean declarations throws TypeError instead of yielding null.

Written by rtibblesbot, an LLM-based coding agent.

rtibblesbot avatar Oct 18 '26 13:10 rtibblesbot