feat(6254): moment_usage says which rule each moment delivered, and whether it was opened
CI & Build / Python lint (push) Successful in 2s
CI & Build / Plugin hooks (push) Successful in 12s
CI & Build / TypeScript typecheck (push) Successful in 52s
CI & Build / integration (push) Successful in 1m5s
CI & Build / Python tests (push) Successful in 1m57s
CI & Build / Build & push image (push) Successful in 33s
CI & Build / Python lint (push) Successful in 2s
CI & Build / Plugin hooks (push) Successful in 12s
CI & Build / TypeScript typecheck (push) Successful in 52s
CI & Build / integration (push) Successful in 1m5s
CI & Build / Python tests (push) Successful in 1m57s
CI & Build / Build & push image (push) Successful in 33s
Each moment gains by_rule: {rule_id, title, delivered, opened}, read from
the (moment, rule) grouping the readout already did. The moment's totals are
now summed from those rows, so the two cannot disagree. The Moments settings
page shows the list under each moment, closed by default.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -238,9 +238,10 @@ async def test_the_delivery_lookup_answers_by_home(world):
|
||||
|
||||
|
||||
async def test_moment_usage_counts_deliveries_and_the_agent_opens_that_followed(world):
|
||||
"""The per-moment readout, on real SQL: an EXISTS inside a
|
||||
COUNT(CASE …) is a shape no mock can vouch for, and the block's own guard
|
||||
would turn a database refusal into a quiet `moment_usage_failed`."""
|
||||
"""The per-moment readout, on real SQL: a correlated EXISTS selected as a
|
||||
column beside an outer join is a shape no mock can vouch for, and the
|
||||
block's own guard would turn a database refusal into a quiet
|
||||
`moment_usage_failed`."""
|
||||
from datetime import datetime, timedelta, timezone
|
||||
|
||||
from sqlalchemy import delete
|
||||
@@ -289,3 +290,13 @@ async def test_moment_usage_counts_deliveries_and_the_agent_opens_that_followed(
|
||||
report = block["by_moment"]["reply.report"]
|
||||
assert (report["delivered"], report["rules"], report["opened"]) == (1, 1, 0)
|
||||
assert report["last_delivered_at"]
|
||||
|
||||
# Two rules share work.finish: which one arrived, and which was opened.
|
||||
assert finish["by_rule"] == [
|
||||
{"rule_id": rule.id, "title": rule.title, "delivered": 2, "opened": True},
|
||||
{"rule_id": other.id, "title": "Close the task with the push",
|
||||
"delivered": 1, "opened": False},
|
||||
]
|
||||
assert report["by_rule"] == [
|
||||
{"rule_id": rule.id, "title": rule.title, "delivered": 1, "opened": False},
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user