Skip to content

Commit 4becb46

Browse files
authored
Merge branch 'main' into dependabot/github_actions/actions/checkout-6
2 parents 6e4c6c2 + 688058e commit 4becb46

File tree

74 files changed

+1324
-837
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1324
-837
lines changed

CHANGELOG.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
# [8.40.0](https://github.com/mParticle/mparticle-apple-sdk/compare/v8.39.0...v8.40.0) (2025-10-10)
22

3-
43
### Features
54

6-
* implement trunk tools ([#429](https://github.com/mParticle/mparticle-apple-sdk/issues/429)) ([273bd70](https://github.com/mParticle/mparticle-apple-sdk/commit/273bd703aa46820aa36998f0c4bfd45b20d3fc1b)), closes [#414](https://github.com/mParticle/mparticle-apple-sdk/issues/414) [#417](https://github.com/mParticle/mparticle-apple-sdk/issues/417) [#415](https://github.com/mParticle/mparticle-apple-sdk/issues/415) [#420](https://github.com/mParticle/mparticle-apple-sdk/issues/420)
5+
- implement trunk tools ([#429](https://github.com/mParticle/mparticle-apple-sdk/issues/429)) ([273bd70](https://github.com/mParticle/mparticle-apple-sdk/commit/273bd703aa46820aa36998f0c4bfd45b20d3fc1b)), closes [#414](https://github.com/mParticle/mparticle-apple-sdk/issues/414) [#417](https://github.com/mParticle/mparticle-apple-sdk/issues/417) [#415](https://github.com/mParticle/mparticle-apple-sdk/issues/415) [#420](https://github.com/mParticle/mparticle-apple-sdk/issues/420)
76

87
# [8.39.0](https://github.com/mParticle/mparticle-apple-sdk/compare/v8.38.0...v8.39.0) (2025-09-18)
98

CONTRIBUTING.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ Thanks for contributing! Please read this document to follow our conventions for
2020

2121
### Pull Requests
2222

23-
* Fill in the required template
24-
* Follow the [Swift API Design Guidelines](https://swift.org/documentation/api-design-guidelines/)
25-
* Include screenshots and animated GIFs in your pull request whenever possible
26-
* End all files with a newline
23+
- Fill in the required template
24+
- Follow the [Swift API Design Guidelines](https://swift.org/documentation/api-design-guidelines/)
25+
- Include screenshots and animated GIFs in your pull request whenever possible
26+
- End all files with a newline
2727

2828
### PR Title and Commit Convention
2929

@@ -58,11 +58,13 @@ The following lists the different types allowed in the commit message:
5858
We use XCTest framework for our testing. Please write tests for new code you create. Before submitting your PR, ensure all tests pass by running:
5959

6060
#### Build and Test
61+
6162
```bash
6263
xcodebuild -workspace mParticle-Apple-SDK.xcworkspace -scheme mParticle-Apple-SDK-iOS test
6364
```
6465

6566
#### SwiftLint
67+
6668
```bash
6769
swiftlint
6870
```
@@ -77,14 +79,14 @@ To notify our team about an issue, please submit a ticket through our [mParticle
7779

7880
**When you are creating a ticket, please include as many details as possible:**
7981

80-
* Use a clear and descriptive title
81-
* Describe the exact steps which reproduce the problem
82-
* Provide specific examples to demonstrate the steps
83-
* Describe the behavior you observed after following the steps
84-
* Explain which behavior you expected to see instead and why
85-
* Include console output and stack traces if applicable
86-
* Include your SDK version and iOS/macOS version
82+
- Use a clear and descriptive title
83+
- Describe the exact steps which reproduce the problem
84+
- Provide specific examples to demonstrate the steps
85+
- Describe the behavior you observed after following the steps
86+
- Explain which behavior you expected to see instead and why
87+
- Include console output and stack traces if applicable
88+
- Include your SDK version and iOS/macOS version
8789

8890
## License
8991

90-
By contributing to the mParticle Apple SDK, you agree that your contributions will be licensed under its [Apache License 2.0](LICENSE).
92+
By contributing to the mParticle Apple SDK, you agree that your contributions will be licensed under its [Apache License 2.0](LICENSE).

IntegrationTests/README.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ tuist generate
5252
## Overview
5353

5454
This project provides tools for recording mParticle SDK API requests by:
55+
5556
- Building mParticle SDK as an xcframework for iOS Simulator
5657
- Generating a test iOS app using Tuist that links to the built framework
5758
- Running the app in iOS Simulator
@@ -70,6 +71,7 @@ Records all mParticle SDK API requests using WireMock for later use in integrati
7071
```
7172

7273
**What it does:**
74+
7375
1. Builds mParticle SDK as xcframework for iOS Simulator
7476
2. Generates Tuist project linked to the built framework
7577
3. Builds the integration test application
@@ -84,10 +86,12 @@ Records all mParticle SDK API requests using WireMock for later use in integrati
8486
12. Stops WireMock and shows results
8587

8688
**Recorded Files:**
89+
8790
- `wiremock-recordings/mappings/*.json` - API request/response mappings
8891
- `wiremock-recordings/__files/*` - Response body files
8992

9093
**Build Artifacts:**
94+
9195
- `temp_artifacts/mParticle_Apple_SDK.xcframework` - Compiled SDK framework (auto-generated, not committed to git)
9296

9397
### `sanitize_mapping.py` - Remove API Keys and Rename WireMock Mappings
@@ -102,18 +106,21 @@ python3 sanitize_mapping.py \
102106
```
103107

104108
**What it does:**
109+
105110
- Replaces API keys in URLs with regex pattern `us1-[a-f0-9]+` (matches any mParticle API key)
106111
- Renames mapping file based on test name
107112
- Renames response body file based on test name
108113
- Updates body filename reference in mapping JSON
109114
- Creates clean, sanitized recordings without sensitive information
110115

111116
**Example transformations with `--test-name identify`:**
117+
112118
- URL: `/v2/us1-abc123def456.../events``/v2/us1-[a-f0-9]+/events`
113119
- File: `mapping-v1-us1-abc123-identify.json``mapping-v1-identify.json`
114120
- Body: `body-v1-us1-abc123-identify.json``body-v1-identify.json`
115121

116122
**Example with `--test-name log-event`:**
123+
117124
- URL: `/v2/us1-xyz789.../events``/v2/us1-[a-f0-9]+/events`
118125
- File: `mapping-v2-us1-xyz789-events.json``mapping-v2-log-event.json`
119126
- Body: `body-v2-us1-xyz789-events.json``body-v2-log-event.json`
@@ -179,19 +186,20 @@ If another application is using the ports, terminate it before running the scrip
179186
- Edit `IntegrationTests/Sources/main.swift` to test your new or existing SDK functionality
180187
- Add code to call the specific SDK methods you want to record
181188
- **Best practice:** Temporary comment out calls to unrelated your new code to record only relevant API requests
182-
183189
2. **Run the WireMock recorder:**
190+
184191
```bash
185192
./run_wiremock_recorder.sh
186193
```
194+
187195
The script automatically builds the SDK as an xcframework with your latest changes, runs the app, and records all API traffic
188196

189197
3. **Review and filter recorded mappings:**
190198
- All recordings are saved to `wiremock-recordings/mappings/`
191199
- The script records **all** API requests made during the test run
192200
- **Keep only the mappings related to your new test code**
193201
- Delete any unrelated or duplicate recordings
194-
202+
195203
**Tip:** To get cleaner recordings, modify `main.swift` to call only the specific SDK method you're testing, avoiding unrelated API calls
196204

197205
4. **Verify the recordings:**
@@ -204,39 +212,42 @@ If another application is using the ports, terminate it before running the scrip
204212
After recording, you should sanitize and process mappings to remove sensitive data and handle dynamic values:
205213

206214
1. **Sanitize and rename mapping file:**
215+
207216
```bash
208217
python3 sanitize_mapping.py \
209218
wiremock-recordings/mappings/mapping-v1-us1-abc123-identify.json \
210219
--test-name identify
211220
```
212-
221+
213222
This automatically:
214223
- Replaces API keys in URLs with regex pattern `us1-[a-f0-9]+`
215224
- Renames the mapping file to `mapping-v1-identify.json` (or based on your test name)
216225
- Renames the response body file to `body-v1-identify.json`
217226
- Updates all references in the mapping JSON
218227

219228
2. **Transform request body (replace dynamic fields):**
229+
220230
```bash
221231
# Replace dynamic fields and save
222232
python3 transform_mapping_body.py \
223233
wiremock-recordings/mappings/mapping-v1-identify.json \
224234
unescape+update
225235
```
226-
236+
227237
This replaces dynamic fields (timestamps, IDs, device info) with `${json-unit.ignore}`
228238

229239
3. **Verify the changes:**
240+
230241
```bash
231242
# Check that API keys are replaced with regex pattern
232243
grep "us1-\[a-f0-9\]+" wiremock-recordings/mappings/mapping-v1-identify.json
233-
244+
234245
# Should show the regex pattern us1-[a-f0-9]+
235-
246+
236247
# Verify files were renamed correctly
237248
ls -l wiremock-recordings/mappings/mapping-v1-identify.json
238249
ls -l wiremock-recordings/__files/body-v1-identify.json
239-
250+
240251
# View the transformed request body
241252
wiremock-recordings/mappings/mapping-identify.json
242253
```
@@ -253,6 +264,7 @@ After recording, you should sanitize and process mappings to remove sensitive da
253264
If you need to manually edit the request body:
254265

255266
1. **Edit the request body manually:**
267+
256268
```bash
257269
open wiremock-recordings/mappings/mapping-identify.json
258270
```
@@ -283,4 +295,3 @@ Use the verification script to run full end-to-end integration tests:
283295
8. **Returns exit code:** Exits with code 1 if any verification fails (CI/CD compatible)
284296

285297
**Note:** The SDK xcframework is built fresh on each run, stored in `temp_artifacts/mParticle_Apple_SDK.xcframework`. This ensures tests always use your latest code changes.
286-

IntegrationTests/Sources/main.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ identityRequest.email = "foo@example.com"
440440
identityRequest.customerId = "123456"
441441
options.identifyRequest = identityRequest
442442

443-
options.onIdentifyComplete = { apiResult, error in
443+
options.onIdentifyComplete = { apiResult, _ in
444444
if let apiResult {
445445
apiResult.user.setUserAttribute("example attribute key", value: "example attribute value")
446446
}

0 commit comments

Comments
 (0)