Skip to content

test: lock iOS source-map skill contract#229

Merged
ablaszkiewicz merged 16 commits into
mainfrom
ab/chore/ios-source-maps-contract
Jul 17, 2026
Merged

test: lock iOS source-map skill contract#229
ablaszkiewicz merged 16 commits into
mainfrom
ab/chore/ios-source-maps-contract

Conversation

@ablaszkiewicz

@ablaszkiewicz ablaszkiewicz commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

@github-actions

Copy link
Copy Markdown

🧙 Wizard CI

Run the Wizard CI and test your changes against wizard-workbench example apps by replying with a GitHub comment using one of the following commands:

Test all apps:

  • /wizard-ci all

Test all apps in a directory:

  • /wizard-ci basic-integration
  • /wizard-ci mcp-analytics
  • /wizard-ci revenue

Test an individual app:

  • /wizard-ci basic-integration/android
  • /wizard-ci basic-integration/angular
  • /wizard-ci basic-integration/astro
Show more apps
  • /wizard-ci basic-integration/django
  • /wizard-ci basic-integration/fastapi
  • /wizard-ci basic-integration/flask
  • /wizard-ci basic-integration/javascript-node
  • /wizard-ci basic-integration/javascript-web
  • /wizard-ci basic-integration/laravel
  • /wizard-ci basic-integration/next-js
  • /wizard-ci basic-integration/nuxt
  • /wizard-ci basic-integration/python
  • /wizard-ci basic-integration/rails
  • /wizard-ci basic-integration/react-native
  • /wizard-ci basic-integration/react-router
  • /wizard-ci basic-integration/sveltekit
  • /wizard-ci basic-integration/swift
  • /wizard-ci basic-integration/tanstack-router
  • /wizard-ci basic-integration/tanstack-start
  • /wizard-ci basic-integration/vue
  • /wizard-ci mcp-analytics/custom-dispatcher
  • /wizard-ci mcp-analytics/typescript-sdk
  • /wizard-ci revenue/stripe

Results will be posted here when complete.

ablaszkiewicz and others added 14 commits July 14, 2026 18:27
iOS has no .env at build time, so document how the dSYM-upload credentials
reach the Xcode build. Add an iOS branch to "Make credentials available at
build time": the secret personal API key goes in a gitignored xcconfig
surfaced to the Run Script phase as a build setting, while the non-secret
project id / host are exported in that phase (kept out of xcconfig, where
`//` starts a comment and would truncate the host URL). Lock the contract
with a test on the rendered skill body.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
A live iOS run hallucinated five things the skill left unspecified. Pin
each to its verified form so agents cannot reinvent them:

- Upload via the SDK-bundled upload-symbols.sh (SPM + CocoaPods paths),
  with POSTHOG_INCLUDE_SOURCE=1 — without it traces resolve symbol names
  but show no source code. The script already handles Xcode's minimal
  PATH (nvm/Homebrew/npm), Release gating, min CLI version, and release
  association from build settings.
- The only direct CLI form is `posthog-cli dsym upload --directory`;
  `posthog-cli upload ios` / --api-key / --dsym-path do not exist.
- POSTHOG_CLI_HOST is the API host, never the *.i.posthog.com ingestion
  host from the app's PostHogConfig.
- Required build settings: DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
  (Release) and ENABLE_USER_SCRIPT_SANDBOXING = NO.
- Swift test affordance is PostHogSDK.shared.captureException(error);
  capture(error) does not compile. Release run required to exercise the
  upload.
- CocoaPods: PostHog.xcconfig must `#include?` the Pods xcconfig before
  taking over baseConfigurationReference.

Contract test locks every pin against regression.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…or iOS

Second live run inverted the CocoaPods chaining — a Podfile post_install
injecting `#include? "../../PostHog.xcconfig"` into the generated Pods
xcconfig. Three stacked failures, all silent: the injection only lands
on the next pod install (which never ran), the relative path was one
level short (includes resolve from the including file's directory, so
the project root is ../../../ from Target Support Files/Pods-<Target>/),
and #include? swallows wrong paths. With no key in the build, posthog-cli
fell back to stale ~/.posthog login credentials and failed with
permission_denied instead of "no credentials found".

Pin the correct direction (PostHog.xcconfig owns baseConfigurationReference
and chains the Pods file), the path arithmetic, the showBuildSettings
verification command, the ~/.posthog fallback trap, and REQUIRED language
on POSTHOG_INCLUDE_SOURCE=1 (dropped again this run).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Cut the war-story prose and everything the snippets already show; each
fact now appears once. Drop the skill-body content tests — the original
skill-contract test stays.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Build+run for local testing = Xcode Run in Release; xcodebuild is CI-only.
Note the test captures an event, not a crash, so no debugger-detach or
relaunch steps.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Agents dropped the prefix in two consecutive runs; state that it is part
of the command and name the exact symptom omission causes.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Single gitignored xcconfig carries key + project id + host (host with
  the $() escape); the phase-exports step and its snippet are gone.
- Drop the direct-CLI fallback, the post_install inversion warning, and
  the permission_denied diagnostic — the examples show the one right way.
- Trim run-command and test bullets; scope test-revert to the affordance
  only so credential wiring survives.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…roup

Agents dropped the POSTHOG_INCLUDE_SOURCE=1 command-line prefix three
runs straight — as a build setting in the xcconfig it reaches the script
environment with nothing to copy. Pin the file reference to the project
ROOT group: under the Pods group it resolves to Pods/PostHog.xcconfig,
which kills the base-config chain and the build.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
upload-symbols.sh (posthog-ios) now forwards POSTHOG_DOTENV_FILE to
posthog-cli --dotenv-file, so iOS uses the same .env flow as every other
platform. Drops the xcconfig example, baseConfigurationReference wiring,
and the #include? chaining story.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…itself

The CLI-side env var (PostHog/posthog#71282) passes through every
already-shipped upload-symbols.sh, so no posthog-ios release is needed;
the gate moves to posthog-cli, which the step updates anyway.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The Swift example already pins captureException, and the Release-run /
no-debugger guidance lives in the "Identify the build and run commands"
step and the wizard's own test-done prompt.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@ablaszkiewicz
ablaszkiewicz marked this pull request as ready for review July 15, 2026 18:57
@ablaszkiewicz
ablaszkiewicz requested review from a team as code owners July 15, 2026 18:57

@gewenyu99 gewenyu99 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool

#### Examples
- **Node / tsc** Emit maps with embedded sources by setting both in `tsconfig.json`: `"sourceMap": true` and `"inlineSources": true`. Then run `posthog-cli sourcemap process` against the build output dir as a post-build step — it injects chunk IDs and uploads in one pass, and needs the upload credentials (see "Make credentials available at build time").
- **Vite / Webpack / Rollup** Prefer the bundler plugin from the reference over hand-rolling the CLI — it injects and uploads in one pass. Make sure the bundler is configured to emit source maps.
- **iOS (Xcode)** iOS uploads **dSYM debug symbols**, not source maps. Required target changes:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be time to use variants, I think this will turn to noise and poison your prompts as this list grows.

You can also do this later, it's a larger change.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you pulling in docs at all, you should:

  • have all these tidbits in docs
  • Create variants for each docs page (for each platfomr/framework)
  • Profit?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am using docs and this is all in the docs but I had to add this here explicitly or agent was just lost sometimes

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops one thing is not mentioned in the docs. New env variable for dotenv file for the CLI. But agent got lost at cocoa vs SPM and how to properly set the command.

I had to do TONS of back and forth with experimenting with what to put in the context for the agent to finally understand that

@ablaszkiewicz
ablaszkiewicz merged commit 058bff1 into main Jul 17, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants