From 4a76e99f876494c7a848f5298ea82a9d7b9d2204 Mon Sep 17 00:00:00 2001 From: kshitijk4poor <82637225+kshitijk4poor@users.noreply.github.com> Date: Thu, 10 Sep 2026 15:24:16 +0530 Subject: [PATCH] docs(cron): drop stale mirror-scope wording left by the home lane - `_target_matches_origin` docstring still claimed fan-out targets are "deliberately NOT mirrored" and mirroring is origin-only; that has been false since origin_fallback landed and is doubly so with the home lane. Point to `_target_mirror_eligible` for the policy instead. - cron.md DM-only bullet said "origin DM session"; the config comment in the same change already says "target DM". Align. - Remove two `_expand_routing_tokens` unit assertions bolted into the eligibility test; the `" ALL , slack "` parametrize covers expansion end-to-end through `_resolve_delivery_targets`. --- cron/scheduler_delivery.py | 6 +++--- tests/cron/test_mirror_origin_fallback.py | 5 ----- website/docs/user-guide/features/cron.md | 4 ++-- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/cron/scheduler_delivery.py b/cron/scheduler_delivery.py index 84532f0552..92f99b4c9e 100644 --- a/cron/scheduler_delivery.py +++ b/cron/scheduler_delivery.py @@ -112,9 +112,9 @@ def _cron_mirror_delivery_enabled(job: dict, cfg: Optional[dict] = None) -> bool def _target_matches_origin(origin: dict, platform_name: str, chat_id: str, thread_id: Optional[str]) -> bool: - """True when a delivery target is the job's own origin conversation. Mirroring is scoped to - the origin session (guaranteed to exist); fan-out targets are broadcasts, deliberately NOT - mirrored. A pinned origin thread_id must match — a target without it is a different lane.""" + """True when a delivery target is the job's own origin conversation. A pinned origin + thread_id must match — a target without it is a different lane. Mirror eligibility for + non-origin targets is decided by ``_target_mirror_eligible``.""" if ( not origin or str(origin.get("platform", "")).lower() != str(platform_name).lower() diff --git a/tests/cron/test_mirror_origin_fallback.py b/tests/cron/test_mirror_origin_fallback.py index ef58a17218..9e3f3dd0af 100644 --- a/tests/cron/test_mirror_origin_fallback.py +++ b/tests/cron/test_mirror_origin_fallback.py @@ -64,11 +64,6 @@ class TestMirrorEligibilityResolution: job = {"deliver": "all", "origin": None} targets = _resolve_delivery_targets(job) assert targets, "home channel should expand from 'all'" - from cron.scheduler_delivery import _expand_routing_tokens - - # Expansion is string-only routing, independent of mirror eligibility. - assert "slack" in _expand_routing_tokens("ALL") - assert _expand_routing_tokens("slack") == ["slack"] for t in targets: assert not _target_mirror_eligible(job, t, global_mirror=True) assert not _target_mirror_eligible( diff --git a/website/docs/user-guide/features/cron.md b/website/docs/user-guide/features/cron.md index cffcf448a6..c20852630d 100644 --- a/website/docs/user-guide/features/cron.md +++ b/website/docs/user-guide/features/cron.md @@ -589,8 +589,8 @@ Behaviour is **thread-preferred**, scoped to the job's own conversation: recurring job (e.g. a daily brief) opens a fresh thread per run, keeping each delivery's follow-up discussion isolated. - **DM-only platforms** (WhatsApp, Signal, SMS): no threads exist, so the brief - is mirrored into the origin DM session instead — the DM itself is the - continuation surface. + is mirrored into the target DM session instead (the origin DM, or the home DM + for fallback and bare-platform jobs) — the DM itself is the continuation surface. Only the job's **own conversation** is ever touched: