Skip to content

Support multiple Starling accounts linked to a single developer account#42

Open
open-dave wants to merge 4 commits into
masterfrom
pipeline/issue-39
Open

Support multiple Starling accounts linked to a single developer account#42
open-dave wants to merge 4 commits into
masterfrom
pipeline/issue-39

Conversation

@open-dave

Copy link
Copy Markdown
Collaborator

What changed

Starling now lets one developer token access several linked accounts (Personal/Joint/Business). The pipeline previously took only get_accounts()[0] per token and derived the index/sheet label from the env-var key, silently dropping every other account.

  • variables.py — adds token_sources() (yields every configured token that's present, including a new single STARLING_ACCESS_TOKEN with a None source key) and resolve_labels(), which maps every account a token exposes to a stable, unique slug (nameaccountTypeaccountUid, collisions disambiguated by uid). A legacy per-type token holding a single account keeps its env-key label so existing indices/sheets are reused.
  • starling_to_elastic.py / starling_to_sheets.py — iterate over every token and every account it returns, building the index/sheet label from the account rather than the env key.
  • Workflows — pass through the new STARLING_ACCESS_TOKEN secret.
  • Tests — new tests/test_variables.py for label/token resolution, a multi-account get_accounts() case, and test_balance_integration.py parametrised over all accounts per token.
  • Docsforking-instructions.md documents the single-token option.

Review findings addressed

CI only ran tests/test_starling.py, so the new tests/test_variables.py covering the core resolve_labels/token_sources logic never executed. Pointed the workflow at tests/ (integration tests self-skip without live tokens). Verified the whole suite passes (12 passed, 2 skipped). The rest of the implementation matched the plan — backward-compatible per-type labels, collision handling, and no dropped accounts.

Closes #39

🤖 Generated with Claude Code

open-dave and others added 4 commits July 4, 2026 08:52
Stop discarding all but the first account returned by get_accounts(). Iterate
over every linked account per token so a single STARLING_ACCESS_TOKEN covering
Personal, Joint and Business accounts is fully ingested, deriving each index and
sheet label from the account rather than the env-var key. Per-type tokens keep
their existing labels for backward compatibility.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Cover get_accounts() returning several accounts, the token/label helpers, and
parametrise the balance integration fixture over every account per token.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Pass the single-token secret into both populate workflows and describe the
single-token option in the forking instructions.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The new tests/test_variables.py covering resolve_labels/token_sources
was never exercised by CI, which only ran tests/test_starling.py. Point
it at tests/ so the multi-account label logic is actually verified;
integration tests self-skip without live tokens.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support multiple Starling accounts linked to a single developer account

1 participant