Skip to content

ci: build tfjs-node native addon for firestore-semantic-search and storage-reverse-image-search#1073

Open
cabljac wants to merge 2 commits into
mainfrom
fix/semantic-search-flaky-test
Open

ci: build tfjs-node native addon for firestore-semantic-search and storage-reverse-image-search#1073
cabljac wants to merge 2 commits into
mainfrom
fix/semantic-search-flaky-test

Conversation

@cabljac

@cabljac cabljac commented May 18, 2026

Copy link
Copy Markdown
Collaborator

Problem

The Testing workflow is red on every PR (e.g. observed on #1059). firestore-semantic-search:test fails to even load 5 suites:

The Node.js native addon module (tfjs_binding.node) can not be found at path:
  .../@tensorflow/tfjs-node/lib/napi-v8/tfjs_binding.node
> 17 | require('@tensorflow/tfjs-node');

Root cause

.github/workflows/test.yaml installs dependencies with npm ci --ignore-scripts and lerna bootstrap --ignore-scripts. --ignore-scripts skips the @tensorflow/tfjs-node postinstall, which is what fetches/builds its native addon (tfjs_binding.node) and libtensorflow. Every firestore-semantic-search suite that require('@tensorflow/tfjs-node') then throws at module load, failing lerna run test and the whole workflow. (Earlier green runs were riding a warm node_modules cache that still held the addon.)

This is unrelated to the historically xtest-disabled flaky tests in that extension and unrelated to the genai-chatbot flake fix.

Fix

Add a retried CI step after bootstrap that rebuilds the addon from source for firestore-semantic-search/functions:

npm rebuild @tensorflow/tfjs-node --build-addon-from-source

Building from source (rather than relying on prebuilt binaries that may not cover the CI Node version) is the robust option and is retried 3× to tolerate transient libtensorflow download failures.

cabljac added 2 commits May 18, 2026 13:17
`npm ci --ignore-scripts` and `lerna bootstrap --ignore-scripts` skip the
@tensorflow/tfjs-node postinstall that fetches its native addon
(tfjs_binding.node). Without it every firestore-semantic-search suite that
requires '@tensorflow/tfjs-node' fails to load, reddening the whole test
workflow on every PR.

Add a retried step to rebuild the addon from source after bootstrap.
storage-reverse-image-search/functions has the same @tensorflow/tfjs-node
dependency and fails to load its test suites in CI for the same
--ignore-scripts reason. Generalise the rebuild step to loop over both
affected extensions.
@cabljac cabljac changed the title ci: build tfjs-node native addon for firestore-semantic-search ci: build tfjs-node native addon for firestore-semantic-search and storage-reverse-image-search May 18, 2026

@IzaakGough IzaakGough left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

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.

2 participants