Now-playing interop check (phase 4, step 7)
CI / validate-monitoring (push) Successful in 9s
CI / lint (push) Successful in 13s
CI / federation-interop (push) Successful in 1m37s
CI / test (push) Successful in 3m33s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 5s
CI / validate-monitoring (push) Successful in 9s
CI / lint (push) Successful in 13s
CI / federation-interop (push) Successful in 1m37s
CI / test (push) Successful in 3m33s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 5s
Extends the GoToSocial driver's second phase: run.sh seeds a
now-playing track alongside the scrobble it already seeds for the
weekly summary; the driver turns now_playing_mode on via the settings
API, then polls GoToSocial's own stored copy of the account (not a
fresh resolve() fetch) for a "Now playing" field, confirming the
periodic Update(Person) push actually reached and updated their cache
- not just that we sent something.
Verified against a real GoToSocial 0.22.1 container locally before
pushing:
Now playing: 'Interop Now Playing by Interop Artist'
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:
1 parent
f3d2b5d578
commit
9883111fa1
2 files changed
+29
-2
No files matched your search
@@ -261,6 +261,15 @@ class GoToSocial:
|
|||||||
fail(f"home timeline: {status} {body}")
|
fail(f"home timeline: {status} {body}")
|
||||||
return body
|
return body
|
||||||
|
|
||||||
|
def account(self, account_id):
|
||||||
|
"""The account as GoToSocial currently has it stored - not a fresh remote fetch
|
||||||
|
like resolve()'s ?resolve=true search, so this shows whether a proactive
|
||||||
|
Update(Person) actually reached and updated their cached copy."""
|
||||||
|
status, body = api("GET", f"{GTS}/api/v1/accounts/{account_id}", self.token)
|
||||||
|
if status != 200:
|
||||||
|
fail(f"account lookup: {status} {body}")
|
||||||
|
return body
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
step("Getting a GoToSocial access token")
|
step("Getting a GoToSocial access token")
|
||||||
@@ -372,7 +381,8 @@ def check_posts():
|
|||||||
--now` directly in the api container (this container has no docker access to do that
|
--now` directly in the api container (this container has no docker access to do that
|
||||||
itself). Checks the post reaches the already-following GoToSocial account's home
|
itself). Checks the post reaches the already-following GoToSocial account's home
|
||||||
timeline as a private (followers-only) status with the expected text, then deletes
|
timeline as a private (followers-only) status with the expected text, then deletes
|
||||||
it and checks it disappears there too."""
|
it and checks it disappears there too. Also turns now playing on and checks the
|
||||||
|
profile field GoToSocial has cached is updated by the periodic push."""
|
||||||
step("Getting a GoToSocial access token")
|
step("Getting a GoToSocial access token")
|
||||||
gts = GoToSocial(gotosocial_token())
|
gts = GoToSocial(gotosocial_token())
|
||||||
alice = Scrobbler() # register-or-login: the same account main() set up
|
alice = Scrobbler() # register-or-login: the same account main() set up
|
||||||
@@ -381,6 +391,9 @@ def check_posts():
|
|||||||
if not gts.relationship(account_id)["following"]:
|
if not gts.relationship(account_id)["following"]:
|
||||||
fail("GoToSocial isn't following alice; run the main interop flow first")
|
fail("GoToSocial isn't following alice; run the main interop flow first")
|
||||||
|
|
||||||
|
step("Alice turns now playing on (run.sh already seeded a now-playing track)")
|
||||||
|
alice.settings(now_playing_mode="profile")
|
||||||
|
|
||||||
step("The weekly summary reaches GoToSocial's home timeline")
|
step("The weekly summary reaches GoToSocial's home timeline")
|
||||||
posted = wait_for(
|
posted = wait_for(
|
||||||
"the weekly summary in GoToSocial's home timeline",
|
"the weekly summary in GoToSocial's home timeline",
|
||||||
@@ -405,6 +418,18 @@ def check_posts():
|
|||||||
lambda: not any(s["id"] == posted["id"] for s in gts.home_timeline()),
|
lambda: not any(s["id"] == posted["id"] for s in gts.home_timeline()),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
step("The now-playing field reaches GoToSocial's cached copy of the profile")
|
||||||
|
field = wait_for(
|
||||||
|
"a Now playing field on GoToSocial's cached account",
|
||||||
|
lambda: next(
|
||||||
|
(f for f in gts.account(account_id)["fields"] if f["name"] == "Now playing"), None
|
||||||
|
),
|
||||||
|
timeout=90, # the push is throttled and only checked every 30s
|
||||||
|
)
|
||||||
|
if "Interop Now Playing" not in field["value"]:
|
||||||
|
fail(f"unexpected now-playing field: {field['value']!r}")
|
||||||
|
print(f" Now playing: {field['value']!r}")
|
||||||
|
|
||||||
step("All post interop checks passed")
|
step("All post interop checks passed")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -42,19 +42,21 @@ if [ $status -ne 0 ]; then
|
|||||||
exit $status
|
exit $status
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "==> Alice scrobbles something, for the weekly summary to have content"
|
echo "==> Alice scrobbles something, for the weekly summary to have content, and is playing something now"
|
||||||
"$compose" exec -T api python3 -c "
|
"$compose" exec -T api python3 -c "
|
||||||
from datetime import UTC, datetime
|
from datetime import UTC, datetime
|
||||||
from scrobbler import create_app
|
from scrobbler import create_app
|
||||||
from scrobbler.config import Config
|
from scrobbler.config import Config
|
||||||
from scrobbler.extensions import db
|
from scrobbler.extensions import db
|
||||||
from scrobbler.models import Scrobble, User
|
from scrobbler.models import Scrobble, User
|
||||||
|
from scrobbler.services.scrobbles import TrackInput, update_now_playing
|
||||||
|
|
||||||
app = create_app(Config)
|
app = create_app(Config)
|
||||||
with app.app_context():
|
with app.app_context():
|
||||||
user = db.session.scalar(db.select(User).filter_by(username='alice'))
|
user = db.session.scalar(db.select(User).filter_by(username='alice'))
|
||||||
db.session.add(Scrobble(user_id=user.id, artist='Interop Artist', track='Interop Track', played_at=datetime.now(UTC)))
|
db.session.add(Scrobble(user_id=user.id, artist='Interop Artist', track='Interop Track', played_at=datetime.now(UTC)))
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
update_now_playing(user, TrackInput(artist='Interop Artist', track='Interop Now Playing'))
|
||||||
"
|
"
|
||||||
|
|
||||||
echo "==> Posting alice's weekly summary immediately"
|
echo "==> Posting alice's weekly summary immediately"
|
||||||
|
|||||||
Reference in new issue
Block a user