Repository navigation
feat(error-tracking): link Python, Ruby and PHP deploys to releases #416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| --- | ||
| type: link-releases | ||
| flow: error-tracking | ||
| label: Link deploys to releases | ||
| model_pi: openai/gpt-5.6-sol | ||
| effort_pi: medium | ||
| model_sdk: claude-sonnet-5 | ||
| effort_sdk: high | ||
| skills: [] | ||
| allowedTools: [Read, Write, Edit, Glob, Grep, Bash, load_skill_menu, install_skill, detect_package_manager] | ||
| disallowedTools: [enqueue_task] | ||
| dependsOn: [capture-exceptions] | ||
| --- | ||
|
|
||
| ## Goal | ||
|
|
||
| Link every exception this app sends to the production release it came from. | ||
| This platform ships its source as is, so there is nothing to upload. Instead the | ||
| production deploy resolves a PostHog release, and the app starts with that | ||
| release's ID in `POSTHOG_RELEASE_ID`. Install the skill your task input names | ||
| (`install_skill` with the `skillId`) and follow it. It owns the minimum SDK | ||
| version, the CI step per provider, and how the ID crosses each deploy boundary. | ||
|
|
||
| Your task has three parts, in this order: | ||
|
|
||
| 1. **SDK version.** Make sure the project resolves at least the SDK version | ||
| that reads `POSTHOG_RELEASE_ID`, per the skill's "Update the SDK" step. An | ||
| older SDK ignores the variable without an error. Refresh the lock for that | ||
| one package with the project's own tool: call `detect_package_manager` | ||
| first. Do not upgrade across a major version when code from before this run | ||
| already calls the SDK; when the `install` handoff says this run added the | ||
| SDK, raise it straight to the minimum. The production runtime | ||
| decides what can install, not the interpreter on this machine: never lower | ||
| the version below the minimum because a local install fails. | ||
| 2. **Resolve the release in the production deploy.** Trace the deploy path by | ||
| reading the project's own files: CI workflows, Dockerfiles, compose files, | ||
| deploy scripts, service and pool configs. Add the resolve step to the job | ||
| that deploys to production, and to no other job. | ||
| 3. **Get the ID into the running app.** Pass the ID on at every boundary | ||
| between that step and the process that creates the PostHog client, until | ||
| that process starts with `POSTHOG_RELEASE_ID` in its environment. | ||
|
|
||
| ## Local development stays as it is | ||
|
|
||
| This is a deploy-time change only. Local runs, tests, pull-request builds, and | ||
| previews send no release ID, and that is correct. So do not touch run scripts, | ||
| dev servers, test config, `.env`, or `.env.example`. Do not ask for a personal | ||
| API key, because nothing local uses one. Never run `posthog-cli` yourself: a | ||
| resolve creates a real release in the user's project. | ||
|
|
||
| Only edit CI and deploy files that already exist. When this project has no | ||
| deploy path you can open and follow, make no CI changes. Report the task done | ||
| with the SDK update alone, and put the requirement into your handoff as a | ||
| manual follow-up. | ||
|
|
||
| ## The last hop decides it | ||
|
|
||
| A release ID that stops one boundary short of the app looks correct in the | ||
| diff and does nothing. The resolve step succeeds, the deploy is green, and | ||
| every exception still arrives without a release. Each of these boundaries drops | ||
| the value unless you pass it on: a `docker build`, a container start, an SSH | ||
| session, a service manager's environment, PHP-FPM's `clear_env`, and Laravel's | ||
| cached config. So walk the path to its end, and pass the value on the same way | ||
| the deploy already passes the app's other runtime variables. | ||
|
|
||
| While you are at the start step, check the other names on it too. The app's | ||
| PostHog init reads a token and a host, and the start step may predate PostHog. | ||
| If it passes the app's variables by hand and leaves those out, add them by the | ||
| names the app's source reads, and name any secret the user must create. | ||
|
|
||
| ## How you know you succeeded | ||
|
|
||
| The project resolves an SDK version that reads `POSTHOG_RELEASE_ID`, or your | ||
| handoff names the upgrade as a follow-up. The production deploy job resolves | ||
| the release before it ships, without failing the deploy when PostHog cannot be | ||
| reached. The ID reaches the app process as `POSTHOG_RELEASE_ID`, and no local, | ||
| test, or pull-request path changed. Your handoff lists the files you changed, | ||
| the SDK version before and after, the deploy path hop by hop, and every secret | ||
| and variable the user must create, with its exact name and where it goes. | ||
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # Link releases skill β docs-only, one variant per server language that ships readable source | ||
| type: skill | ||
| template: description.md | ||
| description: Link each production deploy to a PostHog Error Tracking release for {display_name} | ||
| tags: [error-tracking, releases] | ||
| shared_docs: | ||
| - https://posthog.com/docs/error-tracking/releases.md | ||
| variants: | ||
| - id: python | ||
| display_name: Python | ||
| tags: [python] | ||
| docs_urls: | ||
| - https://posthog.com/docs/error-tracking/link-releases/python.md | ||
|
|
||
| - id: ruby | ||
| display_name: Ruby | ||
| tags: [ruby] | ||
| docs_urls: | ||
| - https://posthog.com/docs/error-tracking/link-releases/ruby.md | ||
|
|
||
| - id: php | ||
| display_name: PHP | ||
| tags: [php] | ||
| docs_urls: | ||
| - https://posthog.com/docs/error-tracking/link-releases/php.md |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.