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
39 lines
1.4 KiB
Python
39 lines
1.4 KiB
Python
"""Fediverse admin commands (`flask federation ...`)."""
|
|
|
|
import click
|
|
from flask.cli import AppGroup, with_appcontext
|
|
|
|
federation_cli = AppGroup("federation", help="Fediverse admin commands.")
|
|
|
|
|
|
@federation_cli.command("post-weekly")
|
|
@click.option("--user", "username", required=True, help="Username to post for.")
|
|
@click.option(
|
|
"--now",
|
|
"immediately",
|
|
is_flag=True,
|
|
required=True,
|
|
help="Post about the week still in progress right now, ignoring the Monday-09:00 "
|
|
"gate (the only mode this command supports, for operators and testing).",
|
|
)
|
|
@with_appcontext
|
|
def post_weekly(username: str, immediately: bool) -> None:
|
|
"""Post one user's weekly summary immediately."""
|
|
from scrobbler.extensions import db
|
|
from scrobbler.federation.publishing import weekly
|
|
from scrobbler.services import accounts
|
|
|
|
user = accounts.find_user(username)
|
|
if user is None:
|
|
raise click.ClickException(f"No such user: {username}")
|
|
result = weekly.post_now(user.id)
|
|
db.session.commit()
|
|
if result == "posted":
|
|
click.echo(f"Posted a weekly summary for {username}.")
|
|
elif result == "already_posted":
|
|
click.echo(f"{username} already has a post for this week.")
|
|
elif result == "skipped_empty":
|
|
click.echo(f"{username} hasn't scrobbled anything this week.")
|
|
else:
|
|
raise click.ClickException(f"{username} isn't sharing weekly summaries.")
|