[Enhancement] JavaScript playground: per-lesson completion tracking (tools:javascript-playground) #45

Closed
opened 2026-04-29 17:12:23 +00:00 by spikerj · 1 comment
Owner

Summary

Enhancement for /tree-of-knowledge/domain(tools:javascript-playground) — the JavaScript playground (JavaScriptRunner) should track lesson completion per lesson, not merely a generic "run lesson" capture.

Problem

Progress appears non-specific to individual lessons — learners cannot rely on granular completion for each ToK lesson tied to this runner.

Goals

  • Store and display each lesson’s completion for the JS playground.
  • Match engineering approach adopted for C# and Python playground enhancements (shared types/services where possible).

Acceptance (draft)

  • Persist lesson id + completion for JS playground sessions.
  • Sidebar / lesson list shows accurate completion per lesson.
  • Replace or augment ambiguous generic run-only semantics; document analytics changes.
  • Coordinate API + UI with #43 and #44.

Area

JavaScriptRunner · app-language-runner · Tree of Knowledge domain tools route (javascript-playground).

Sibling tickets (same enhancement pattern)

## Summary **Enhancement** for **`/tree-of-knowledge/domain`(tools:javascript-playground)** — the **JavaScript playground** (`JavaScriptRunner`) should **track lesson completion per lesson**, not merely a **generic "run lesson"** capture. ## Problem Progress appears **non-specific** to individual lessons — learners cannot rely on granular completion for each ToK lesson tied to this runner. ## Goals - Store and display **each lesson’s** completion for the JS playground. - Match **engineering approach** adopted for **C#** and **Python** playground enhancements (shared types/services where possible). ## Acceptance (draft) - [ ] Persist **lesson id + completion** for JS playground sessions. - [ ] Sidebar / lesson list shows **accurate completion** per lesson. - [ ] Replace or augment ambiguous **generic run-only** semantics; document analytics changes. - [ ] Coordinate API + UI with **[#43](https://git.spikersoft.com/spikerj/spikersoft-issues/issues/43)** and **[#44](https://git.spikersoft.com/spikerj/spikersoft-issues/issues/44)**. ## Area `JavaScriptRunner` · app-language-runner · Tree of Knowledge domain tools route (`javascript-playground`). ## Sibling tickets (same enhancement pattern) - **[#43 — C# playground](https://git.spikersoft.com/spikerj/spikersoft-issues/issues/43)** - **[#44 — Python playground](https://git.spikersoft.com/spikerj/spikersoft-issues/issues/44)**
Author
Owner

Closing as already implemented by the same shared infrastructure that resolved #43.

The JavaScript playground (JavascriptRunner at libraries/features/dev-tools-javascript-runner/src/lib/javascript-runner.ts) is built on the shared LanguageRunner with LANGUAGE_RUNTIME_ADAPTER = JavascriptRuntimeAdapter and the same PROGRESS_SYNC_PORT_PROVIDER. It picks up the full per-lesson completion stack by construction:

  • Durable backend record — one UserLessonProgress Mongo doc per (UserId, LessonNumber) with attempts, test results, timing.
  • Offline queueProgressSyncService IndexedDB queue with language: "javascript", server re-verifies on reconnect.
  • UILessonSidebar consumes completedLessonNumbers and renders checkmarks / locks / progress counts.
  • Shared contract — same ProgressSyncPort / QueuedProgressInput / /Lessons/progress endpoints used by C# (#43) and Python (#44).

Full architectural breakdown is in #43's closing comment.

One caveat carried over from #43: the server-side ExecuteLessonCodeCommand is annotated [TrackableActivity("tools.csharp-playground", "run-lesson")], so generic analytics rows for JavaScript submissions land under csharp-playground instead of javascript-playground. Durable completion is correct — only the activity attribution is wrong. Filing a separate cross-cutting ticket for that.

Closing #45.

Closing as **already implemented** by the same shared infrastructure that resolved #43. The JavaScript playground (`JavascriptRunner` at `libraries/features/dev-tools-javascript-runner/src/lib/javascript-runner.ts`) is built on the shared `LanguageRunner` with `LANGUAGE_RUNTIME_ADAPTER = JavascriptRuntimeAdapter` and the same `PROGRESS_SYNC_PORT_PROVIDER`. It picks up the full per-lesson completion stack by construction: - **Durable backend record** — one `UserLessonProgress` Mongo doc per `(UserId, LessonNumber)` with attempts, test results, timing. - **Offline queue** — `ProgressSyncService` IndexedDB queue with `language: "javascript"`, server re-verifies on reconnect. - **UI** — `LessonSidebar` consumes `completedLessonNumbers` and renders checkmarks / locks / progress counts. - **Shared contract** — same `ProgressSyncPort` / `QueuedProgressInput` / `/Lessons/progress` endpoints used by C# (#43) and Python (#44). Full architectural breakdown is in #43's [closing comment](https://git.spikersoft.com/spikerj/spikersoft-issues/issues/43#issuecomment-179). One caveat carried over from #43: the server-side `ExecuteLessonCodeCommand` is annotated `[TrackableActivity("tools.csharp-playground", "run-lesson")]`, so generic *analytics* rows for JavaScript submissions land under `csharp-playground` instead of `javascript-playground`. Durable completion is correct — only the activity attribution is wrong. Filing a separate cross-cutting ticket for that. Closing #45.
Sign in to join this conversation.