CLI command

skarbiec subscription run

Sign every subscription grant that is due in again through Weles, reached as Stado's browser-automation family; each skarbiec maintain pass does the same.

Invocation#

Shell
skarbiec subscription run [--item <item-id> [--now]]

Purpose#

Sign every subscription grant that is due in again through Weles, reached as Stado's browser-automation family; each skarbiec maintain pass does the same.

Required inputs and options#

  • No input signs in every due grant; --item only that subscription's when it is due; --item with --now that subscription's whatever its standing. POST /v1/operator/subscriptions/run takes item and now. Stado is STADO_BIN, else stado on PATH.

Output and state effects#

  • A grant is due when the item holds none, or a consumer recorded that the provider refused the grant it holds now. For each due one Skarbiec runs `stado capabilities call browser-automation --operation subscription-sign-in --consumer skarbiec --json` with {"provider", "subscription"} (the item's brama:provider: and brama:id: tags) on standard input; Stado runs the alternative that answers the family, Weles's `weles accounts refresh`, which signs the account in on its Stado-selected browser host and stores the grant on the item. The sign-in counts only once the vault holds a newer revision of the item whose grant differs from the one it held when the run chose it; a write that keeps the same grant (a retag, metadata a consumer added) is not a sign-in. Each outcome is written on the subscription's record (last_attempt_at, last_status signed_in, held or retry, last_error, last_run, last_cause the declared cause id it failed for, last_due why the grant was due, and the footing the decision stands on, read from the vault as it is after the attempt) and journalled as subscription-signed-in or subscription-sign-in-failed; the record keeps the last attempt only, and the journal every attempt. A sign-in removes the refusal. A sign-in refused for a cause asking again unchanged will not change is held: it is not asked for again until the refusal, the item's revision, the login item's revision, the tags or what blocks it change, or --now asks for it, so one verdict never opens a browser or pages a person twice, even when Weles wrote the item before it refused. A failure asking again can change leaves the grant due for the next pass. Prints ok, ran (each item, provider, subscription_id, due, cause, status, revision, run, error: due is why the grant was due, cause the declared cause id of a failure) and failed.

Refusals#

  • Every refusal is a declared cause of skarbiec.subscription under /docs/errors. A flag the form does not take exits 2 (flag-unknown), as does --now without --item (now-without-item). --item naming an item that is no live subscription is refused listing the subscriptions (not-subscription). On a replica the run is refused naming the source to run it on. Each sign-in that does not succeed is recorded on its subscription and the run then exits 1 with `signing the due subscriptions in: <count> subscription sign-in(s) did not succeed (<alert>): <items>` (run-refused), the report carrying each one's cause: unsignable (no single brama:provider:, brama:id: or brama:login: tag, a login item that is not a live item or does not open, or a login whose recorded second factor is an authenticator code the vault keeps no seed for (missing-seed) or a seed that computes none (invalid), named before Stado is asked, so no browser starts; held), grant-unreadable (the item does not open with the keys this host holds; left due), stado-absent (no stado on PATH and no STADO_BIN; left due), stado-unstarted (the stado named cannot start; left due), stado-answer-unreadable (stado printed no JSON and no failure envelope, as a Stado older than the subscription-sign-in operation does; left due), sign-in-unavailable (Stado's error_code is infra_down, rate_limit or timeout: no alternative could sign it in now; left due), sign-in-refused (any other error_code: the sign-in ran and was refused, or no alternative is declared here; held), sign-in-unconfirmed (Weles answered the sign-in finished and the item holds no newer revision, or a newer one with no grant, or with the same grant it held before the sign-in; held). Where `alert set` is set the failure is posted there too.