Skip to content

feat(discordsh): add GitHub token resolver with ENV and vault fallback#7970

Merged
h0lybyte merged 2 commits intodevfrom
trunk/discordsh-env-config-1773523442
Mar 14, 2026
Merged

feat(discordsh): add GitHub token resolver with ENV and vault fallback#7970
h0lybyte merged 2 commits intodevfrom
trunk/discordsh-env-config-1773523442

Conversation

@h0lybyte
Copy link
Member

Summary

  • Add discord::github::resolve_github_token(guild_id) — resolves a GitHub PAT from env vars (GITHUB_TOKEN, GITHUB_TOKEN_API, GITHUB_TOKEN_PAT) with first non-empty winning, then falls back to Supabase vault lookup by guild ID tag (github_pat:<guild_id>)
  • Add VaultClient::get_secret_by_tag() to the kbve crate for tag-based secret retrieval via the vault-reader Edge Function
  • 5 unit tests for the resolver (env priority, skip empty, fallback chain, no-guild, no-vault)
  • 1 new test for vault tag request serialization

Test plan

  • cargo test -p axum-discordsh -- discord::github (5/5 pass)
  • cargo test -p kbve (16/16 pass)
  • Integration test with real Supabase vault (requires github_pat:<guild_id> secret in vault)

Resolve GitHub PAT via env vars (GITHUB_TOKEN, GITHUB_TOKEN_API,
GITHUB_TOKEN_PAT) with first non-empty value winning. Falls back to
Supabase vault lookup by guild ID tag when no env var is set.

Also adds get_secret_by_tag() to VaultClient for tag-based secret
retrieval from the vault-reader Edge Function.
@github-actions
Copy link
Contributor

github-actions bot commented Mar 14, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

The rage_draught_used_then_attack_deals_bonus test panicked ~5% of
the time because the level-1 enemy had a 20% chance to roll Flee as
its next intent after each turn, removing itself from session.enemies.
The test then accessed enemies[0] unconditionally.

Fix: pin initial enemy intent to Defend (avoids side effects from
the UseItem turn) and guard the post-attack assert against the enemy
having fled.
@h0lybyte h0lybyte merged commit 491f375 into dev Mar 14, 2026
5 checks passed
@h0lybyte h0lybyte deleted the trunk/discordsh-env-config-1773523442 branch March 14, 2026 21:54
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.

1 participant