.agents/skills/update_native_rev/SKILL.md
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.
Before beginning the roll, ask the user if the SDK git repository should be switched to the main branch and synchronized.
If they confirm, run:
git checkout main && git pull && gclient sync -D -f
[!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:
DEPS file by following the instructions in the Troubleshooting Sync Failures section (changing third_party/pkg/native under deps to use "https://github.com/dart-lang/native.git" and adding 'github.com' to allowed_hosts in DEPS).gclient sync from the SDK root to update the checkout mapping to GitHub.native package subdirectory: third_party/pkg/native.git fetch origin to fetch the latest commits from the GitHub remote (origin will now point to GitHub).DEPS back 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.native package subdirectory: third_party/pkg/native.git fetch origin to fetch the latest commits from the mirror.origin/main of the native repository:
git log origin/main -n 10 --oneline
origin/main (or the specific one that contains the required change):
git rev-parse origin/main
DEPS file back to the mirrored googlesource URL, removing github.com from allowed_hosts. Do this before updating native_rev so that the final committed change only rolls the commit hash, not checkout hosts.native_rev in the DEPS file (typically under vars):
"native_rev": "<old_sha>", # rolled manually while record_use is experimental
origin/main commit SHA.DEPS host and URL configuration are reverted to the googlesource mirror, leaving only the updated native_rev hash.gclient sync -f from the SDK root directory to update the checkout of the dependencies and regenerate the package configuration using the mirror.If the synchronization fails because of host restrictions:
deps in DEPS to use:
https://github.com/dart-lang/native.git as the git repo.'github.com' to the allowed_hosts list in DEPS.gclient sync -f to complete the update.DEPS file, removing github.com from allowed_hosts and returning to the mirrored googlesource URL, but keep the newly synced native commit hash.Before completing the update, you must run the following tests:
Build the target SDK and run the primary native asset tests:
RBE_exec_strategy=racing 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/
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:
RBE_exec_strategy=racing 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:
[!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.
If the user confirms that the expectations should be updated to match the new behavior:
-DupdateExpectations=true:
RBE_exec_strategy=racing 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
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
Follow these final validation steps before announcing completion:
dart format on all modified Dart files.dart analyze to ensure there are no lint or static analysis issues.git cl presubmit to ensure build/format sanity.front_end directory, regenerate test coverage:
dart --enable-asserts pkg/front_end/test/coverage_suite.dart --tasks=5 --add-and-remove-comments
After all tests pass and formatting/analysis is clean:
YYYYMMDD format (e.g., 20260630) and run:
git new-branch roll-<YYYYMMDD>
git commit -a -m "[deps] Roll dart-lang/native"