[club-steward] Internal AI intelligence agent for club leadership#9
Conversation
fullharbor
left a comment
There was a problem hiding this comment.
FinancialDataClient must use Supabase, not SQLite
Great work overall — persona, system prompt, and board_report.py are solid. One blocking issue before merge:
FinancialDataClient uses SQLite (lines 157–260)
The class imports sqlite3 and looks for a local .db file (HARBOR_COMMONS_DB). That file does not exist in any deployed environment. See .github/copilot-instructions.md — production database is Supabase.
Fix: use supabase-py
Replace FinancialDataClient with a supabase-py implementation:
from supabase import create_client
class FinancialDataClient:
def __init__(self):
self._db = create_client(os.environ["SUPABASE_URL"], os.environ["SUPABASE_SERVICE_KEY"])
def get_club_financials(self, club_slug, tax_years=3):
ein = KNOWN_CLUB_EINS.get(club_slug)
if not ein: return []
return self._db.table("sailing_filer_core").select("*").eq("ein", ein).order("tax_year", desc=True).limit(tax_years).execute().data
def get_peer_benchmarks(self, club_slug, state="TX", tax_year=None):
q = self._db.table("sailing_filer_core").select("*").eq("state", state).neq("ein", KNOWN_CLUB_EINS.get(club_slug, "")).order("total_revenue", desc=True).limit(10)
if tax_year: q = q.eq("tax_year", tax_year)
return q.execute().dataTables: sailing_filer_core (ein, tax_year, total_revenue, state). Add supabase>=2.0.0 to requirements.txt. Use SUPABASE_SERVICE_KEY (service_role) — Club Steward is internal/premium and needs full access. Everything else LGTM.
fullharbor
left a comment
There was a problem hiding this comment.
FinancialDataClient must use Supabase not SQLite. The class imports sqlite3 and reads from HARBOR_COMMONS_DB (defaults to /tmp/full-harbor/harbor_commons.db). That file does not exist in any deployed environment. Per .github/copilot-instructions.md, the production database is Supabase. Fix: replace FinancialDataClient with supabase-py (from supabase import create_client). Use table sailing_filer_core, columns: ein, tax_year, total_revenue, total_expenses, net_assets, state. Use SUPABASE_SERVICE_KEY for service_role access (Club Steward is internal/premium). Add supabase>=2.0.0 to packages/club-steward/requirements.txt. Everything else is solid: system prompt persona, board_report.py, API shape, tests.
Done in f3fb5a3.
|
Already addressed in f3fb5a3 — |
fullharbor
left a comment
There was a problem hiding this comment.
Column names fixed (address_state, cy_total_revenue_amt). FinancialDataClient correctly uses supabase-py. LGTM — merging.
Co-authored-by: fullharbor <237832340+fullharbor@users.noreply.github.com>
Co-authored-by: fullharbor <237832340+fullharbor@users.noreply.github.com>
Co-authored-by: fullharbor <237832340+fullharbor@users.noreply.github.com>
…SE_SERVICE_KEY Co-authored-by: fullharbor <237832340+fullharbor@users.noreply.github.com>
…enue→cy_total_revenue_amt) sailing_filer_core does not have 'state' or 'total_revenue' columns. Correct names (verified against live Supabase schema): - address_state (not 'state') - cy_total_revenue_amt (not 'total_revenue')
d9b2318 to
8f5cb5e
Compare
packages/club-steward/src/agent/steward.py— ClubStewardAgent with chief-of-staff persona, Supabase financial data access, strict club isolation, lazy OpenAI client, and CLIpackages/club-steward/src/agent/board_report.py— BoardReportGenerator producing structured 1-page board memos; BoardMemo data modelpackages/club-steward/src/api/main.py— FastAPI app with X-API-Key header auth, per-club subscription tokens, 401/403 enforcement, lazy per-club agent cachepackages/club-steward/tests/test_steward.py— 20 unit tests (no API key in CI);no_supabase_envmonkeypatch fixture; 2 integration tests skipped in CIpackages/club-steward/requirements.txt— includessupabase>=2.0.0FinancialDataClientuses Supabase (SUPABASE_URL+SUPABASE_SERVICE_KEY): queriessailing_filer_core; module-level import withImportErrorguard; graceful fallback (warning log) when creds unset; error log on connection failure; all SQLite/db_path code removedapi/main.pydocstring updated to documentSUPABASE_URL/SUPABASE_SERVICE_KEY(removed staleHARBOR_COMMONS_DBreference)--ignore=packages/club-stewardsys.pathbug.gitignoreOriginal prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.