Split Learning reset into exercise and unit - #3635
Split Learning reset into exercise and unit#3635Dhairya Patel (HABER7789) wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Splits QDK Learning resets into activity-level and unit-level operations.
Changes:
- Restores individual notebook cells without affecting other work.
- Adds whole-unit reset support for Q# and notebook courses.
- Exposes the new tool through Copilot, commands, telemetry, and agent guidance.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
source/vscode/src/telemetry.ts |
Adds unit-reset telemetry. |
source/vscode/src/learning/service.ts |
Implements activity and unit reset behavior. |
source/vscode/src/learning/python/materialization.ts |
Restores individual notebook cells. |
source/vscode/src/learning/notebookExercises.ts |
Adds cell source lookup and replacement. |
source/vscode/src/learning/commands.ts |
Updates reset commands and notebook reopening. |
source/vscode/src/gh-copilot/tools.ts |
Registers the unit-reset tool. |
source/vscode/src/gh-copilot/learningTools.ts |
Adds tool orchestration and selected-cell synchronization. |
source/vscode/package.json |
Contributes the command and tool metadata. |
source/vscode/ai/qdk-learning.agent.md |
Documents activity versus unit resets. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
160de31 to
652220d
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Notebook close, edit, save, and rematerialization failures can currently be reported as successful resets.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (2)
source/vscode/src/learning/python/materialization.ts:136
NotebookDocument.save()returnsfalsewhen the document was not saved, but that result is ignored and the reset is reported as successful. In that case progress is cleared even though the restored cell was never persisted. Treat a false save result as a restoration failure rather than returning true.
await notebook.save();
return true;
source/vscode/src/learning/service.ts:1032
rematerializeUnitWorkbookdelegates tomaterializeNotebook, which catches every filesystem/parsing failure and returnsvoid(materialization.ts:147-170). Consequently this call always proceeds tofinishUnitReset, clearing completion and telling the command/tool that the unit was reset even when the workbook was unchanged. Propagate a failure result here and only clear progress after the workbook was successfully restored.
await rematerializeUnitWorkbook(unit);
- Files reviewed: 9/9 changed files
- Comments generated: 2
- Review effort level: Balanced
- resetExercise now restores only current activity - copilot can now reset a whole unit and can target a unit by name - resetting something with no code, like a markdowncell, will now report instead of silently resetting another cell
652220d to
528285f
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Failed save paths can still discard learner work or incorrectly report a successful reset.
Get a fresh assessment by requesting another Copilot review.
Review details
- Files reviewed: 9/9 changed files
- Comments generated: 2
- Review effort level: Balanced
| // Save any unsaved edits first so the editor is clean, then overwrite | ||
| // the file on disk. The editor will pick up the change automatically | ||
| // because it's no longer dirty. | ||
| await this.saveOpenDocument(uri); |
| if (!(await vscode.workspace.applyEdit(edit))) { | ||
| return false; | ||
| } | ||
| return notebook.save(); |
resetExercisereset one.qsfile for Q# courses but wiped the entire notebook for notebook courses, while telling Copilot it "only resets an exercise." It now restores just the current activity one file, or one cell.Adds
resetUnitand aqdk-learning-reset-unittool so chat can reset a whole unit, including by name.Reset was picking the wrong notebook cell, because the stored position only moves when you run a cell, not when you click one. Now that #3627 has merged, reset resolves the selected cell by location the same way the hint and solution tools do. I also hardened the reset paths so a cancelled notebook close, rejected edit, or failed save aborts and keeps the user's progress instead of reporting success.