Profile subscription + /management/notify endpoint (closes #77)#83
Merged
Conversation
- Profile.subscription populated from ShardResponse.subscription via from_shard - portal_controller validates /shards/self response as ShardResponse - New POST /management/notify (Traefik-authenticated, shared-secret) broadcasts the given message type via ws_worker; broadcast errors are logged, not raised - conftest /shards/self mock now returns ShardResponse with optional subscription Refs: freeshard#77 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Profile.subscription: ShardSubscriptionSummary | None;Profile.from_shardpopulates it from the shard payload.portal_controller.refresh_profilenow validates/shards/selfasShardResponse(the actual API contract), so subscription data flows through.POST /core/management/notifyendpoint: body{"type": str}, broadcasts viaws_worker.broadcast_message(type). Broadcast errors are logged, not propagated (web-terminal may be disconnected). Returns 204. Auth is the existing/management/*shared-secret forward-auth via Traefik.just get-typessynced: pulls insubscription_model.pyplusShardSubscriptionSummary, expandedVmSizeordering,ShardResponse.subscription, and other minor model drift from controller PRs #248/#249.Recommended reading order
shard_core/data_model/backend/— synced types from controller (foundation, includesShardSubscriptionSummaryandsubscription_model.py).shard_core/data_model/profile.py—Profile.subscription+from_shardchange.shard_core/service/portal_controller.py— validate/shards/selfresponse asShardResponse.shard_core/web/management/notify.py— new endpoint.shard_core/web/management/__init__.py— wire notify router in.tests/conftest.py—_shard_self_response_bodyhelper +subscriptionkwarg onrequests_mock_context.tests/test_profile.py— subscription-present and subscription-absent assertions.tests/test_notify.py— broadcast called with payload, broadcast errors swallowed, missingtype→ 422.Test plan
tests/test_profile.py— subscription present/absenttests/test_notify.py— happy path, error swallowed, 422 on missing fieldtests/test_signed_call.py,tests/test_terminals.py— still green (mock change verified).venv/bin/ruff check .clean/core/management/notifyround-trip (covered by web-terminal upadate freeshard controller types and make startup more robust #20 follow-up)Note:
tests/test_management_endpoint.py::test_install_appfails in this sandbox becausedocker-compose(legacy v1 binary) is not installed; onlydocker composev2 is available. Pre-existing env issue, unrelated to this PR.🤖 Generated with Claude Code