Skip to content

Normalise xsd:double text entry answers for Perseus derivation - #6259

Merged
rtibbles merged 1 commit into
learningequality:unstablefrom
rtibblesbot:issue-6224-b06411
Oct 5, 2026
Merged

rtibbles merged 1 commit into
learningequality:unstablefrom
rtibblesbot:issue-6224-b06411

Conversation

@rtibblesbot

@rtibblesbot rtibblesbot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Text entry answers like +5 and 1E3 are valid xsd:double but extract_value rejects them, so Perseus derivation emitted "answers": [].

  • _perseus_number strips a leading + and lowercases E when the result parses as a finite extract_value number.
  • _derive_text emits the normalised answer, or the original when none exists.
  • INF, NaN and overflow (1e400) have no normalised form.
  • +5% and +1/2 also normalise (to 5%, 1/2), since the check is extract_value, not xsd:double.
  • extract_value not widened, to avoid changing legacy input_question behaviour.

References

Fixes #6224. Related: #6103, #6150, #6222.

Reviewer guidance

AI usage

Implemented with Claude Code from a pre-approved plan. Verified with TDD and manual review of the generated code.

🤖 Generated with Claude Code

Deviations from the issue spec

Criterion Why not
Valid numeric answers (issue lists INF, NaN) derive a Perseus item Perseus numeric-input and extract_value have no representation for them

@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly

How was this generated?
  • Ran pre-flight CI checks (lint, format, tests) and verified all pass
  • Rebased onto the target branch and resolved any conflicts
  • Reorganized commit history into clean, logical commits
  • Audited the diff to ensure only issue-relevant files are changed
  • Built PR body from the repository's PR template with evidence blocks
@rtibblesbot

🟡 Waiting for feedback

Last updated: 2026-10-02 22:23 UTC

@rtibblesbot

Copy link
Copy Markdown
Contributor Author

Outside this PR's scope — tracked under #5998:


@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly

How was this generated?
  • Ran pre-flight CI checks (lint, format, tests) and verified all pass
  • Rebased onto the target branch and resolved any conflicts
  • Reorganized commit history into clean, logical commits
  • Audited the diff to ensure only issue-relevant files are changed
  • Built PR body from the repository's PR template with evidence blocks

`+5` and `1E3` are valid numeric answers that `extract_value` rejects; strip the sign and lowercase the exponent before deriving.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

@rtibbles rtibbles left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Clear test cases - simple normalization code fix.

@rtibbles
rtibbles merged commit 8ea19fb into learningequality:unstable Oct 5, 2026
13 checks passed
@rtibblesbot
rtibblesbot deleted the issue-6224-b06411 branch October 5, 2026 17:45
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.

Older-Kolibri Perseus export drops QTI Text entry items whose numeric answers are valid xsd:double but not parseable by extract_value

2 participants