Skip to content

refactor: share LMS fail-loud error across selectors, cache JS parses#93

Merged
redmodd merged 2 commits into
mainfrom
refactor/dedupe-adapter-errors
Jun 19, 2026
Merged

refactor: share LMS fail-loud error across selectors, cache JS parses#93
redmodd merged 2 commits into
mainfrom
refactor/dedupe-adapter-errors

Conversation

@redmodd

@redmodd redmodd commented Jun 19, 2026

Copy link
Copy Markdown
Owner

Two cleanups from a codebase review.

  • Unify the LMS missing-API error. The runtime createAdapter and the plugin's generated single-adapter modules each carried their own fail-loud message, and they'd drifted (the generated ones were terser and pulled all four unused adapters in via index.js). Extracted LMSAdapterError + labels + missingApiError into an adapter-free lms-error.ts both now share, and collapsed the plugin's four near-identical adapter-source switch cases into one table-driven generator.
  • Cache JS-module parses in ast.ts (mirroring the existing .svelte rootCache) so readCourseConfig's ~9 call sites per build don't re-parse course.config.js each time.

Behavior change: production LMS builds now throw the runtime's fuller error text on a missing API. No test asserted the old wording.

Verification

  • pnpm check: clean · pnpm --filter tessera-learn test: 944 passed · pnpm build: ok
  • LMS roundtrip e2e (real SCORM 1.2 / 2004 / cmi5 / xAPI builds): 17 passed

redmodd and others added 2 commits June 19, 2026 19:17
Extract LMSAdapterError + per-standard labels + missingApiError into an
adapter-free lms-error.ts. The runtime createAdapter and the build-time
generated single-adapter modules now throw the same rich message instead
of two hand-maintained copies that had already drifted; the generated
module imports from lms-error.js (no adapter deps) instead of index.js,
keeping the four unused adapters out of LMS bundles. Collapse the plugin's
four near-identical adapter-source switch cases into one table-driven
generator.

Cache JS-module acorn parses in ast.ts (mirroring the existing .svelte
rootCache) so readCourseConfig's ~9 call sites per build don't re-parse
course.config.js each time.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@redmodd redmodd merged commit e7a2794 into main Jun 19, 2026
8 checks passed
@redmodd redmodd deleted the refactor/dedupe-adapter-errors branch June 19, 2026 23:30
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.

1 participant