Skip to content

Conversation

@ewanharris
Copy link
Member

Description

This removes the process.title check for node and uses process.versions instead, process.title
is not really reliable as it can be set by code, for example some CLIs will rename the process, by using process.versions.node we can be more sure that we're in node, unless we're in a runtime that stubs this.

Looking at the libuv codebase we can see that the uv_get_process_title function has an assertion that the title retrieved is not empty, given that we've only seen this on Windows it's possible there's some permissions issue or similar that is causing this.

References

Closes #219

Review Checklist

  • I have clicked on "allow edits by maintainers".
  • I have added documentation for new/changed functionality in this PR or in a PR to openfga.dev [Provide a link to any relevant PRs in the references section above]
  • The correct base branch is being used, if not main
  • I have added tests to validate that the change in functionality is working as expected

This removes the `process.title` check for node and uses `process.versions` instead, `process.title`
is not really reliable as it can be set by code, for example some CLIs will rename the process,
by using `process.versions.node` we can be more sure that we're in node, unless we're in a runtime
that stubs this.

Looking at the libuv codebase we can see that the `uv_get_process_title`[1] function has an assertion
that the title retrieved is not empty, given that we've only seen this on Windows it's possible there's
some permissions issue or similar that is causing this.

[1] https://github.com/libuv/libuv/blob/47a5c85c4e7c63adc838d8e252fb4859e6cb743d/src/win/util.c#L390-L424

Closes #219
@ewanharris ewanharris requested a review from a team as a code owner April 23, 2025 07:36
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.18%. Comparing base (05c790e) to head (c70cb28).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #222      +/-   ##
==========================================
+ Coverage   88.01%   88.18%   +0.16%     
==========================================
  Files          23       23              
  Lines        1202     1202              
  Branches      211      192      -19     
==========================================
+ Hits         1058     1060       +2     
+ Misses         85       84       -1     
+ Partials       59       58       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rhamzeh
Copy link
Member

rhamzeh commented Apr 23, 2025

Nice investigation!

@ewanharris ewanharris enabled auto-merge April 23, 2025 13:34
@ewanharris ewanharris added this pull request to the merge queue Apr 23, 2025
Merged via the queue into main with commit 170cc2e Apr 23, 2025
17 checks passed
@ewanharris ewanharris deleted the refactor/remove-process-title-usage branch April 23, 2025 13:36
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.

Getting Assertion failed: process_title, file c:\ws\deps\uv\src\win\util.c, line 418 when constructing OpenFgaClient

3 participants