Skip to main content

logicaffeine_web/ui/pages/
roadmap_history.rs

1//! Release-history data for the roadmap page.
2//!
3//! Generated from `CHANGELOG.md` + git tags by `scripts/generate-roadmap.sh`
4//! into `roadmap_history.json`, then baked at compile time — mirroring how
5//! [`benchmarks`](super::benchmarks) bakes `latest.json`. The roadmap renders
6//! one terse row per release; clicking a release opens its news article when
7//! one exists ([`news_slug_for`]).
8
9use serde::Deserialize;
10use std::sync::LazyLock;
11
12/// One released (or prepared) version. Newest-first in [`get_history`].
13#[derive(Deserialize, Clone, Debug, PartialEq)]
14pub struct Release {
15    pub version: String,
16    pub date: String,
17    pub title: String,
18    /// Whether a `v<version>` git tag exists. `false` = prepared, not yet cut.
19    pub tagged: bool,
20    /// Release-plumbing release (CI, benchmark infra, deploy, tooling, skipped).
21    /// Collapsed by default on the roadmap.
22    #[serde(default)]
23    pub maintenance: bool,
24}
25
26static HISTORY: LazyLock<Vec<Release>> =
27    LazyLock::new(|| serde_json::from_str(include_str!("roadmap_history.json")).unwrap());
28
29/// All releases, newest-first.
30pub fn get_history() -> &'static [Release] {
31    &HISTORY
32}
33
34/// The news-article slug for a release, if one exists.
35///
36/// Release articles are titled `v<version> — …`, so the first whitespace token
37/// is matched exactly — `v0.9.1` must not prefix-match `v0.9.16`.
38pub fn news_slug_for(version: &str) -> Option<&'static str> {
39    let token = format!("v{version}");
40    crate::ui::pages::news::get_articles()
41        .into_iter()
42        .find(|a| a.title.split_whitespace().next() == Some(token.as_str()))
43        .map(|a| a.slug)
44}
45
46#[cfg(test)]
47#[path = "../../../../../crates/logicaffeine_tests/unit/logicaffeine_web/ui/pages/roadmap_history/tests.rs"]
48mod tests;