Skip to content

[FEATURE] [MER-4943] Enable/Disable DOT on an Adaptive Page Level#6260

Merged
nicocirio merged 11 commits intomasterfrom
MER-4943/adaptive-pages/enable-dot-on-page
Mar 13, 2026
Merged

[FEATURE] [MER-4943] Enable/Disable DOT on an Adaptive Page Level#6260
nicocirio merged 11 commits intomasterfrom
MER-4943/adaptive-pages/enable-dot-on-page

Conversation

@manelli
Copy link
Collaborator

@manelli manelli commented Mar 2, 2026

Add page-level DOT control for both adaptive pages

  • Added ai_enabled to:

    • revisions
    • section_resources
  • Added migration with graded-based backfill defaults:

    • scored (graded=true) -> ai_enabled=false
    • practice (graded=false) -> ai_enabled=true
  • Section resource creation/update/migration paths now copy and keep ai_enabled in sync with pinned revisions (major/minor update paths included).

  • Added page option checkbox: Enable AI Assistant (DOT) in Page Options modal.

  • Added adaptive lesson panel toggle (under appearance settings) for DOT enablement.


How To Create A DOT Adaptive Page

  1. Enable section assistant (as admin)

    • Go to /sections/<section_slug>/manage
    • Turn on Enable AI Assistant
  2. Create adaptive page

    • In authoring, create an Adaptive Page
  3. Enable page DOT + Navigation

    • Open adaptive page editor
    • Right panel -> Lesson
    • Turn on:
      • Enable AI Assistant (DOT)
      • Display Torus Navigation (required for DOT UI visibility right now)
  4. Publish + update section

    • Publish project changes
    • Apply/update section to latest publication
  5. Verify

    • Open /sections/<section_slug>/adaptive_lesson/<page_slug>
    • DOT should be visible if both section and page toggles are enabled.
Screen.Recording.2026-03-06.at.13.01.19.mov

See: https://eliterate.atlassian.net/browse/MER-4943

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

Warnings
⚠️ PR is large (1108 LOC changed). Consider splitting.

Risk score: 19 → risk/high

Generated by 🚫 dangerJS against e03c956

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

AI Review — performance

No issues found

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

AI Review — security

No issues found

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

AI Review — elixir

Non-exhaustive scored matching can crash on unexpected input

file: lib/oli/authoring/editing/container_editor.ex
line: 177
Description: The new case scored do only handles "Scored" and "Unscored". If scored is missing or any other value, this raises CaseClauseError and can break page/container creation flows.
Suggestion: Make the match exhaustive (for example, match on {type, scored} with a final _ fallback) and default to a safe value instead of raising.

Fallback logic misclassifies string/number graded values

file: lib/oli/delivery/sections.ex
line: 6121
Description: page_ai_enabled?/1 normalizes ai_enabled but not graded. When graded is "false" (string), Elixir treats it as truthy, so !graded becomes false, incorrectly disabling assistant fallback behavior.
Suggestion: Normalize graded to a boolean in the same way as ai_enabled (true/false, "true"/"false", 1/0) before applying !graded.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

AI Review — typescript

No issues found

@github-actions
Copy link
Contributor

github-actions bot commented Mar 2, 2026

AI Review — ui

Helper text is not programmatically associated with the checkbox

file: lib/oli_web/live/curriculum/entries/options_modal.ex
line: 374
Description: The explanatory <small id="ai_enabled_description"> text is rendered, but the checkbox input is not linked to it, so screen readers may not announce the guidance when the control receives focus.
Suggestion: Associate the description with the checkbox by passing aria-describedby="ai_enabled_description" (or the component’s equivalent help-text prop) on the <.input>.

Hard-coded label text is not localized in authoring schema

file: assets/src/apps/authoring/components/PropertyEditor/schemas/lesson.ts
line: 68
Description: The new UI label string (Enable AI Assistant (DOT)) is hard-coded, which breaks i18n/l10n expectations and can create inconsistent translations across authoring surfaces.
Suggestion: Replace the literal title with a localization key/translation lookup used by the rest of the authoring UI.

Hard-coded modal copy is not localized

file: lib/oli_web/live/curriculum/entries/options_modal.ex
line: 377
Description: The new checkbox label/help copy is hard-coded English text, which prevents localization and can diverge from translated UI terminology.
Suggestion: Move both the label and description text to localization resources and render via the project’s translation helpers.

@manelli manelli marked this pull request as ready for review March 6, 2026 17:23
@nicocirio
Copy link
Contributor

AI Review — performance

Unnecessary page-context lookup when assistant is disabled at section level

file: lib/oli_web/live/dialogue/window_live.ex line: 145 Description: page_ai_context/3 is executed before checking Sections.assistant_enabled?(section), so every mount does SectionResourceDepot.get_section_resource/2 and parsing work even when section-level assistant is off. This adds avoidable per-request overhead on a hot LiveView path. Suggestion: Short-circuit on section-level flag first (for example, branch before calling page_ai_context/3), and only compute page context when Sections.assistant_enabled?(section) is true.

Duplicate assistant eligibility computation in the same render

file: lib/oli_web/components/layouts/student_delivery_lesson.html.heex line: 136 Description: Oli.Delivery.Sections.assistant_enabled_for_page?/2 is called in both the layout class expression and again for conditional rendering, repeating the same checks during a single render cycle. Suggestion: Compute the predicate once (for example, assign a local like assistant_available?) and reuse it in both places to avoid redundant work.

I think we could consider these 2 AI suggestions, especially the first one

@github-actions
Copy link
Contributor

PrivSignal Report

Unable to load tmp/privsignal/ci.report.json for this run.

Detail Value
Score output ERROR
Base ref used n/a
Scan exit 1
Diff exit 1
Score exit 1
Lockfile changed false

Copy link
Contributor

@nicocirio nicocirio left a comment

Choose a reason for hiding this comment

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

🚀

@nicocirio nicocirio merged commit 1c945db into master Mar 13, 2026
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants