Skip to content

fix gmail packaging gaps for binary installs (PNX-171)#18

Merged
cjus merged 1 commit into
mainfrom
carlos/solrac-171-gmail-integration-packaging-gaps
May 11, 2026
Merged

fix gmail packaging gaps for binary installs (PNX-171)#18
cjus merged 1 commit into
mainfrom
carlos/solrac-171-gmail-integration-packaging-gaps

Conversation

@cjus
Copy link
Copy Markdown
Owner

@cjus cjus commented May 11, 2026

Summary

Spun out of PNX-168 (Bun packaging). Two gaps surfaced verifying v0.3.0-rc1 on a clean machine:

  • Hardcoded ~/.solrac/gmail/ path ignored SOLRAC_HOME, so operators with a non-default home couldn't use gmail at all.
  • OAuth bootstrap was source-tree-only (scripts/gmail-auth.ts). The curl-pipe binary install ships solrac only — no bun, no scripts — leaving binary-install operators with no way to mint per-account token files.

Why

The integration runtime worked fine in rc1 (deps bundled, self-gates correctly) — only the bootstrap UX and path resolution were broken. This blocks gmail in any non-default deployment and on every curl-pipe install.

Changes

  • ctx.solracHome on IntegrationContext — blessed integrations now resolve paths under $SOLRAC_HOME/integrations/<name>/. Forward-compatible namespace for future blessed integrations (Slack, Linear, etc.).
  • createGmailClientApi(solracHome) factory in src/integrations-builtin/gmail/client.ts replaces module-level path constants. State is per-instance, not module-global.
  • solrac gmail-auth <alias> subcommand (new src/integrations-builtin/gmail/auth-cli.ts) — ships in the compiled binary. Banner prints resolved solracHome + gmailDir. Missing-credentials error links to the specific Google Cloud Console URLs.
  • Pre-loadConfig dispatch in main.ts so subcommands run before env validation — fresh installs can authenticate gmail before configuring the bot.
  • Deleted scripts/gmail-auth.ts — single path through the subcommand.
  • Docs updated: USAGE.md (new flow + pre-PNX-171 migration note), INSTALL.md (CLI subcommands table).

Impact

  • Path layout change: state moves from ~/.solrac/gmail/ to $SOLRAC_HOME/integrations/gmail/. Migration is doc-only (one mv command, no auto-migrate). rc1 is rc — adoption is low.
  • createIntegrationContext() signature change: now takes solracHome: string. Updated all callers (smoke harnesses, tests).
  • scripts/gmail-auth.ts gone: any operator docs/runbooks referencing it need to switch to solrac gmail-auth <alias>.

Test plan

  • npm run typecheck — clean
  • bun test — 722 pass / 0 fail
  • bun test src/integrations-builtin/gmail/client.test.ts — 8 new path-resolution tests pass
  • Manual: bun src/main.ts gmail-auth — usage error
  • Manual: bun src/main.ts gmail-auth "bad alias!" — validation error
  • Manual: SOLRAC_HOME=/tmp/solrac-test bun src/main.ts gmail-auth ieee — banner + GCP URL hint on missing credentials
  • On a binary install: verify solrac gmail-auth <alias> opens browser and writes tokens to $SOLRAC_HOME/integrations/gmail/
  • Pre-existing operators: verify mv ~/.solrac/gmail $SOLRAC_HOME/integrations/gmail followed by restart loads accounts as before

- thread ctx.solracHome through gmail client via createGmailClientApi
  factory; paths root under $SOLRAC_HOME/integrations/gmail/ instead of
  hardcoded ~/.solrac/gmail
- add `solrac gmail-auth <alias>` subcommand so curl-pipe binary
  installs can bootstrap OAuth without a source checkout; banner prints
  resolved home + gmail dir, missing-credentials error links to
  Google Cloud Console
- move scripts/gmail-auth.ts to src/integrations-builtin/gmail/auth-cli.ts
  so it ships in the compiled binary; single path for source + binary
- update USAGE.md with new flow + migration note for pre-PNX-171 layout
@cjus cjus merged commit 055ac1d into main May 11, 2026
1 check passed
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