Skip to content

Mixed per-document doenetmlVersions in one assignment load multiple distinct 29 MB standalone bundles — warn or normalize #39

Closed

Description

@dqnykamp

Problem

Each document in an assignment carries its own version (singleDocState.ts:22), passed per-item as doenetmlVersion={source.version} (SingleDocActivity.tsx:161). In @doenet/doenetml-iframe this selects the CDN bundle per iframe (https://cdn.jsdelivr.net/npm/@doenet/standalone@<version>/doenet-standalone.js, with autodetect-from-source also possible). An assignment mixing versions therefore downloads and parses several distinct ~29 MB standalone bundles — each version is a separate CDN cache entry and a separate parse per iframe.

Note createSourceHash deliberately strips version before hashing (activityState.ts:762-779), so saved state already survives a version change.

Proposed change

  • At minimum, detect mixed versions in one assignment and emit a console warning naming the versions involved.
  • Preferably, offer a normalization option (assignment-level version override, defaulting to the newest compatible version present) so one bundle serves the whole assignment. Since state hashing ignores version, normalization does not invalidate student state; the risk to evaluate is behavioral differences between DoenetML versions for older documents.

Impact

Prevents the worst-case bundle multiplication on heterogeneous assignments; keeps memory/parse costs at one bundle per page rather than one per version.

🤖 Generated with Claude Code

Activity

  1. dqnykamp commented on Jul 13, 2026

    @dqnykamp
    MemberAuthor

    Implemented by #43 (merged in a4a5853).

    The PR reports mixed per-document DoenetML versions to the containing page through a new typed reportWarningsCallback prop (ActivityViewerWarning[], first member { type: "mixedDoenetmlVersions", versions: string[] }), reported once per distinct source analysis; a console.warn is still emitted for developers, and the README documents the bundle-multiplication cost and the normalization path.

    As discussed here, automatic version normalization was a deliberate non-choice — rendering older documents under a newer version can change their behavior, so it stays the consumer's explicit decision (normalize version in the source; saved student state survives because its hash already ignores version). The "at minimum, warn" bar is met and the "preferably normalize" option was consciously left to the consumer, so this is resolved.

    Closing manually: #43's description used "Implements #39" rather than a closing keyword, so GitHub didn't auto-close it on merge.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    Priority

    None yet

    Effort

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions