feat(learning): import local roadmap packs into the catalogue - #93
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of Changes
Roadmaps no longer have to live in the repo's
roadmaps/directory. This PR adds local import of roadmap packs:roadmaps/(sourcebuiltin) and~/.torollo/roadmaps/(sourceimported). Dropping a valid file in the user folder makes it appear on refresh, no restart.POST /api/learning/roadmaps/importaccepts a raw.jsonroadmap or a.ziparchive of them (magic-byte detection,adm-zip, entry-count/size caps). Every file is Ajv-validated before anything is written and the response is a per-file report (imported/rejectedwith exact field-level errors /ignored), so a typo in a hand-written roadmap is an actionable message, not a silent failure.id, so an import colliding with a shipped(id, language)is refused with a clear message — both at import time and at scan time for hand-dropped files. Installed files are named<id>.<language>.json, so re-importing a fixed pack updates in place (updatedin the report).docs/local-roadmaps.md, plus updates todocs/learning-api.md,docs/roadmap-format.mdand the README.Roadmaps remain pure data — importing never executes anything from the file.
Types of Changes
Verification & Testing
Automated Checks
npm run lintsuccessfully with no errorsnpm run buildsuccessfully with no compilation errorsnpm testsuccessfully (all tests pass)Backend: 470 jest tests passing (incl. 12 new import-service tests with real zip archives, 6 controller tests, merged-catalogue service tests). Frontend: 310 vitest tests passing (incl. language-filter bypass and import-button tests). Both builds and lints clean.
Manual Verification
End-to-end against real Docker, on an isolated backend (
HOMEscratch dir, compileddist/):.zipcontaining a valid roadmap, an invalid one and a README →200with 1 imported, 1 rejected with field-level errors, 1 ignored; catalogue then listed the 6 shipped roadmaps in curated order plus the imported entry markedimported.ubuntu+postgrescontainers, both steps passed, replay stable, progression 2/2 persisted, completion reached.resilient-three-tier→422with the explanatory refusal.updated, briefing page of the imported roadmap works, and the EN-only imported roadmap stays visible with the UI switched to French.Content-Typegets an explicit400telling the client to useapplication/octet-stream.Checklist