name: update-native-rev description: Updates the native_rev dependency in the DEPS file with all correct verification, sync, and testing procedures
Instructions
Use this skill when you are requested to roll or update the native_rev variable (the hash of third_party/pkg/native repository) in the DEPS file.
1. Commit Selection Rules
[!IMPORTANT] CRITICAL RULE: NEVER EVER pick a local commit or a commit from a custom branch/PR branch. You MUST only pick remote commits that have already landed on the remote
mainbranch.
To select the correct commit SHA:
- Ask the user if the newest hash/commit should be taken directly from GitHub (e.g., if the googlesource mirror is lagging behind or the desired change is only on GitHub main).
- If the user says YES:
- First, temporarily change the repository URL and host permissions in the
DEPSfile by following the instructions in the Troubleshooting Sync Failures section (changingthird_party/pkg/nativeunderdepsto use"https://github.com/dart-lang/native.git"and adding'github.com'toallowed_hostsinDEPS). - Run
gclient syncfrom the SDK root to update the checkout mapping to GitHub. - Navigate to the
nativepackage subdirectory:third_party/pkg/native. - Run
git fetch originto fetch the latest commits from the GitHub remote (origin will now point to GitHub). - After checking commits, immediately set the repository URL and host permissions in
DEPSback to googlesource (reverting the changes made in sub-step 1), so that subsequent steps and the final commit only roll the commit hash without permanently keeping GitHub host settings.
- First, temporarily change the repository URL and host permissions in the
- If the user says NO / default:
- Proceed with the default mirrored googlesource setup.
- Navigate to the
nativepackage subdirectory:third_party/pkg/native. - Run
git fetch originto fetch the latest commits from the mirror.
- If the user says YES:
- Inspect the commits on remote
origin/mainof thenativerepository:git log origin/main -n 10 --oneline - Obtain the full SHA of the newest commit on remote
origin/main(or the specific one that contains the required change):git rev-parse origin/main - Revert Host to GoogleSource:
- IMPORTANT: If the host was set to GitHub, you MUST now revert the repository URL and allowed hosts changes in the
DEPSfile back to the mirrored googlesource URL, removinggithub.comfromallowed_hosts. Do this before updatingnative_revso that the final committed change only rolls the commit hash, not checkout hosts.
- IMPORTANT: If the host was set to GitHub, you MUST now revert the repository URL and allowed hosts changes in the
2. Updating DEPS and Synchronizing
- Locate
native_revin theDEPSfile (typically undervars):"native_rev": "<old_sha>", # rolled manually while record_use is experimental - Replace the hash with the chosen remote
origin/maincommit SHA. - If not already done in step 4 above, ensure the
DEPShost and URL configuration are reverted to the googlesource mirror, leaving only the updatednative_revhash. - Run
gclient sync -ffrom the SDK root directory to update the checkout of the dependencies and regenerate the package configuration using the mirror.
Troubleshooting Sync Failures
If the synchronization fails because of host restrictions:
- Temporarily modify the repository configuration under
depsinDEPSto use:https://github.com/dart-lang/native.gitas the git repo. - Temporarily add
'github.com'to theallowed_hostslist inDEPS. - Re-run
gclient sync -fto complete the update. - IMPORTANT: Immediately after successful syncing, revert the host and URL changes in the
DEPSfile, removinggithub.comfromallowed_hostsand returning to the mirrored googlesource URL, but keep the newly synced native commit hash.
3. Mandatory Testing and Verification
Before completing the update, you must run the following tests:
Native Assets Package Tests
Build the target SDK and run the primary native asset tests:
tools/build.py -mrelease create_sdk runtime ffi_test_functions runtime_precompiled && tools/test.py -n unittest-asserts-release-mac-arm64 pkg/dartdev/test/native_assets/
Record Use Optimization Tests
Since record_use integrates closely with native_rev updates, these tests must be validated for both backends (Wasm and VM).
- Build the required target backends and run all record use tests:
tools/build.py -mrelease create_sdk dart2wasm runtime ffi_test_functions runtime_precompiled && xcodebuild/ReleaseARM64/dart-sdk/bin/dart pkg/compiler/test/record_use/record_use_test.dart && xcodebuild/ReleaseARM64/dart-sdk/bin/dart pkg/dart2wasm/test/record_use_test.dart && xcodebuild/ReleaseARM64/dart-sdk/bin/dart pkg/vm/test/transformations/record_use_test.dart - Updating Expectations:
If the user confirms that the expectations should be updated to match the new behavior:[!IMPORTANT] If the record_use tests fail, DO NOT update the expectations automatically. You MUST first ask the user for confirmation/permission and clarify if updating expectations is the correct course of action.
- Run the test command with
-DupdateExpectations=true:tools/build.py -mrelease create_sdk dart2wasm runtime ffi_test_functions runtime_precompiled && xcodebuild/ReleaseARM64/dart-sdk/bin/dart pkg/compiler/test/record_use/record_use_test.dart -DupdateExpectations=true && xcodebuild/ReleaseARM64/dart-sdk/bin/dart pkg/dart2wasm/test/record_use_test.dart -DupdateExpectations=true && xcodebuild/ReleaseARM64/dart-sdk/bin/dart pkg/vm/test/transformations/record_use_test.dart -DupdateExpectations=true - Note: Always run the VM test one last when updating expectations. The expect files are stored in the VM directory.
- Run the test command with
- Running Individual Tests:
To debug or verify a single test:
python3 tools/test.py -n wasm-unittest-asserts-mac pkg/dart2wasm/test/record_use_test.dart
4. Pre-Completion Protocol
Follow these final validation steps before announcing completion:
- Format touched files: Run
dart formaton all modified Dart files. - Analyze touched files: Run
dart analyzeto ensure there are no lint or static analysis issues. - Presubmit checks: Run
git cl presubmitto ensure build/format sanity. - Update Coverage (Front-End changes only):
If any related changes were also introduced in the
front_enddirectory, regenerate test coverage:dart --enable-asserts pkg/front_end/test/coverage_suite.dart --tasks=5 --add-and-remove-comments- Critical: Revert the coverage comment changes in any files that you did not otherwise modify.