From e05d3b461290452a5534d6dfd31fece32bbfcbff Mon Sep 17 00:00:00 2001 From: Rohit Goswami Date: Thu, 19 Nov 2026 16:17:47 +0000 Subject: [PATCH] docs: make the capacity page commands run as written The two shell blocks on the scheduler capacity page ended their lines with two backslashes, so bash ran the first line alone and then tried to run each flag as a command. The shard example also read a storage policy whose capacity digest stopped matching the snapshot when the node feature became local-disk, so the command stopped with a digest error. Continue each line with one backslash, refresh the digest, and write the shard output under /tmp like the other pages. Name release 0.7.4 as the first release with both commands, in place of the note that the 0.7.3 binary lacks them. The walkthrough test fails a shell block that ends a line in two backslashes, runs both capacity commands from a checkout, and checks that the page names the release the changelog gives for stack capacity. --- changelog.d/+capacity-page-commands.doc.md | 1 + docs/orgmode/reference/planning-capacity.org | 28 +++--- llms-full.txt | 28 +++--- llms.txt | 2 +- tests/doc_walkthrough.rs | 94 +++++++++++++++++++ .../storage-policy.json | 2 +- 6 files changed, 125 insertions(+), 30 deletions(-) create mode 100644 changelog.d/+capacity-page-commands.doc.md diff --git a/changelog.d/+capacity-page-commands.doc.md b/changelog.d/+capacity-page-commands.doc.md new file mode 100644 index 00000000..43966189 --- /dev/null +++ b/changelog.d/+capacity-page-commands.doc.md @@ -0,0 +1 @@ +The scheduler capacity page runs as written. Its two commands continued each line with two backslashes, so a pasted block stopped after the first line, and the storage-policy fixture it uses named a stale snapshot digest, so `stack shard --storage-policy` refused it. Both now work from a checkout, and the page names release 0.7.4 as the first one that carries `stack capacity` and `stack shard --storage-policy` instead of saying the 0.7.3 binary lacks them. diff --git a/docs/orgmode/reference/planning-capacity.org b/docs/orgmode/reference/planning-capacity.org index 70ed11ae..ddf95d2c 100644 --- a/docs/orgmode/reference/planning-capacity.org +++ b/docs/orgmode/reference/planning-capacity.org @@ -6,8 +6,8 @@ * Capacity is an observation -This page describes the =main= source interface. The =0.7.3= release binary -does not provide =stack capacity= or =stack shard --storage-policy=. +=stack capacity= and =stack shard --storage-policy= are in release 0.7.4 and +every release after it. This page describes both. =stack capacity= reads one normalized JSON snapshot. It does not query the scheduler, probe hosts, predict a queue wait, reserve a node or grant storage @@ -52,10 +52,10 @@ Collectors must include hidden configured partitions when establishing a complete view, and minimize scheduler RPCs. #+begin_src sh -eb-stack stack capacity \\ - --snapshot tests/planning_capacity_fixtures/snapshot.json \\ - --partition local --target example/host --feature local-disk \\ - --cpus 4 --memory-mib 4096 --exclusive-node true --max-slots-per-node 1 \\ +eb-stack stack capacity \ + --snapshot tests/planning_capacity_fixtures/snapshot.json \ + --partition local --target example/host --feature local-disk \ + --cpus 4 --memory-mib 4096 --exclusive-node true --max-slots-per-node 1 \ --generated-at 2026-01-01T12:00:10Z #+end_src @@ -95,14 +95,14 @@ expected SHA256. Its fields are: The node-local request must retain the configured feature exactly. #+begin_src sh -eb-stack stack shard \\ - --build-list tests/stack_shard_fixtures/wave1.list \\ - --easyconfigs tests/stack_shard_fixtures/easyconfigs \\ - --installed tests/stack_shard_fixtures/installed.txt \\ - --installed-modules-dir tests/stack_shard_fixtures/modules/all \\ - --shards 4 \\ - --storage-policy tests/planning_capacity_fixtures/storage-policy.json \\ - --generated-at 2026-01-01T12:00:10Z --out-dir build/capacity-demo +eb-stack stack shard \ + --build-list tests/stack_shard_fixtures/wave1.list \ + --easyconfigs tests/stack_shard_fixtures/easyconfigs \ + --installed tests/stack_shard_fixtures/installed.txt \ + --installed-modules-dir tests/stack_shard_fixtures/modules/all \ + --shards 4 \ + --storage-policy tests/planning_capacity_fixtures/storage-policy.json \ + --generated-at 2026-01-01T12:00:10Z --out-dir /tmp/capacity-demo #+end_src =--storage-policy= and =--inode-quota= are mutually exclusive planning budget diff --git a/llms-full.txt b/llms-full.txt index 36868f27..53d2e1ae 100644 --- a/llms-full.txt +++ b/llms-full.txt @@ -9243,8 +9243,8 @@ See [the captured capacity and storage-policy interface](https://eb-stack.rgoswa # Capacity is an observation -This page describes the `main` source interface. The `0.7.3` release binary -does not provide `stack capacity` or `stack shard --storage-policy`. +`stack capacity` and `stack shard --storage-policy` are in release 0.7.4 and +every release after it. This page describes both. `stack capacity` reads one normalized JSON snapshot. It does not query the scheduler, probe hosts, predict a queue wait, reserve a node or grant storage @@ -9289,10 +9289,10 @@ Collectors must include hidden configured partitions when establishing a complete view, and minimize scheduler RPCs. ```sh -eb-stack stack capacity \\ - --snapshot tests/planning_capacity_fixtures/snapshot.json \\ - --partition local --target example/host --feature local-disk \\ - --cpus 4 --memory-mib 4096 --exclusive-node true --max-slots-per-node 1 \\ +eb-stack stack capacity \ + --snapshot tests/planning_capacity_fixtures/snapshot.json \ + --partition local --target example/host --feature local-disk \ + --cpus 4 --memory-mib 4096 --exclusive-node true --max-slots-per-node 1 \ --generated-at 2026-01-01T12:00:10Z ``` @@ -9332,14 +9332,14 @@ expected SHA256. Its fields are: The node-local request must retain the configured feature exactly. ```sh -eb-stack stack shard \\ - --build-list tests/stack_shard_fixtures/wave1.list \\ - --easyconfigs tests/stack_shard_fixtures/easyconfigs \\ - --installed tests/stack_shard_fixtures/installed.txt \\ - --installed-modules-dir tests/stack_shard_fixtures/modules/all \\ - --shards 4 \\ - --storage-policy tests/planning_capacity_fixtures/storage-policy.json \\ - --generated-at 2026-01-01T12:00:10Z --out-dir build/capacity-demo +eb-stack stack shard \ + --build-list tests/stack_shard_fixtures/wave1.list \ + --easyconfigs tests/stack_shard_fixtures/easyconfigs \ + --installed tests/stack_shard_fixtures/installed.txt \ + --installed-modules-dir tests/stack_shard_fixtures/modules/all \ + --shards 4 \ + --storage-policy tests/planning_capacity_fixtures/storage-policy.json \ + --generated-at 2026-01-01T12:00:10Z --out-dir /tmp/capacity-demo ``` `--storage-policy` and `--inode-quota` are mutually exclusive planning budget diff --git a/llms.txt b/llms.txt index ec95cba2..6bc703dc 100644 --- a/llms.txt +++ b/llms.txt @@ -53,7 +53,7 @@ The binary is `eb-stack`. The crate is `eb_stack`. Rust 1.90 or newer builds it - [Glossary](https://eb-stack.rgoswami.me/reference/glossary.html.md): Names shared by the tutorial, the how-to guides, and the reference. - [Command-line reference](https://eb-stack.rgoswami.me/reference/cli.html.md): eb-stack has seven namespaced command groups (package, recipe, stack, target, campaign, repro, ledger), four reports (easyblock-reach, pr-overlap, rebuild-set, component-reach), and a Model Context Protocol (MCP) server. -- [Scheduler capacity and phase storage](https://eb-stack.rgoswami.me/reference/planning-capacity.html.md): This page describes the main source interface. +- [Scheduler capacity and phase storage](https://eb-stack.rgoswami.me/reference/planning-capacity.html.md): stack capacity and stack shard --storage-policy are in release 0.7.4 and every release after it. - [Model Context Protocol server](https://eb-stack.rgoswami.me/reference/mcp.html.md): eb-stack mcp serves the version-one commands on stdin and stdout. - [Package bundle reference](https://eb-stack.rgoswami.me/reference/package-bundles.html.md): package inspect, package plan, and package bump write a version-one package bundle. - [Build target configuration](https://eb-stack.rgoswami.me/reference/targets.html.md): A target routes one EasyBuild workload through four independent layers: transport, executor, runtime, and EasyBuild settings. diff --git a/tests/doc_walkthrough.rs b/tests/doc_walkthrough.rs index 56bc19d9..3e49bf43 100644 --- a/tests/doc_walkthrough.rs +++ b/tests/doc_walkthrough.rs @@ -672,6 +672,100 @@ fn the_source_probe_howto_quotes_the_output_it_prints() { assert!(quoted.iter().all(|text| !text.contains("127.0.0.1"))); } +fn shell_blocks(text: &str, fence: bool) -> Vec { + if fence { + let mut blocks = Vec::new(); + for lang in ["sh", "bash", "shell"] { + blocks.extend(org_blocks(text, &format!("```{lang}\n"), "```")); + } + return blocks; + } + let mut blocks = Vec::new(); + for lang in ["bash", "sh", "shell"] { + blocks.extend(org_blocks( + text, + &format!("#+begin_src {lang}\n"), + "#+end_src", + )); + } + blocks +} + +/// A line continuation is one backslash. Two of them end the command at the +/// first line when a reader pastes the block. +#[test] +fn shell_blocks_continue_a_line_with_one_backslash() { + let mut pages = vec![(root().join("README.md"), true)]; + for path in org_files() { + pages.push((path, false)); + } + pages.push((root().join("docs/orgmode/index.org"), false)); + pages.push((root().join("docs/orgmode/install.org"), false)); + for (path, fence) in pages { + let text = std::fs::read_to_string(&path).expect("read"); + let rel = path.strip_prefix(root()).unwrap_or(&path); + for block in shell_blocks(&text, fence) { + for line in block.lines() { + assert!( + !line.trim_end().ends_with("\\\\"), + "{} has a shell line that ends in two backslashes:\n{line}", + rel.display() + ); + } + } + } +} + +/// The capacity page names the release that first carried both commands, and +/// its two commands run in a checkout. +#[test] +fn capacity_reference_commands_run_in_a_checkout() { + let page = std::fs::read_to_string(root().join("docs/orgmode/reference/planning-capacity.org")) + .unwrap(); + let changelog = std::fs::read_to_string(root().join("CHANGELOG.md")).unwrap(); + let added = changelog + .split("\n## ") + .find(|section| section.contains("- `stack capacity` reads")) + .and_then(|section| section.split_whitespace().next()) + .expect("the changelog section that adds stack capacity"); + assert!( + page.contains(&format!("release {added} and")), + "the page does not name release {added}, which added stack capacity" + ); + assert!(!page.contains("release binary\ndoes not provide")); + + let tmp = tempfile::tempdir().expect("temp"); + let scratch = format!("{}/", tmp.path().display()); + let bin = Path::new(env!("CARGO_BIN_EXE_eb-stack")).parent().unwrap(); + let path = format!( + "{}:{}", + bin.display(), + std::env::var("PATH").unwrap_or_default() + ); + let blocks = shell_blocks(&page, false); + assert_eq!(blocks.len(), 2, "capacity and shard commands"); + let mut stdout = Vec::new(); + for command in &blocks { + let output = Command::new("bash") + .current_dir(root()) + .env("PATH", &path) + .args(["-euo", "pipefail", "-c"]) + .arg(command.replace("/tmp/", &scratch)) + .output() + .expect("spawn bash"); + assert!( + output.status.success(), + "{command}\nstderr:\n{}", + String::from_utf8_lossy(&output.stderr) + ); + stdout.push(String::from_utf8_lossy(&output.stdout).into_owned()); + } + let capacity: serde_json::Value = serde_json::from_str(&stdout[0]).expect("capacity JSON"); + assert_eq!(capacity["queue_fitting_nodes"], 1); + assert_eq!(capacity["free_slots"], 1); + assert!(tmp.path().join("capacity-demo").is_dir()); +} + fn run_to(args: &[&str], out: &Path) -> std::process::Output { Command::new(env!("CARGO_BIN_EXE_eb-stack")) .current_dir(root()) diff --git a/tests/planning_capacity_fixtures/storage-policy.json b/tests/planning_capacity_fixtures/storage-policy.json index 682c4e29..3a6d1b11 100644 --- a/tests/planning_capacity_fixtures/storage-policy.json +++ b/tests/planning_capacity_fixtures/storage-policy.json @@ -1,5 +1,5 @@ { - "capacity_sha256": "aaa0baa0e64a1b06d4aeb27960ceae593e16f6c417d6392a501e9367c7dc112b", + "capacity_sha256": "945972200e636a80fe4ba2821016b96a4abeef927b4f518253ada11b43233933", "capacity_snapshot": "snapshot.json", "max_age_seconds": 60, "node_local_feature": "local-disk",