fix(repo): sources and tests read files from the final directories

The include_str! and test paths of komorebic (Linux and macOS modules and tests),
komorebi-bar (macOS), komorebi-linux, komorebi-macos, komorebic-core, komorebi-config and
komorebi-bar-core named the old trees (komorebi-for-kde/docs, komorebi-for-mac/docs, the
schema.json files at the roots of the trees, komorebic/fixtures of the macOS tree). They
now read docs/linux, docs/macos, schemas/{windows,linux,macos} and the byte-identical
komorebic/fixtures at the root; the macOS pan tests point at the root fixtures, and
komorebi-linux's config_parity test takes the example config from docs/linux. Comments
that named the old paths were updated with them.

Not touched: markdown docs, justfiles, scripts, tools and nix files that name the old
paths (next revisions of the stack).

Verified: Windows clippy --locked --all-targets -D warnings (default members) passes; on
Linux cargo test -p komorebi -p komorebic -p komorebi-client -p komorebi-linux -p
komorebi-hotkeys -p komorebi-config -p komorebi-bar-core -p komorebic-core -p
komorebi-protocol (one test thread) passes, 96 test binaries ok after config_parity was
fixed; macOS cargo check --target aarch64-apple-darwin (fake CC) passes. Nix not run.
This commit is contained in:
LGUG2Z committed 2026-11-05 15:03:27 -08:00
1 parent f661493793
commit fa4752a514
17 files changed
+47 -51

No files matched your search

@@ -5,7 +5,7 @@
//! bar does not have (the keyboard, media and systray widgets, the mouse options and their
//! definitions, which pruning of the unreachable definitions finishes) and sets the text and the
//! defaults that read differently. Each entry is a convergence candidate: dropping one changes
//! one line of `komorebi-for-mac/schema.bar.json` and of `nix/komorebi-bar-options.nix`.
//! one line of `schemas/macos/schema.bar.json` and of `nix/macos/komorebi-bar-options.nix`.
//!
//! Generated from the difference between the two checked-in files; `tests/schema_oracle.rs`
//! proves that the view of the Windows file is byte-identical to the macOS file.
+11 -10
View File
@@ -1,6 +1,6 @@
//! The schema oracle of the shared bar.
//!
//! `schema.bar.json` (Windows, at the root) and `komorebi-for-mac/schema.bar.json` are what
//! `schemas/windows/schema.bar.json` and `schemas/macos/schema.bar.json` are what
//! `komorebi-bar --schema` prints. They are pinned here by size and a FNV-1a hash of their bytes,
//! so that a move or a convergence of bar code cannot change them unnoticed. A reviewed change
//! to either file updates the matching pin in the same revision.
@@ -20,13 +20,13 @@ struct Pin {
const PINS: [Pin; 2] = [
Pin {
file: "schema.bar.json",
file: "schemas/windows/schema.bar.json",
lines: 9_091,
bytes: 248_539,
fnv1a: 0xaaa0_fabf_b459_67b7,
},
Pin {
file: "komorebi-for-mac/schema.bar.json",
file: "schemas/macos/schema.bar.json",
lines: 3_774,
bytes: 116_925,
fnv1a: 0xa042_f6ac_063a_0cfd,
@@ -88,16 +88,18 @@ mod views {
/// The Windows file is the union; its Windows view is itself.
#[test]
fn the_windows_view_of_the_union_is_the_windows_file() {
let union = serde_json::from_str(&text("schema.bar.json")).expect("json");
assert!(view_text(union, SchemaPlatform::Windows) == text("schema.bar.json"));
let union = serde_json::from_str(&text("schemas/windows/schema.bar.json")).expect("json");
assert!(
view_text(union, SchemaPlatform::Windows) == text("schemas/windows/schema.bar.json")
);
}
/// The macOS view of the union is the macOS file, byte for byte.
#[test]
fn the_macos_view_of_the_union_is_the_macos_file() {
let union = serde_json::from_str(&text("schema.bar.json")).expect("json");
let union = serde_json::from_str(&text("schemas/windows/schema.bar.json")).expect("json");
let view = view_text(union, SchemaPlatform::MacOs);
let file = text("komorebi-for-mac/schema.bar.json");
let file = text("schemas/macos/schema.bar.json");
if view != file {
let first = view.lines().zip(file.lines()).position(|(a, b)| a != b);
panic!(
@@ -112,7 +114,7 @@ mod views {
/// schema through it.
#[test]
fn a_view_is_idempotent() {
let union = serde_json::from_str(&text("schema.bar.json")).expect("json");
let union = serde_json::from_str(&text("schemas/windows/schema.bar.json")).expect("json");
let once = view_text(union, SchemaPlatform::MacOs);
let again = view_text(
serde_json::from_str(&once).expect("json"),
@@ -133,8 +135,7 @@ mod generated {
/// out-of-tree harness covers it.)
#[test]
fn the_generated_macos_view_is_the_macos_file() {
let file =
String::from_utf8(super::read("komorebi-for-mac/schema.bar.json")).expect("utf-8");
let file = String::from_utf8(super::read("schemas/macos/schema.bar.json")).expect("utf-8");
let text = generated_text::<KomobarConfig>(SchemaPlatform::MacOs);
if text != file {
let first = text.lines().zip(file.lines()).position(|(a, b)| a != b);
@@ -3,7 +3,7 @@
//! three daemons call (`komorebi_config::rules`), so what the `rules`, `rules_class`, `rules_exe`,
//! `title_rule` and `startup_rules` end-to-end scenarios assert about WHICH window a rule catches
//! is asserted here once, with no window manager. These tests are the ones the KDE daemon had
//! (`komorebi-for-kde/komorebi/tests/rule_matching.rs`), moved with the function; they run the
//! (`komorebi-linux/tests/rule_matching.rs`), moved with the function; they run the
//! KDE/macOS input shape (`RuleQuirks::UNIX`, a window with a list of classes).
//!
//! Not covered here, and so still end-to-end: that the daemon applies the rule at the right moment
+5 -5
View File
@@ -1,7 +1,7 @@
//! The oracle of the crate: the schemas that are checked in next to the three daemons.
//!
//! `schema.json` and `schema.asc.json` of the Windows tree (the repository root), of
//! `komorebi-for-kde` and of `komorebi-for-mac` are what users, the docs and the nix options
//! `schema.json` and `schema.asc.json` of the three platforms (`schemas/windows`, `schemas/linux`,
//! `schemas/macos`) are what users, the docs and the nix options
//! are generated from, so they must not change by accident while the data types move into this
//! crate. The files are read by their path relative to the repository.
//!
@@ -26,19 +26,19 @@ struct Tree {
const TREES: [Tree; 3] = [
Tree {
name: "windows",
dir: "",
dir: "schemas/windows",
properties: 53,
defs: 60,
},
Tree {
name: "kde",
dir: "komorebi-for-kde",
dir: "schemas/linux",
properties: 37,
defs: 52,
},
Tree {
name: "macos",
dir: "komorebi-for-mac",
dir: "schemas/macos",
properties: 33,
defs: 47,
},
+2 -2
View File
@@ -48,7 +48,7 @@ impl PlatformDefaults {
container_padding: 10,
workspace_padding: 10,
};
/// `komorebi-for-kde/komorebi/src/border_manager/mod.rs` and `.../lib.rs`
/// `komorebi-linux/src/border_manager/mod.rs` and `.../lib.rs`
pub const KDE: Self = Self {
border_width: 10,
border_offset: 0,
@@ -56,7 +56,7 @@ impl PlatformDefaults {
container_padding: 5,
workspace_padding: 5,
};
/// `komorebi-for-mac/komorebi/src/border_manager/mod.rs` and `.../lib.rs`
/// `komorebi-macos/src/border_manager/mod.rs` and `.../lib.rs`
pub const MACOS: Self = Self {
border_width: 10,
border_offset: 0,
+2 -5
View File
@@ -27,7 +27,7 @@ fn macos_page(name: &str, page: &str) -> String {
#[test]
fn every_macos_page_is_as_checked_in() {
let dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../komorebi-for-mac/docs/cli");
let dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("../../docs/macos/cli");
if !dir.is_dir() {
// a source tree without the macOS tree (the nix build of the Windows workspace)
return;
@@ -41,9 +41,6 @@ fn every_macos_page_is_as_checked_in() {
stale.push(name.as_str());
}
}
assert!(
stale.is_empty(),
"stale pages in komorebi-for-mac/docs/cli: {stale:?}"
);
assert!(stale.is_empty(), "stale pages in docs/macos/cli: {stale:?}");
assert_eq!(rendered.len(), std::fs::read_dir(&dir).unwrap().count());
}
+1 -1
View File
@@ -8,7 +8,7 @@
//!
//! mirrors: commands / <command> (the part "the command is understood: exit status 0", for the
//! command line only; what the daemon does with it is the daemon's tests, see
//! `komorebi-for-kde/komorebi/tests/command_sweep.rs`)
//! `komorebi-linux/tests/command_sweep.rs`)
use komorebic_core::cli::Meta;
use komorebic_core::cli::command;
+2 -3
View File
@@ -128,7 +128,7 @@ pub fn main() -> eyre::Result<()> {
if opts.quickstart {
let komorebi_bar_json =
include_str!("../../../komorebi-for-mac/docs/komorebi.bar.example.json").to_string();
include_str!("../../../docs/macos/komorebi.bar.example.json").to_string();
std::fs::write(home_dir.join("komorebi.bar.json"), komorebi_bar_json)?;
println!(
"Example komorebi.bar.json file written to {}",
@@ -149,8 +149,7 @@ pub fn main() -> eyre::Result<()> {
let mut config = match config_path {
None => {
let komorebi_bar_json =
include_str!("../../../komorebi-for-mac/docs/komorebi.bar.example.json")
.to_string();
include_str!("../../../docs/macos/komorebi.bar.example.json").to_string();
std::fs::write(&default_config_path, komorebi_bar_json)?;
tracing::info!(
+1 -1
View File
@@ -1812,7 +1812,7 @@ mod tests {
let Some(known) = known_keys() else {
return;
};
let example = include_str!("../../docs/komorebi.example.json");
let example = include_str!("../../docs/linux/komorebi.example.json");
let value: serde_json::Value = serde_json::from_str(example).unwrap();
let findings = check_keys(&value, &known);
+1 -1
View File
@@ -216,7 +216,7 @@ fn the_kinds_of_rule_of_other_platforms_are_read_and_do_nothing() {
#[test]
fn the_applications_file_komorebic_ships_floats_the_programs_it_names() {
let shipped =
Path::new(env!("CARGO_MANIFEST_DIR")).join("../../komorebic/src/linux/applications.json");
Path::new(env!("CARGO_MANIFEST_DIR")).join("../komorebic/src/linux/applications.json");
let mut desktop = Desktop::load(&applications(&shipped)).unwrap();
assert_eq!(
+6 -4
View File
@@ -1,5 +1,5 @@
//! Can one `komorebi.json` be shared across platforms? The fixtures are the file this repository
//! ships (`docs/komorebi.example.json`) and files of komorebi for Windows, which has keys that
//! ships (`docs/linux/komorebi.example.json`) and files of komorebi for Windows, which has keys that
//! mean nothing on KDE Plasma. Every fixture must deserialize with [`StaticConfig`], round-trip
//! through its serializer, and lose only the top-level keys that are Windows-only
//! ([`WINDOWS_ONLY`]).
@@ -48,7 +48,7 @@ fn repo_root() -> PathBuf {
fn fixtures() -> Vec<PathBuf> {
let root = repo_root();
let mut out = vec![root.join("docs/komorebi.example.json")];
let mut out = vec![root.join("docs/linux/komorebi.example.json")];
let dir = root.join("spikes/config-parity/fixtures");
let mut stack = vec![dir];
while let Some(d) = stack.pop() {
@@ -185,8 +185,10 @@ fn the_lists_name_no_key_that_is_read() {
#[test]
fn the_example_in_the_docs_is_the_example_file() {
let page = std::fs::read_to_string(repo_root().join("docs/example-configurations.md")).unwrap();
let file = std::fs::read_to_string(repo_root().join("docs/komorebi.example.json")).unwrap();
let page =
std::fs::read_to_string(repo_root().join("docs/linux/example-configurations.md")).unwrap();
let file =
std::fs::read_to_string(repo_root().join("docs/linux/komorebi.example.json")).unwrap();
let start = page.find("```json\n").expect("the page has the example") + "```json\n".len();
let end = start + page[start..].find("```").expect("the example ends");
+1 -1
View File
@@ -381,7 +381,7 @@ fn theme_options_choose_the_variant_and_the_colour_each_border_takes() {
#[test]
fn the_wallpaper_example_in_the_docs_loads() {
let docs = Path::new(env!("CARGO_MANIFEST_DIR")).join("../docs/usage/wallpapers.md");
let docs = Path::new(env!("CARGO_MANIFEST_DIR")).join("../docs/linux/usage/wallpapers.md");
let docs = std::fs::read_to_string(docs).unwrap();
let json = docs
.split("```json\n")
+3 -3
View File
@@ -459,13 +459,13 @@ mod tests {
#[test]
fn the_swipes_of_a_stream_lift_at_the_speed_that_they_were_made_to() {
let long = lift_speed(&moves_of(include_str!(
"../../../komorebic/fixtures/pan3-long.transcript.txt"
"../../komorebic/fixtures/pan3-long.transcript.txt"
)));
let flick = lift_speed(&moves_of(include_str!(
"../../../komorebic/fixtures/pan3-flick.transcript.txt"
"../../komorebic/fixtures/pan3-flick.transcript.txt"
)));
let slow = lift_speed(&moves_of(include_str!(
"../../../komorebic/fixtures/pan3-slow.transcript.txt"
"../../komorebic/fixtures/pan3-slow.transcript.txt"
)));
// 0.128 cm every 8 ms, and 0.267 every 8
+2 -3
View File
@@ -577,8 +577,7 @@ pub fn main() -> eyre::Result<()> {
std::fs::create_dir_all(&*komorebi_client::DATA_DIR)?;
let komorebi_json =
include_str!("../../../komorebi-for-kde/docs/komorebi.example.json")
.to_string();
include_str!("../../../docs/linux/komorebi.example.json").to_string();
let komorebi_path = HOME_DIR.join("komorebi.json");
let applications_path = HOME_DIR.join("applications.json");
let skhdrc_path = HOME_DIR.join("skhdrc");
@@ -590,7 +589,7 @@ pub fn main() -> eyre::Result<()> {
let applications_json = include_str!("applications.json");
write_file_with_prompt(&applications_path, applications_json, &mut written_files)?;
let skhdrc = include_str!("../../../komorebi-for-kde/docs/skhdrc.sample");
let skhdrc = include_str!("../../../docs/linux/skhdrc.sample");
write_file_with_prompt(&skhdrc_path, skhdrc, &mut written_files)?;
if written_files.is_empty() {
println!("\nNo files were written.")
+3 -5
View File
@@ -278,11 +278,9 @@ pub fn main() -> eyre::Result<()> {
std::fs::create_dir_all(data_dir)?;
let mut komorebi_json =
include_str!("../../../komorebi-for-mac/docs/komorebi.example.json")
.to_string();
include_str!("../../../docs/macos/komorebi.example.json").to_string();
let komorebi_bar_json =
include_str!("../../../komorebi-for-mac/docs/komorebi.bar.example.json")
.to_string();
include_str!("../../../docs/macos/komorebi.bar.example.json").to_string();
if std::env::var("KOMOREBI_CONFIG_HOME").is_ok() {
komorebi_json =
@@ -302,7 +300,7 @@ pub fn main() -> eyre::Result<()> {
let applications_json = include_str!("applications.json");
write_file_with_prompt(&applications_path, applications_json, &mut written_files)?;
let whkdrc = include_str!("../../../komorebi-for-mac/docs/skhdrc.sample");
let whkdrc = include_str!("../../../docs/macos/skhdrc.sample");
write_file_with_prompt(&skhdrc_path, whkdrc, &mut written_files)?;
if written_files.is_empty() {
println!("\nNo files were written.")
+4 -4
View File
@@ -873,7 +873,7 @@ fn quickstart_writes_the_example_files_and_asks_before_it_overwrites_one() {
let output = quickstart(&runtime, &home, "");
assert!(output.status.success(), "{output:?}");
let example = include_str!("../../komorebi-for-kde/docs/komorebi.example.json");
let example = include_str!("../../docs/linux/komorebi.example.json");
assert_eq!(
std::fs::read_to_string(home.join("komorebi.json")).unwrap(),
example
@@ -884,7 +884,7 @@ fn quickstart_writes_the_example_files_and_asks_before_it_overwrites_one() {
);
assert_eq!(
std::fs::read_to_string(home.join("skhdrc")).unwrap(),
include_str!("../../komorebi-for-kde/docs/skhdrc.sample")
include_str!("../../docs/linux/skhdrc.sample")
);
assert!(stdout(&output).contains("The following example files were written"));
assert!(stdout(&output).contains("komorebic start"));
@@ -905,7 +905,7 @@ fn quickstart_writes_the_example_files_and_asks_before_it_overwrites_one() {
// the third question has no answer, which is not a yes
assert_eq!(
std::fs::read_to_string(home.join("skhdrc")).unwrap(),
include_str!("../../komorebi-for-kde/docs/skhdrc.sample")
include_str!("../../docs/linux/skhdrc.sample")
);
assert!(stdout(&output).contains("Skipping"));
}
@@ -1001,7 +1001,7 @@ fn the_schema_files_of_the_repository_are_what_the_subcommands_print() {
let root = Path::new(env!("CARGO_MANIFEST_DIR"))
.parent()
.unwrap()
.join("komorebi-for-kde");
.join("schemas/linux");
for (file, subcommand) in [
("schema.json", "static-config-schema"),
+1 -1
View File
@@ -78,7 +78,7 @@ fn stderr(output: &Output) -> String {
fn fixture(name: &str) -> PathBuf {
Path::new(env!("CARGO_MANIFEST_DIR"))
.join("../komorebi-for-kde/komorebi-hotkeys/tests/fixtures")
.join("../komorebi-hotkeys/tests/fixtures")
.join(name)
}