docs(#3255): correct the reaper invariant the swarm webhook test guards

The test's doc named knowledge::ensure_webhook as one of two hive-side
reapers. That function is gone; its replacement matches the full URL and
cannot touch another hive's hook.

The assertion arm stays. The hazard is not what this repository's source
says, it is what is deployed — a hive still running the previous version
reaps by suffix until it is upgraded, so the arm guards the transition
rather than a current code path. Recorded when to drop it.
This commit is contained in:
atlas 2026-08-19 19:26:21 +02:00 committed by mara
commit 84125b0806
2 changed files with 27 additions and 21 deletions

View file

@ -483,8 +483,7 @@ pub async fn ensure_all() {
/// existing hooks first and skips creation when one is already targeting the /// existing hooks first and skips creation when one is already targeting the
/// correct URL. /// correct URL.
/// ///
/// `hive_domain` is the public domain name of the hive (e.g. /// `hive_domain` is the public domain name of the hive; the webhook URL is
/// `pr1ma.darkest.space`); the webhook URL is
/// `https://<hive_domain>/webhook/config-pr` (routed through the gateway, /// `https://<hive_domain>/webhook/config-pr` (routed through the gateway,
/// avoiding the Forgejo SSRF guard that blocks loopback delivery). /// avoiding the Forgejo SSRF guard that blocks loopback delivery).
/// ///
@ -495,8 +494,9 @@ pub async fn ensure_all() {
/// An org-level hook covers every repo in `agent-configs` automatically, /// An org-level hook covers every repo in `agent-configs` automatically,
/// so no per-repo setup is needed as new agents are provisioned. /// so no per-repo setup is needed as new agents are provisioned.
/// ///
/// Called at startup alongside `knowledge::ensure_webhook`. No-op when the /// Called at startup beside `knowledge::remove_webhook`, its opposite: that
/// core token is absent (forge not yet provisioned). /// repo's one hook is the controller's now, this one has not moved yet. No-op
/// when the core token is absent (forge not yet provisioned).
/// ///
/// # Errors /// # Errors
/// ///

View file

@ -170,13 +170,14 @@ pub(super) enum DeliveryKind {
/// The route prefix a registered `target_url` must point at. /// The route prefix a registered `target_url` must point at.
/// ///
/// ⚠️ Deliberately **not** `/webhook/knowledge` or `/webhook/config-pr`, the /// ⚠️ Deliberately **not** `/webhook/knowledge` or `/webhook/config-pr`, the
/// paths the per-hive receivers use. Both hive-side registrars delete any /// paths the per-hive receivers use. A hive-side registrar deletes any hook
/// hook whose URL ends with *their* path but has a different base — see /// whose URL ends with *its* path but has a different base — see
/// `hive-c0re`'s `forge::ensure_config_pr_webhook` and /// `hive-c0re`'s `forge::ensure_config_pr_webhook`. A swarm-level hook under
/// `workers::knowledge::ensure_webhook`. A swarm-level hook under those /// such a path would therefore be deleted by every hive on every boot, and
/// paths would therefore be deleted by every hive on every boot, and the /// the symptom is a hook that silently stops existing.
/// symptom is a hook that silently stops existing. `webhook_urls_survive_the_hive_side_reapers` /// `webhook_urls_survive_the_hive_side_reapers` pins that, and its own doc
/// pins that. /// records why `/webhook/knowledge` stays in the check even though the
/// knowledge registrar no longer reaps.
const ROUTE_PREFIX: &str = "/webhook/forge/"; const ROUTE_PREFIX: &str = "/webhook/forge/";
impl DeliveryKind { impl DeliveryKind {
@ -632,17 +633,22 @@ mod tests {
} }
} }
/// A cross-daemon invariant with nothing else to enforce it: both /// A cross-daemon invariant with nothing else to enforce it: a per-hive
/// per-hive registrars in `hive-c0re` **delete** hooks whose URL ends /// registrar in `hive-c0re` **deletes** hooks whose URL ends with its
/// with their own path but carries a different base — see /// own path but carries a different base. A controller URL matching such
/// `forge::ensure_config_pr_webhook` and `knowledge::ensure_webhook`. /// a suffix would be deleted by every hive on every boot — the swarm hook
/// would simply cease to exist, with the cause in a different daemon's
/// startup sweep. Serving these under `/webhook/forge/` is what avoids
/// it, and this is the only place that says so in a form that fails.
/// ///
/// While the swarm-level hooks live alongside the per-hive ones, a /// `forge::ensure_config_pr_webhook` still reaps that way. The knowledge
/// controller URL matching either suffix would be deleted by every hive /// registrar no longer does — it was replaced by a removal that matches
/// on every boot: the swarm hook would simply cease to exist, with the /// the full URL, so it cannot touch another hive's hook. **The
/// cause in a different daemon's startup sweep. Serving these under /// `/webhook/knowledge` arm is kept anyway**, because the hazard is not
/// `/webhook/forge/` is what avoids it, and this is the only place that /// this repository's current code: it is whatever is *deployed*, and a
/// says so in a form that fails. /// hive still running the previous version reaps by suffix until it is
/// upgraded. Drop that arm once no such hive can exist, not when the
/// source stops mentioning it.
#[test] #[test]
fn webhook_urls_survive_the_hive_side_reapers() { fn webhook_urls_survive_the_hive_side_reapers() {
for suffix in ["/webhook/knowledge", "/webhook/config-pr"] { for suffix in ["/webhook/knowledge", "/webhook/config-pr"] {