[Enhancement] Python playground: per-lesson completion tracking (tools:python-playground) #44

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

Summary

Enhancement for /tree-of-knowledge/domain(tools:python-playground) — the Python playground (PythonRunner) should track lesson completion per lesson, not only a generic "run lesson" signal.

Problem

Current behavior appears to record a generic run rather than which lessons were completed in this playground.

Goals

  • Per-lesson completion state for the Pyodide/Python runner path.
  • Consistent patterns with C# and JavaScript playground sibling tickets.
  • Clear progress for learners alongside ToK navigation.

Acceptance (draft)

  • Lesson-keyed completion persisted for Python playground.
  • UI exposes completed / not completed per lesson where the playground lists lessons.
  • Shared contract with #43 (C#) and #45 (JS) — single progress service or conventions doc.
  • Telemetry updated so runs are attributable to lesson id.

Area

PythonRunner · app-language-runner · /tree-of-knowledge/domain tools outlet (python-playground).

Sibling tickets (same enhancement pattern)

## Summary **Enhancement** for **`/tree-of-knowledge/domain`(tools:python-playground)** — the **Python playground** (`PythonRunner`) should **track lesson completion per lesson**, not only a **generic "run lesson"** signal. ## Problem Current behavior appears to record a **generic run** rather than **which lessons** were completed in this playground. ## Goals - **Per-lesson** completion state for the Pyodide/Python runner path. - **Consistent patterns** with C# and JavaScript playground sibling tickets. - Clear **progress** for learners alongside ToK navigation. ## Acceptance (draft) - [ ] **Lesson-keyed completion** persisted for Python playground. - [ ] UI exposes **completed / not completed** per lesson where the playground lists lessons. - [ ] Shared contract with **[#43](https://git.spikersoft.com/spikerj/spikersoft-issues/issues/43)** (C#) and **[#45](https://git.spikersoft.com/spikerj/spikersoft-issues/issues/45)** (JS) — single progress service or conventions doc. - [ ] Telemetry updated so runs are attributable to **lesson id**. ## Area `PythonRunner` · app-language-runner · `/tree-of-knowledge/domain` tools outlet (`python-playground`). ## Sibling tickets (same enhancement pattern) - **[#43 — C# playground](https://git.spikersoft.com/spikerj/spikersoft-issues/issues/43)** - **[#45 — JavaScript playground](https://git.spikersoft.com/spikerj/spikersoft-issues/issues/45)**
Author
Owner

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

The Python playground (PythonRunner at libraries/features/dev-tools-python-runner/src/lib/python-runner.ts) is a thin shell over the shared LanguageRunner, configured with LANGUAGE_RUNTIME_ADAPTER = PythonRuntimeAdapter 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: "python", 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 JavaScript (#45).

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 Python submissions land under csharp-playground instead of python-playground. Durable completion is correct — only the activity attribution is wrong. Filing a separate cross-cutting ticket for that.

Closing #44.

Closing as **already implemented** by the same shared infrastructure that resolved #43. The Python playground (`PythonRunner` at `libraries/features/dev-tools-python-runner/src/lib/python-runner.ts`) is a thin shell over the shared `LanguageRunner`, configured with `LANGUAGE_RUNTIME_ADAPTER = PythonRuntimeAdapter` 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: "python"`, 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 JavaScript (#45). 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 Python submissions land under `csharp-playground` instead of `python-playground`. Durable completion is correct — only the activity attribution is wrong. Filing a separate cross-cutting ticket for that. Closing #44.
Sign in to join this conversation.