From f8370b48f3e4464a1454d0ff7af1819b5448c619 Mon Sep 17 00:00:00 2001 From: aur-build Date: Wed, 18 Nov 2026 16:13:30 +0000 Subject: db, watch: two upward edges removed, and the layering is now a test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit M-6. `db::stage_b_cache_get` and `db::stage_b_recent` returned `watch::upstream::StageB`, so the persistence layer could not be read without the VCS watcher, and the table's row shape was defined by whatever the watcher happened to find convenient. The row is `db::model::StageBCacheRow` now — epoch, pkgver, pkgrel, pins — and `watch::upstream` converts at its own boundary. The two types are deliberately not the same one: `StageB` carries `cached`, and "was this answer a cache hit?" is a fact about the resolution that just happened, not a column. M-7. `review::risk` called `watch::digests::skip_on_non_vcs` while `watch::detect` called into `review::candidates`, a cycle between two sibling domains. Whether a recipe declines to verify its own sources is a question about the recipe, so `skip_on_non_vcs` — with `SKIP`, `declared_sums` and `is_hex_digest`, which it needed and which the watcher had no business owning — moved to `recipe.rs`, a leaf both sides may look down at. `watch::digests` keeps its use of them for digest resolution; the re-export is gone. `tests/layers.rs` enforces the direction from now on: `src/db` names no module above itself, `src/review` does not name `watch`, `src/watch` does not name `pipeline` or `http`, and `recipe.rs` names nothing at all. Each rule failed before this commit and each failure message prints the exact file and line of the offending edge, so the next reasonable-looking commit cannot reintroduce one quietly. --- src/db/queries.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/db/queries.rs') diff --git a/src/db/queries.rs b/src/db/queries.rs index ffb2520..b768f83 100644 --- a/src/db/queries.rs +++ b/src/db/queries.rs @@ -957,7 +957,7 @@ pub fn insert_artifact_in(tx: &rusqlite::Transaction<'_>, a: &NewArtifact<'_>) - // --------------------------------------------------------- stage B cache -- /// Exact cache hit: same recipe, same upstream tips (§5.2). -pub fn stage_b_cache_get(db: &Db, pkgbase_id: i64, recipe_hash: &str, tip_hash: &str) -> Result> { +pub fn stage_b_cache_get(db: &Db, pkgbase_id: i64, recipe_hash: &str, tip_hash: &str) -> Result> { let (rh, th) = (recipe_hash.to_string(), tip_hash.to_string()); db.read(move |c| { use rusqlite::OptionalExtension; @@ -975,18 +975,17 @@ pub fn stage_b_cache_get(db: &Db, pkgbase_id: i64, recipe_hash: &str, tip_hash: }, ) .optional()? - .map(|(epoch, pkgver, pkgrel, pins_json)| crate::watch::upstream::StageB { + .map(|(epoch, pkgver, pkgrel, pins_json)| StageBCacheRow { epoch, pkgver, pkgrel, pins: serde_json::from_str(&pins_json).unwrap_or_default(), - cached: true, })) }) } /// The most recent answer for this pkgbase, if it is inside the cooldown window. -pub fn stage_b_recent(db: &Db, pkgbase_id: i64, cooldown_secs: i64) -> Result> { +pub fn stage_b_recent(db: &Db, pkgbase_id: i64, cooldown_secs: i64) -> Result> { let cutoff = crate::time::secs_ago(cooldown_secs); db.read(move |c| { use rusqlite::OptionalExtension; @@ -1005,12 +1004,11 @@ pub fn stage_b_recent(db: &Db, pkgbase_id: i64, cooldown_secs: i64) -> Result Result<()> { let (rh, th) = (recipe_hash.to_string(), tip_hash.to_string()); let (epoch, pkgver, pkgrel) = (r.epoch.clone(), r.pkgver.clone(), r.pkgrel.clone()); -- cgit v1.2.3