Repository navigation
Conversation
The legacy business-context App API routes are being removed. Business
context get/set/clear and the organization chain now go through the v1
Platform API (platform-{us,eu,in}.mixpanel.com/v1). Public Python and CLI
signatures are unchanged.
- Add a platform API family with per-region hosts and platform_request,
sharing a helper with app_request.
- Parse RFC 9457 problem+json errors.
- Clear via DELETE; build the chain from the project's nested
organization_business_context.
- Add updated_at to BusinessContext.
- MP_API_BASE_URL maps to {base}/api/app/v1; MP_APP_BASE_URL also
redirects platform calls to {app_base}/api/app/v1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
[Medium impact] The PR appears safe to merge once the new endpoints are confirmed deployed, as required by the deployment plan.
|
_parse_updated_at now raises from the underlying ValueError so the cause is preserved. MP_API_BASE_URL and MP_APP_BASE_URL docs list the platform family (/api/app/v1) alongside the others. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Maintainer confirmation is needed for production v1 endpoint availability and release ordering because the linked backend PR was inaccessible and live compatibility was not validated.
No open issues 🎉
What changed in this PR
Moves business-context operations from legacy App API routes to the v1 Platform API before the legacy routes are removed, preserving the public Workspace and CLI signatures.
Changes:
- Adds regional Platform API routing, environment overrides, shared request handling, and RFC 9457 error parsing.
- Changes clear to DELETE, builds context chains from one project response, and exposes
BusinessContext.updated_at. - Updates tests and documentation; leaves conformance vectors for a follow-up re-pin.
| File | Description |
|---|---|
| tests/unit/test_workspace_business_context.py | Tests v1 routes, deletion, nested contexts, timestamps, and errors. |
| tests/unit/test_api_base_url_override.py | Tests Platform routing, overrides, and timeouts. |
| tests/unit/test_api_base_url_override_pbt.py | Adds Platform prefixes to routing invariants. |
| tests/pbt/test_business_context_pbt.py | Updates response fixtures and tests single-request deletion. |
| src/mixpanel_headless/workspace.py | Migrates business-context operations and parses timestamps. |
| src/mixpanel_headless/types.py | Adds updated_at and updates result documentation. |
| src/mixpanel_headless/cli/commands/business_context.py | Updates docstrings for clear and chain behavior; no command logic changes. |
| src/mixpanel_headless/_internal/api_client.py | Adds Platform requests, shared transport handling, and v1 operations. |
| mixpanel-plugin/skills/mixpanelyst/references/business-context.md | Documents deletion and timestamps. |
| docs/guide/business-context.md | Updates usage, result fields, and error behavior. |
| docs/getting-started/configuration.md | Documents Platform hosts and environment overrides. |
| docs/cli/index.md | Updates API override descriptions. |
| docs/api/workspace.md | Clarifies deletion in example comments. |
| docs/api/exceptions.md | Updates the server-side oversize status to HTTP 422. |
| CLAUDE.md | Adds Platform routing to environment-variable documentation. |
| CHANGELOG.md | Records the migration and API changes under Unreleased. |
Review effort: Balanced
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
mixpanel/analytics#111709 deletes the legacy business-context App API routes (
mixpanel.com/api/app/{projects|organizations}/{id}/business-context[/chain]). The replacements are the v1 Platform API endpoints, which are already on analytics master. This PR moves the library and CLI onto them so business context keeps working after the old routes are gone.Public Python and CLI signatures are unchanged. Callers of
Workspacebusiness-context methods andmp business-context ...see no difference, apart from one new field (updated_at, below).What changed
platformAPI family. Platform calls go toplatform-{us,eu,in}.mixpanel.com/v1/..., one host per region.platform_requestsits next toapp_requestand both share one request helper, so auth headers, retries and rate-limit handling behave the same.detail/title) are parsed into the existing exception types; the full problem object stays on the exception.DELETEon the v1 endpoint.organization_business_contextfield instead of a dedicated/chainroute.BusinessContext.updated_atis exposed from the v1 response.Environment overrides
MP_API_BASE_URLmaps platform calls to{base}/api/app/v1.MP_APP_BASE_URLalso redirects platform calls, to{app_base}/api/app/v1(the same webapp mount). This keeps users who override the app host sending business-context traffic to the same host as before.Conformance
The conformance vectors are intentionally untouched. Per
conformance/record/README.md, they get re-pinned in a follow-up conformance PR after this is released.Test plan
just check: ruff check, ruff format --check, mypy (402 files, no issues), interrogate (src 100%, conformance 100%, tests 96.1%), full pytest run, anduv build.Deployment plan
🤖 Generated with Claude Code