Internals

Rsspot

Read this page when changing runtime behavior, adding API coverage, or debugging cross-layer coupling.

Domain Map

AreaResponsibilityPrimary files
ConfigFile parsing, precedence, schema normalization, migrationconfig/loader.py, config/models.py, config/manager.py
Runtime settingsEnv alias ingestion and fallback valuessettings.py, constants.py
AuthJWT expiry decode + refresh decision logicauth.py
Client surfacesAsync core + unified sync/async wrapper + singleton/context helpersclient/async_client.py, client/sync_client.py, client/singleton.py
TransportRetry, cache, and HTTP request flowhttp/transport.py, http/retry.py, http/cache.py
Persistent statesqlite preferences/cache/history/registration ledgerstate/store.py
ServicesAPI-domain operations + endpoint pathsservices/*.py
ModelsTyped API payload contractsmodels/*.py
Workflow primitivesVM registration orchestration state machine helpersworkflows/registration.py
CLIUser-facing command routing and option validationcli.py
Utility renderersSerialization + output formattingutils/serialization.py, utils/output.py

High-Value Extension Points

  1. New endpoint coverage:
  • add/extend service method under services/
  • add typed model classes under models/
  • add CLI command wrapper when needed
  1. Runtime behavior tuning:
  • retry/cache defaults in config/models.py
  • env aliases in settings.py
  1. Persistence and automation:
  • add new preference keys in StateStore
  • extend registration ledger semantics in workflows/registration.py

Coupling Notes

  • Services depend on AsyncSpotClient._request_json() contract (JSON object expected).
  • SpotClient sync wrappers depend on async coroutines; sync methods cannot run in an active event loop.
  • CLI history recording depends on redaction helpers in cli_history.py and persistence methods in StateStore.
  • Config alias handling relies on pydantic AliasChoices; introducing new keys requires model + docs updates.
  • Auth/token refresh issues: src/rsspot/auth.py, src/rsspot/client/async_client.py
  • Config migration/precedence issues: src/rsspot/config/loader.py, src/rsspot/config/models.py
  • Retry/cache behavior: src/rsspot/http/transport.py, src/rsspot/http/cache.py
  • CLI parsing/history/defaults: src/rsspot/cli.py, src/rsspot/cli_history.py
  • VM registration state transitions: src/rsspot/workflows/registration.py