Skip to content

fix(tools): include autolinked dependency versions in native fingerprint - #739

Open
serzmerz wants to merge 1 commit into
callstackincubator:mainfrom
serzmerz:fix/fingerprint-autolinked-versions
Open

serzmerz wants to merge 1 commit into
callstackincubator:mainfrom
serzmerz:fix/fingerprint-autolinked-versions

Conversation

@serzmerz

Copy link
Copy Markdown

Summary

nativeFingerprint hashes the autolinking config, but that config carries only package names and paths. Native sources live under node_modules, which the fingerprint does not hash. Upgrading a native dependency therefore leaves the fingerprint unchanged, and the remote cache serves a build compiled from the previous version.

On iOS this is masked because ios/Podfile.lock changes with the dependency and is part of the hashed ios/ folder. Android has no equivalent lockfile under android/, so the stale cache hit goes unnoticed.

This PR adds the installed version of each autolinked dependency (read from its package.json) to the autolinkingSources input. A native dependency bump now changes the fingerprint on every platform. JS-only dependencies are not autolinked, so they still do not affect it.

How we hit it

In a React Native app using Rock 0.12.x we upgraded react-native-view-shot 4.0.3 → 6.1.1. rock fingerprint -p android was identical to main, the CI job reported success after a cache hit, and the downloaded APK still contained the 4.0.3 native code. Over 60 days, seven native dependency bumps merged without touching android/, each reusing a stale Android artifact.

The only config-level workaround is adding yarn.lock to fingerprint.extraSources, which also invalidates the cache for JS-only dependency changes. Paths under node_modules cannot be used in extraSources because gitignored paths are excluded by the hasher.

Changes

  • parseAutolinkingSources reads <dependency root>/package.json and stores version next to root and platforms. A missing or unreadable package.json leaves version undefined, so such a dependency keeps its current behaviour.
  • Test: the fingerprint changes when an autolinked dependency's version changes, and the hashed autolinkingSources input contains relative paths plus the version.
  • Changeset: patch for @rock-js/tools.

Test plan

  • pnpm vitest run packages/tools (13 passed)
  • pnpm --filter @rock-js/tools build (typecheck)
  • prettier --check and eslint on the changed files

🤖 Generated with Claude Code

Autolinking reports only package names and paths, and node_modules is
not hashed, so upgrading a native dependency left the fingerprint
unchanged on Android and the remote cache served a build compiled from
the previous version. iOS was covered only because ios/Podfile.lock is
part of the hashed sources.

Read each autolinked dependency's package.json and add its version to
the autolinkingSources input.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 16, 2026

Copy link
Copy Markdown

@serzmerz is attempting to deploy a commit to the Callstack Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant