MeridianDocsSign in
Internals

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>

  1. Collect templates whose first reference belongs to this framework, and the refs they cover.
  2. 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.
  3. Walk each bucket's requirements in order:
    • place each policy template at its first covered requirement, as one policy task;
    • add a requirement task if it isn't covered by a policy, or it needs operational evidence (any automation other than policy:*, or, with no automation, any non-clause control), or a course satisfies it.
  4. Task kind: training if a course satisfies it; review for module:risk, module:impact_assessment, module:objectives, module:management_review, module:audits, module:soa and module:capa; inventory for scanner:ai_inventory, scanner:ai_bom, scanner:datasets and module:vendors; otherwise evidence.
  5. Steps come from the first five key_evidence items, plus "Upload and link to {ref}". Review, inventory and training tasks get standard steps.
  6. The first milestone gets the three kickoff tasks; the certify milestone gets the three certify tasks.
  7. Task keys are {SHORT}-{nn}, for example ISO42-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.