summaryrefslogtreecommitdiffstats
path: root/tests/layers.rs
diff options
context:
space:
mode:
authoraur-build <aur-build@localhost>2026-11-19 17:09:59 +0000
committeraur-build <aur-build@localhost>2026-11-19 17:09:59 +0000
commite757979f1a2afdbe7146066345bb9acd19d3b151 (patch)
tree30d5f5fbccd25ea7bf01c5202684af463b74e7d3 /tests/layers.rs
parent94c318f13264bb3c00a9f3057ba2e1aafb57c9e4 (diff)
downloadaur-build-e757979f1a2afdbe7146066345bb9acd19d3b151.tar.gz
aur-build-e757979f1a2afdbe7146066345bb9acd19d3b151.zip
comments: say why, not what
Every module-level `//!` header is gone, and the comments that remained either re-explained the line below them or had grown into paragraphs. Density went from one comment line per 6.7 lines of code to one per 10. 827 insertions against 2194 deletions across 86 files. What survived: the invariants (I1-I12), the design cross-references into DESIGN.md, and the notes recording a bug that was found and fixed — those are the comments that carry weight, because they answer a question the code cannot answer about itself. What did not: restating a function signature in prose, and narration of the statement underneath.
Diffstat (limited to 'tests/layers.rs')
-rw-r--r--tests/layers.rs22
1 files changed, 5 insertions, 17 deletions
diff --git a/tests/layers.rs b/tests/layers.rs
index 548f475..8566584 100644
--- a/tests/layers.rs
+++ b/tests/layers.rs
@@ -1,12 +1,3 @@
-//! The dependency direction between modules (§6 M-6, M-7).
-//!
-//! These are not style rules. The review found the persistence layer naming a
-//! type from the VCS watcher, and the reviewer's risk scorer calling back into
-//! the watcher for a recipe question — two edges pointing up the stack, which
-//! makes `db` and `watch` mutually dependent and means any change to one is a
-//! change to the other. A layering rule that is only written down gets violated
-//! by the next reasonable-looking commit, so it is a test here.
-
use std::path::{Path, PathBuf};
fn src_root() -> PathBuf {
@@ -57,9 +48,8 @@ fn edges(dir: &str, forbidden: &[&str]) -> Vec<String> {
#[test]
fn persistence_names_nothing_above_itself() {
- // M-6: `db::stage_b_cache_get` used to return `watch::upstream::StageB`, so
- // the storage layer could not be understood without the watcher. The row
- // type is `db::model::StageBCacheRow` now and the watcher converts.
+ // M-6: `db::stage_b_cache_get` used to return `watch::upstream::StageB`, so the
+ // storage layer could not be understood without the watcher.
let hits = edges("db", &["watch", "review", "pipeline", "http", "ops", "shims"]);
assert!(hits.is_empty(), "src/db depends upward on the modules above it:\n{hits:#?}");
}
@@ -67,9 +57,8 @@ fn persistence_names_nothing_above_itself() {
#[test]
fn review_does_not_call_back_into_the_watcher() {
// M-7: `review::risk` called `watch::digests::skip_on_non_vcs` while
- // `watch::detect` called `review::candidates` — a cycle. Whether a recipe
- // skips verification is a recipe question, so `recipe::skip_on_non_vcs` is
- // where it lives and both sides look down, not sideways.
+ // `watch::detect` called `review::candidates` — a cycle. It now lives in
+ // `recipe`, and both sides look down, not sideways.
let hits = edges("review", &["watch", "pipeline", "http"]);
assert!(hits.is_empty(), "src/review depends on modules beside or above it:\n{hits:#?}");
}
@@ -82,8 +71,7 @@ fn the_watcher_does_not_reach_into_the_pipeline_or_the_ui() {
#[test]
fn the_recipe_leaf_depends_on_nothing_above_it() {
- // `recipe` is a leaf: parsing and recipe-shaped questions. Everything else
- // is allowed to ask it; it may ask nothing.
+ // `recipe` is a leaf: everything else may ask it; it may ask nothing.
let text = std::fs::read_to_string(src_root().join("recipe.rs")).expect("read recipe.rs");
for m in ["watch", "review", "pipeline", "http", "ops", "shims"] {
assert!(