Roadmap engine
The pure functions in backend/core that turn a framework into milestones and tasks, and compute levels and streaks.
backend/core has no IO beyond reading content/, so it's easy to test and reason about.
catalog.rs
Catalog::load(dir) reads frameworks/*.json, policies/*.md (with isms/) and training/*.json. Policy front matter is parsed with serde_yaml; PolicyTemplate::refs_for(framework) returns the requirement refs a template covers, matched by the framework's prefix (ISO42001:, ISO27001:2022:, or the framework id in capitals followed by :). render fills {{placeholders}} and leaves unknown ones visible.
roadmap.rs — plan(framework, catalog) -> Vec<PlannedMilestone>
- Collect templates whose first reference belongs to this framework, and the refs they cover.
- Build buckets:
- Frameworks with
kind: "clause"requirements get the lead phases (groups 4–5, 6, 7, 8). Annex groups follow: small neighbours are merged (six or fewer controls in total), and large groups are split into balanced parts of at most 12. The tail phases (9, 10) come last. - Other frameworks get one bucket per
group, then a certify bucket.
- Frameworks with
- Walk each bucket's requirements in order:
- place each policy template at its first covered requirement, as one
policytask; - add a requirement task if it isn't covered by a policy, or it needs operational evidence (any
automationother thanpolicy:*, or, with no automation, any non-clause control), or a course satisfies it.
- place each policy template at its first covered requirement, as one
- Task kind:
trainingif a course satisfies it;reviewformodule:risk,module:impact_assessment,module:objectives,module:management_review,module:audits,module:soaandmodule:capa;inventoryforscanner:ai_inventory,scanner:ai_bom,scanner:datasetsandmodule:vendors; otherwiseevidence. - Steps come from the first five
key_evidenceitems, plus "Upload and link to {ref}". Review, inventory and training tasks get standard steps. - The first milestone gets the three kickoff tasks; the certify milestone gets the three certify tasks.
- Task keys are
{SHORT}-{nn}, for exampleISO42-07, and are unique per framework.
The tests assert that every requirement is reachable from some task, that keys are unique, that ISO 42001 includes training tasks, and that large annexes are chunked.
gamify.rs
level_for(xp)→ level number, name, floor and the next threshold.streak(days, today, yesterday)→ consecutive days ending today or yesterday (leap years handled).BADGES→ the badge catalogue.
Where state lives
The plan is persisted by server/domain.rs::enable_framework into milestones and tasks. Readiness and milestone status are computed on read from task status (readiness, roadmap), so nothing can drift.
