From b3e8eb6e7e4739f5d34e6cfabc51ada9fa44543a Mon Sep 17 00:00:00 2001 From: piquel Date: Sun, 22 Nov 2026 00:26:30 +0100 Subject: [PATCH 1/2] refactor(xtask): check piqueld-client's dependency boundary piqueld-client is the published client the CLI and dashboard share, and builds for wasm32, so it must not depend on the daemon's crates or on Docker, database or browser frameworks, through any dependency kind, nor on a server framework outside its native tests. The check now reads every target, so wasm32-only dependencies count too. Part of PQD-162 --- docs/dev/architecture/dependency-flow.md | 13 +++++-- docs/dev/rust-conventions.md | 3 +- tools/xtask/src/boundary.rs | 49 +++++++++++++++++++++--- 3 files changed, 54 insertions(+), 11 deletions(-) diff --git a/docs/dev/architecture/dependency-flow.md b/docs/dev/architecture/dependency-flow.md index 675741734..82b0f8fde 100644 --- a/docs/dev/architecture/dependency-flow.md +++ b/docs/dev/architecture/dependency-flow.md @@ -103,10 +103,15 @@ The controller checks the latest operation before continuing runtime work and computes each plan from a fresh observation. Shared records avoid conversion between separate store, API, and client operation models. -`just boundary` (`cargo xtask boundary`) checks that `piqueld-core` depends on no -server, Docker, database, or browser framework (`axum`, `bollard`, `sqlx`, -`leptos`), including through build and development dependencies. It also -checks that the daemon's crates don't depend on those they build alongside: +`just boundary` (`cargo xtask boundary`) checks each crate's dependencies on +every target, wasm32 included. `piqueld-core` depends on no server, Docker, +database, or browser framework (`axum`, `bollard`, `sqlx`, `leptos`), including +through build and development dependencies. `piqueld-client` depends on none of +the daemon's crates (`piqueld`, `piqueld-config`, `piqueld-store`, +`piqueld-docker`) and no Docker, database, or browser framework, including +through build and development dependencies, and on no server framework outside +its native tests, which serve their requests with `axum`. It also checks that +the daemon's crates don't depend on those they build alongside: `piqueld-config` depends on no Docker, database, or browser framework, nor on the daemon or its store; `piqueld-store` on no server, Docker, or browser framework, nor on the daemon or its configuration, even in its tests; and diff --git a/docs/dev/rust-conventions.md b/docs/dev/rust-conventions.md index f8476d10e..807832791 100644 --- a/docs/dev/rust-conventions.md +++ b/docs/dev/rust-conventions.md @@ -11,7 +11,8 @@ logic instead of copying it. [Module boundaries](architecture/dependency-flow.md) describes each crate and what it may depend on, and `just boundary` checks it. Shared contracts live in `piqueld-core`, which knows no server, database, Docker or browser framework; -the daemon's crates (`piqueld-config`, `piqueld-store`, `piqueld-docker`) +`piqueld-client` knows none of them nor the daemon's crates, outside its tests' +server; the daemon's crates (`piqueld-config`, `piqueld-store`, `piqueld-docker`) don't depend on the ones they build alongside. A new dependency between crates updates both that page and `tools/xtask/src/boundary.rs`. diff --git a/tools/xtask/src/boundary.rs b/tools/xtask/src/boundary.rs index faa322dec..1adaa2c40 100644 --- a/tools/xtask/src/boundary.rs +++ b/tools/xtask/src/boundary.rs @@ -1,7 +1,9 @@ //! `just boundary`: checks the workspace's dependency boundaries. //! `piqueld-core` holds the shared contracts, so it must not depend on the -//! server, Docker, database, or browser frameworks. The daemon's own crates -//! build in parallel only while they don't depend on each other. +//! server, Docker, database, or browser frameworks. `piqueld-client` builds +//! for wasm32 too, so it must not depend on the daemon or any of those either. +//! The daemon's own crates build in parallel only while they don't depend on +//! each other. use std::process::ExitCode; @@ -11,7 +13,7 @@ use crate::Workspace; use crate::process::checked_stdout; /// A package that must not depend on any of `forbidden`, through the -/// dependency kinds of `edges`. +/// dependency kinds of `edges`, on any target. struct Boundary { package: &'static str, /// `cargo tree --edges` kinds. @@ -21,7 +23,7 @@ struct Boundary { reason: &'static str, } -const BOUNDARIES: [Boundary; 4] = [ +const BOUNDARIES: [Boundary; 6] = [ Boundary { package: "piqueld-core", // The client and dashboard build it, so its build and development @@ -38,6 +40,31 @@ const BOUNDARIES: [Boundary; 4] = [ ], reason: "holds the shared contracts, without server, Docker, database, or browser frameworks", }, + Boundary { + package: "piqueld-client", + // It builds for wasm32 and is published, so its build and development + // dependencies count too; its server framework is checked below. + edges: "all", + forbidden: &[ + "bollard", + "bollard-stubs", + "leptos", + "sqlx", + "sqlx-core", + "piqueld", + "piqueld-config", + "piqueld-docker", + "piqueld-store", + ], + reason: "is the published client the CLI and dashboard share, without the daemon, Docker, database, or browser frameworks", + }, + Boundary { + package: "piqueld-client", + // Its native tests serve their requests with axum. + edges: "normal,build", + forbidden: &["axum", "axum-core"], + reason: "is the published client, which builds for wasm32, so only its tests may use a server framework", + }, Boundary { package: "piqueld-config", edges: "normal,build", @@ -73,7 +100,14 @@ pub fn check(workspace: &Workspace) -> Result { let output = workspace .cargo() .args(["tree", "--locked", "--package", boundary.package]) - .args(["--edges", boundary.edges, "--prefix", "none"]) + .args([ + "--edges", + boundary.edges, + "--target", + "all", + "--prefix", + "none", + ]) .output() .context("run cargo tree")?; let tree = checked_stdout("cargo tree", output)?; @@ -86,7 +120,10 @@ pub fn check(workspace: &Workspace) -> Result { }) .collect(); if forbidden.is_empty() { - println!("{} dependency boundary is intact", boundary.package); + println!( + "{} dependency boundary is intact ({} dependencies)", + boundary.package, boundary.edges + ); } else { eprintln!( "{} {}, but depends on:\n{}", From ce11060b7ac3d4917cc1ebce8aaf578e938e9161 Mon Sep 17 00:00:00 2001 From: piquel Date: Sun, 22 Nov 2026 15:52:20 +0100 Subject: [PATCH 2/2] refactor(xtask): keep piqueld-client off every other workspace crate Its rule named only the daemon's crates, so a development dependency on the CLI, the dashboard or the tooling would have passed. It now forbids every workspace crate but piqueld-core and piqueld-probe, and the docs say plainly that only its tests may use a server framework. Part of PQD-162 --- docs/dev/architecture/dependency-flow.md | 23 ++++++++++++----------- docs/dev/rust-conventions.md | 9 +++++---- tools/xtask/src/boundary.rs | 12 ++++++++++-- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/docs/dev/architecture/dependency-flow.md b/docs/dev/architecture/dependency-flow.md index 82b0f8fde..dec314c44 100644 --- a/docs/dev/architecture/dependency-flow.md +++ b/docs/dev/architecture/dependency-flow.md @@ -106,14 +106,15 @@ between separate store, API, and client operation models. `just boundary` (`cargo xtask boundary`) checks each crate's dependencies on every target, wasm32 included. `piqueld-core` depends on no server, Docker, database, or browser framework (`axum`, `bollard`, `sqlx`, `leptos`), including -through build and development dependencies. `piqueld-client` depends on none of -the daemon's crates (`piqueld`, `piqueld-config`, `piqueld-store`, -`piqueld-docker`) and no Docker, database, or browser framework, including -through build and development dependencies, and on no server framework outside -its native tests, which serve their requests with `axum`. It also checks that -the daemon's crates don't depend on those they build alongside: -`piqueld-config` depends on no Docker, database, or browser framework, nor on -the daemon or its store; `piqueld-store` on no server, Docker, or browser -framework, nor on the daemon or its configuration, even in its tests; and -`piqueld-docker` on no server, database, or browser framework, nor on the -daemon, its configuration, or its store. +through build and development dependencies. `piqueld-client` depends on no +workspace crate but `piqueld-core` and `piqueld-probe`, so neither on the +daemon's crates nor on the CLI, dashboard or tooling, and on no Docker, +database, or browser framework, again including through build and development +dependencies. Only its native tests may use a server framework: they serve +their requests with `axum`. It also checks that the daemon's crates don't +depend on those they build alongside: `piqueld-config` depends on no Docker, +database, or browser framework, nor on the daemon or its store; +`piqueld-store` on no server, Docker, or browser framework, nor on the daemon +or its configuration, even in its tests; and `piqueld-docker` on no server, +database, or browser framework, nor on the daemon, its configuration, or its +store. diff --git a/docs/dev/rust-conventions.md b/docs/dev/rust-conventions.md index 807832791..a05b8efbf 100644 --- a/docs/dev/rust-conventions.md +++ b/docs/dev/rust-conventions.md @@ -10,10 +10,11 @@ logic instead of copying it. [Module boundaries](architecture/dependency-flow.md) describes each crate and what it may depend on, and `just boundary` checks it. Shared contracts live in -`piqueld-core`, which knows no server, database, Docker or browser framework; -`piqueld-client` knows none of them nor the daemon's crates, outside its tests' -server; the daemon's crates (`piqueld-config`, `piqueld-store`, `piqueld-docker`) -don't depend on the ones they build alongside. A new dependency between +`piqueld-core`, which knows no server, database, Docker or browser framework. +`piqueld-client` depends on no workspace crate but `piqueld-core` and +`piqueld-probe`, and on none of those frameworks, except the server framework +its tests use. The daemon's crates (`piqueld-config`, `piqueld-store`, +`piqueld-docker`) don't depend on the ones they build alongside. A new dependency between crates updates both that page and `tools/xtask/src/boundary.rs`. A feature reaches every surface it applies to, from the checklist in diff --git a/tools/xtask/src/boundary.rs b/tools/xtask/src/boundary.rs index 1adaa2c40..5ecbfa0ef 100644 --- a/tools/xtask/src/boundary.rs +++ b/tools/xtask/src/boundary.rs @@ -1,7 +1,9 @@ //! `just boundary`: checks the workspace's dependency boundaries. //! `piqueld-core` holds the shared contracts, so it must not depend on the //! server, Docker, database, or browser frameworks. `piqueld-client` builds -//! for wasm32 too, so it must not depend on the daemon or any of those either. +//! for wasm32 too, so it must not depend on any other workspace crate but +//! `piqueld-core` and `piqueld-probe`, nor on those frameworks, except for the +//! server framework its native tests use. //! The daemon's own crates build in parallel only while they don't depend on //! each other. @@ -51,12 +53,18 @@ const BOUNDARIES: [Boundary; 6] = [ "leptos", "sqlx", "sqlx-core", + // Every workspace crate but `piqueld-core` and `piqueld-probe`. + "piquelctl", "piqueld", + "piqueld-build", "piqueld-config", "piqueld-docker", + "piqueld-generated", "piqueld-store", + "piqueld-ui", + "xtask", ], - reason: "is the published client the CLI and dashboard share, without the daemon, Docker, database, or browser frameworks", + reason: "is the published client the CLI and dashboard share, without the other workspace crates or Docker, database, or browser frameworks", }, Boundary { package: "piqueld-client",