test: lock iOS source-map skill contract#229
Conversation
🧙 Wizard CIRun 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:
Test all apps in a directory:
Test an individual app:
Show more apps
Results will be posted here when complete. |
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>
| #### 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: |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
Explains to wizard how to handle iOS
Companion PRs