Skip to content

[MOO-2430]: Tighten native-dependency detection so pure-JS widgets aren't flagged - #635

Open
SrirangK wants to merge 4 commits into
mainfrom
moo/MOO-2430/tighten-native-dependency-detection
Open

SrirangK wants to merge 4 commits into
mainfrom
moo/MOO-2430/tighten-native-dependency-detection

Conversation

@SrirangK

Copy link
Copy Markdown
Contributor

Checklist

  • Contains unit tests ✅ ❌
  • Contains breaking changes ✅ ❌
  • Compatible with: MX 8, 9, 10
  • Did you update version and changelog? ✅ ❌
  • PR title properly formatted ([XX-000]: description)? ✅ ❌
  • Works in Android ✅ ❌
  • Works in iOS ✅ ❌
  • Works in Tablet ✅ ❌

Feature specific

  • Comply with designs ✅ ❌
  • Comply with PM's requirements ✅ ❌

Please remove unnecessary emojis and sections and this comment before proceeding

This PR contains

  • Bug fix
  • Feature
  • Refactor
  • Documentation
  • Other (describe)

What is the purpose of this PR?

...

Relevant changes

Please add a high level explanation of what was changed and how the initial problem was solved

What should be covered while testing?

...

Extra comments (optional)

Please add extra comments or delete the section if not required

@SrirangK
SrirangK requested a review from a team as a code owner September 10, 2026 10:34
@SrirangK
SrirangK force-pushed the moo/MOO-2430/tighten-native-dependency-detection branch from 044e845 to 53ecaa5 Compare September 11, 2026 07:52
let previousDeps = {};
try {
const relativePath = join("packages/pluggableWidgets", widget, "package.json");
const previousContent = execSync(`git show HEAD:${relativePath}`, {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In CI the validator compares the working-tree package.json against git show HEAD:<same path>, which is identical, so the new-dependency set is always empty and the gate can never fail.

// Get previous package.json from git (HEAD)
let previousDeps = {};
try {
const relativePath = join("packages/pluggableWidgets", widget, "package.json");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The git object path is built with path.join, which produces backslashes on win32, so git show fails and the empty catch leaves previousDeps as {}, marking every existing dependency as new.

// Skip certain directories
if (
relativePath.match(/[\\/](android|ios|windows|mac|jest|github|gradle|__.*__|docs|example.*)[\\/]/)
relativePath.match(/(^|[\\/])(android|ios|windows|mac|jest|github|gradle|__.*__|docs|example.*)([\\/]|$)/)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The tightened ignore pattern anchors on (^|[\\/])github, which never matches the real directory .github, and both this regex and the hasNativeCode ignore list are case-sensitive.

Comment thread .github/workflows/Build.yml Outdated
- name: "Validating native dependencies"
run: pnpm run validate-native-dependencies
env:
CI_COMMIT_MESSAGE: ${{ github.event.head_commit.message || github.event.pull_request.title }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The hook looks for NATIVE_DEPENDENCY_APPROVED in the commit message file, while CI reads github.event.head_commit.message (last commit of a push only) or github.event.pull_request.title.

Comment thread scripts/validation/validate-native-dependencies.js Outdated
Comment thread scripts/validation/validate-manifest-format.js Outdated
@SrirangK
SrirangK force-pushed the moo/MOO-2430/tighten-native-dependency-detection branch from 1779aee to 0985c33 Compare September 15, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants