Skip to content

Conversation

@bokelley
Copy link
Contributor

Summary

Remove all hardcoded Scope3 domain references and replace with configurable environment variables, making the codebase deployable with any domain. This is a non-breaking change - existing deployments can continue using scope3.com by setting environment variables.

Changes

Core Infrastructure

  • ✅ Created centralized domain_config.py module with 15+ utility functions
  • ✅ Updated 25+ files across core, admin blueprints, and frontend
  • ✅ Replaced 60+ hardcoded domain references

New Environment Variables

Added 4 new configuration options (all optional, with sensible defaults):

  • BASE_DOMAIN (default: example.com)
  • SALES_AGENT_DOMAIN (default: sales-agent.example.com)
  • ADMIN_DOMAIN (default: admin.sales-agent.example.com)
  • SUPER_ADMIN_DOMAIN (default: example.com)

Files Modified

Core Modules:

  • src/core/domain_config.py (NEW)
  • src/core/main.py
  • src/core/schema_validation.py
  • src/a2a_server/adcp_a2a_server.py

Admin Application (13 files):

  • src/admin/app.py
  • src/admin/domain_access.py
  • src/admin/blueprints/auth.py
  • src/admin/blueprints/core.py
  • src/admin/blueprints/public.py
  • src/admin/blueprints/schemas.py
  • src/admin/blueprints/authorized_properties.py
  • src/admin/blueprints/tenants.py

Frontend & Services:

  • src/landing/landing_page.py
  • static/js/tenant_settings.js
  • templates/tenant_settings.html

Configuration:

  • .env.example
  • fly.toml
  • CLAUDE.md

Backwards Compatibility

Fully backwards compatible:

  • Default values work out of the box
  • Existing scope3.com deployments: just set SALES_AGENT_DOMAIN=sales-agent.scope3.com and other domain env vars
  • No database schema changes
  • No API changes

Testing

Unit tests: 840 passed, 42 skipped

  • All Python syntax checks pass
  • All imports work correctly
  • Pre-commit hooks passed (black, ruff)

🧪 Recommended testing before merge:

./run_all_tests.sh ci  # Full test suite with PostgreSQL

Benefits

  1. Vendor Neutral - No Scope3 branding in code
  2. Fully Configurable - Deploy with any domain
  3. Maintainable - Centralized domain logic
  4. Testable - Can use test domains in CI/CD
  5. Documented - Clear environment variable requirements

How to Use

For new deployments:

# Set in .env.secrets
BASE_DOMAIN=yourdomain.com
SALES_AGENT_DOMAIN=sales-agent.yourdomain.com
ADMIN_DOMAIN=admin.sales-agent.yourdomain.com
SUPER_ADMIN_DOMAIN=yourdomain.com

For existing scope3.com deployments:

# Continue using scope3.com domains - just set env vars
BASE_DOMAIN=scope3.com
SALES_AGENT_DOMAIN=sales-agent.scope3.com
ADMIN_DOMAIN=admin.sales-agent.scope3.com
SUPER_ADMIN_DOMAIN=scope3.com

Documentation

  • SCOPE3_REMOVAL_COMPLETE.md - Comprehensive summary with testing checklist
  • SCOPE3_REMOVAL_PROGRESS.md - Detailed implementation notes

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

bokelley and others added 7 commits October 29, 2025 13:20
Remove all hardcoded Scope3 domain references and replace with configurable
environment variables, making the codebase deployable with any domain.

Changes:
- Created centralized domain_config module with 15+ utility functions
- Updated 25+ files across core, admin, and frontend
- Replaced 60+ hardcoded domain references
- Added 4 new environment variables for domain configuration:
  - BASE_DOMAIN
  - SALES_AGENT_DOMAIN
  - ADMIN_DOMAIN
  - SUPER_ADMIN_DOMAIN
- Updated OAuth redirect URIs to use configured domains
- Updated session cookie domain configuration
- Updated A2A and MCP server URL generation
- Updated admin domain access logic (super admin checks)
- Updated JavaScript and HTML templates to use configurable domains
- Applied black and ruff formatting fixes

Benefits:
- Vendor neutral - no Scope3 branding in code
- Fully configurable - deploy with any domain
- Backwards compatible - existing deployments can set scope3.com in env vars
- Centralized domain logic - all in one reusable module
- Testable - can use test domains in CI/CD

Testing:
- All Python syntax checks pass
- All imports work correctly
- Default values tested and working
- Pre-commit hooks passed (black, ruff)
- Ready for full test suite

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
- Add commitizen>=3.29.0 to dev dependency group
- Add [tool.commitizen] configuration section
- Fixes failing commitizen-check workflow in CI
- Enables uv run cz check to validate commit message format
- Changed 'uv sync' to 'uv sync --group dev'
- Ensures commitizen package from dev dependencies is installed
- Fixes 'Failed to spawn: cz' error in CI workflow
- Added 'uv pip install commitizen' step
- Fixes compatibility issue with uv 0.4.18 which doesn't support --group flag
- Ensures commitizen is available for commit message validation
- Changed BASE_DOMAIN default from 'example.com' to 'scope3.com'
- Updated .env.example to reflect scope3.com defaults
- Ensures existing Fly.io deployment works without environment variable changes
- Added documentation about backwards compatibility
- New deployments can override with environment variables
- Documents backwards compatibility approach
- Explains why scope3.com defaults were chosen
- Details current Fly.io configuration
- Outlines future migration path
- Provides rollback plan and risk assessment
- Recommends deployment strategy
- Remove DEPLOYMENT_IMPACT.md (temporary analysis doc)
- Remove SCOPE3_REMOVAL_COMPLETE.md (temporary completion doc)
- Remove SCOPE3_REMOVAL_PROGRESS.md (temporary progress tracking)
- Keep codebase cleaner without extra docs
- Add docs/HOSTING.md with complete deployment instructions
- Cover all required environment variables with examples
- Document Fly.io, Docker, and Kubernetes deployment options
- Include Google OAuth setup, database setup, troubleshooting
- Remove unnecessary SKIP_NGINX and A2A_MOCK_MODE from fly.toml
- Move GCP_PROJECT_ID from fly.toml to secrets (more secure)
- Remove scripts/remove_scope3_deps.py (temporary script)
- Add clear comments about domain configuration in fly.toml
- Merge mypy type annotation improvements across 80+ files
- Update pyproject.toml with latest dependencies
- Sync pre-commit hooks configuration
- Update GitHub Actions test workflow
- Regenerate uv.lock to resolve conflicts
@bokelley bokelley merged commit de503bf into main Oct 30, 2025
19 checks passed
danf-newton pushed a commit to Newton-Research-Inc/salesagent that referenced this pull request Nov 24, 2025
…ntextprotocol#668)

* feat: Remove Scope3 dependencies - make codebase vendor-neutral

Remove all hardcoded Scope3 domain references and replace with configurable
environment variables, making the codebase deployable with any domain.

Changes:
- Created centralized domain_config module with 15+ utility functions
- Updated 25+ files across core, admin, and frontend
- Replaced 60+ hardcoded domain references
- Added 4 new environment variables for domain configuration:
  - BASE_DOMAIN
  - SALES_AGENT_DOMAIN
  - ADMIN_DOMAIN
  - SUPER_ADMIN_DOMAIN
- Updated OAuth redirect URIs to use configured domains
- Updated session cookie domain configuration
- Updated A2A and MCP server URL generation
- Updated admin domain access logic (super admin checks)
- Updated JavaScript and HTML templates to use configurable domains
- Applied black and ruff formatting fixes

Benefits:
- Vendor neutral - no Scope3 branding in code
- Fully configurable - deploy with any domain
- Backwards compatible - existing deployments can set scope3.com in env vars
- Centralized domain logic - all in one reusable module
- Testable - can use test domains in CI/CD

Testing:
- All Python syntax checks pass
- All imports work correctly
- Default values tested and working
- Pre-commit hooks passed (black, ruff)
- Ready for full test suite

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(ci): add commitizen dependency for conventional commits check

- Add commitizen>=3.29.0 to dev dependency group
- Add [tool.commitizen] configuration section
- Fixes failing commitizen-check workflow in CI
- Enables uv run cz check to validate commit message format

* fix(ci): sync dev dependency group in commitizen workflow

- Changed 'uv sync' to 'uv sync --group dev'
- Ensures commitizen package from dev dependencies is installed
- Fixes 'Failed to spawn: cz' error in CI workflow

* fix(ci): explicitly install commitizen in workflow

- Added 'uv pip install commitizen' step
- Fixes compatibility issue with uv 0.4.18 which doesn't support --group flag
- Ensures commitizen is available for commit message validation

* fix: set scope3.com as default domain for backwards compatibility

- Changed BASE_DOMAIN default from 'example.com' to 'scope3.com'
- Updated .env.example to reflect scope3.com defaults
- Ensures existing Fly.io deployment works without environment variable changes
- Added documentation about backwards compatibility
- New deployments can override with environment variables

* docs: add deployment impact analysis for scope3 removal

- Documents backwards compatibility approach
- Explains why scope3.com defaults were chosen
- Details current Fly.io configuration
- Outlines future migration path
- Provides rollback plan and risk assessment
- Recommends deployment strategy

* chore: remove temporary documentation files

- Remove DEPLOYMENT_IMPACT.md (temporary analysis doc)
- Remove SCOPE3_REMOVAL_COMPLETE.md (temporary completion doc)
- Remove SCOPE3_REMOVAL_PROGRESS.md (temporary progress tracking)
- Keep codebase cleaner without extra docs

* docs: add comprehensive hosting guide and clean up fly.toml

- Add docs/HOSTING.md with complete deployment instructions
- Cover all required environment variables with examples
- Document Fly.io, Docker, and Kubernetes deployment options
- Include Google OAuth setup, database setup, troubleshooting
- Remove unnecessary SKIP_NGINX and A2A_MOCK_MODE from fly.toml
- Move GCP_PROJECT_ID from fly.toml to secrets (more secure)
- Remove scripts/remove_scope3_deps.py (temporary script)
- Add clear comments about domain configuration in fly.toml

---------

Co-authored-by: Claude <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.

3 participants