Admin post-weekly command and GoToSocial post interop checks (phase 3, step 10)
CI / validate-monitoring (push) Successful in 8s
CI / lint (push) Successful in 13s
CI / federation-interop (push) Successful in 1m8s
CI / test (push) Successful in 2m56s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 6s

`flask federation post-weekly --user <name> --now` posts a user's
summary for the week still in progress immediately, ignoring the
Monday-09:00 gate - for operators, and so the interop test can produce
a real post without waiting on calendar time. Backed by a new
weekly.post_now(), sharing _post_for_window() with the normal
check_and_post() path so both go through the same has_post/empty-week/
publish logic; only the window (this week so far, vs. the last gated
one) differs.

Extends the GoToSocial interop driver to a second phase: run.sh seeds
one scrobble directly (the driver container has no way to sign a
Last.fm-API request, and doesn't need one just to seed data), triggers
the CLI command via `docker compose exec api`, then re-runs the driver
with --check-posts to confirm the post reaches the already-following
GoToSocial account's home timeline as `private` (followers-only, our
default) with the expected content, deletes it via the existing
DELETE /posts/{id} API, and confirms it disappears from GoToSocial's
timeline too. The main flow now ends by re-following instead of the
previous test's decline, so the post-check phase has a follower to
check against.

Verified end to end against a real GoToSocial 0.22.1 container locally
before pushing (scripts/interop/run.sh), not just left to CI:
    private post: '<p><strong>My week in music: 1 play</strong></p>...'
    All post interop checks passed

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
This commit is contained in:
mattandClaude Sonnet 5 committed 2026-09-26 16:40:34 +01:00
1 parent de1519a066
commit 860d4d0f93
8 files changed
+244 -8

No files matched your search

+63
View File
@@ -165,3 +165,66 @@ def test_deleting_a_weekly_post_works_like_any_other_post(fed_ctx, user, sharing
db.session.commit()
assert activity.activity_type == "Delete"
assert db.session.get(FederationPost, post.id).deleted_at is not None
# --- post_now: for operators (flask federation post-weekly --now) and the interop test ---
# Wednesday of the same week a_scrobble_in_the_target_week plays into (2026-01-06 is the
# Tuesday of ISO week 2026-W02, Jan 5-11), well before that week's own posting gate.
MID_WEEK = datetime(2026, 1, 7, 15, tzinfo=UTC)
def test_post_now_posts_the_week_in_progress(fed_ctx, user, sharing_settings):
a_scrobble_in_the_target_week(user)
outcome = weekly.post_now(user.id, MID_WEEK)
assert outcome == "posted"
[post] = posts_for(user.id)
assert post.key == "weekly:2026-W02"
assert "1 play" in post.content_text
def test_post_now_is_idempotent(fed_ctx, user, sharing_settings):
a_scrobble_in_the_target_week(user)
first = weekly.post_now(user.id, MID_WEEK)
second = weekly.post_now(user.id, MID_WEEK)
assert (first, second) == ("posted", "already_posted")
assert len(posts_for(user.id)) == 1
def test_post_now_skips_an_empty_week(fed_ctx, user, sharing_settings):
assert weekly.post_now(user.id, MID_WEEK) == "skipped_empty"
assert posts_for(user.id) == []
def test_post_now_requires_sharing(fed_ctx, user):
a_scrobble_in_the_target_week(user)
assert weekly.post_now(user.id, MID_WEEK) == "disabled"
def test_post_now_requires_weekly_summaries_on(fed_ctx, user, sharing_settings):
sharing.update(user.id, {"post_weekly_summary": False})
a_scrobble_in_the_target_week(user)
assert weekly.post_now(user.id, MID_WEEK) == "disabled"
def test_post_weekly_cli_command(fed_app, fed_ctx, user, sharing_settings):
played(user, "Radiohead", "Reckoner", datetime.now(UTC))
result = fed_app.test_cli_runner().invoke(
args=["federation", "post-weekly", "--user", "alice", "--now"]
)
assert result.exit_code == 0, result.output
assert "Posted" in result.output
assert len(posts_for(user.id)) == 1
def test_post_weekly_cli_command_requires_the_now_flag(fed_app):
result = fed_app.test_cli_runner().invoke(args=["federation", "post-weekly", "--user", "alice"])
assert result.exit_code != 0
def test_post_weekly_cli_command_rejects_an_unknown_user(fed_app, fed_ctx):
result = fed_app.test_cli_runner().invoke(
args=["federation", "post-weekly", "--user", "nobody", "--now"]
)
assert result.exit_code != 0
assert "No such user" in result.output