Skip to content

fix: tracksAssignment: false and tracksExposure: false in FetchOptions silently ignored#79

Open
Copilot wants to merge 3 commits intomainfrom
copilot/fix-tracking-options-ignored
Open

fix: tracksAssignment: false and tracksExposure: false in FetchOptions silently ignored#79
Copilot wants to merge 3 commits intomainfrom
copilot/fix-tracking-options-ignored

Conversation

Copy link

Copilot AI commented Mar 23, 2026

tracksAssignment: false and tracksExposure: false in FetchOptions were silently ignored in doFetch due to truthy guards — false values never produced 'no-track' in the outgoing evaluation API request.

Changes

  • packages/node/src/remote/client.ts: Replace truthy checks with !== undefined && !== null guards so explicit false correctly maps to 'no-track':
// Before — false is falsy, condition never entered, no-track never sent
if (options?.tracksAssignment) { ... }

// After — only skips when option is absent (undefined/null)
if (options?.tracksAssignment !== undefined && options?.tracksAssignment !== null) { ... }
  • packages/node/test/remote/client.test.ts: Add test case asserting tracksAssignment: false / tracksExposure: false produces trackingOption: 'no-track' / exposureTrackingOption: 'no-track' in the API call.

Checklist

  • Does your PR title have the correct title format?
  • Does your PR have a breaking change?: No

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • api.lab.amplitude.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node node ./node_modules/.bin/jest packages/node/test/remote/client.test.ts (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>[Bug] tracksAssignment: false and tracksExposure: false in FetchOptions are silently ignored</issue_title>
<issue_description>## Expected Behavior

When tracksAssignment: false or tracksExposure: false is explicitly passed in FetchOptions, the SDK should include trackingOption: 'no-track' / exposureTrackingOption: 'no-track' in the evaluation API request, effectively opting out of tracking for that specific fetch call.

Current Behavior

Explicitly passing tracksAssignment: false or tracksExposure: false has no effect — the tracking options are silently omitted from the request entirely, as if the options were never provided. This makes it impossible to explicitly disable tracking on a per-request basis.

Possible Solution

The condition guards in doFetch use truthy checks instead of !== undefined:

// Current (broken) — false values are ignored entirely
if (options?.tracksAssignment) { ... }
if (options?.tracksExposure) { ... }

Should be:

// Fixed — only skip when the option was not provided at all
if (options?.tracksAssignment !== undefined) { ... }
if (options?.tracksExposure !== undefined) { ... }

Steps to Reproduce

  1. Initialize RemoteEvaluationClient with a valid API key
  2. Call fetchV2(user, { tracksAssignment: false }) or fetchV2(user, { tracksExposure: false })
  3. Inspect the outgoing request payload
  4. Observe that trackingOption / exposureTrackingOption is absent — assignment/exposure events are still tracked despite the explicit opt-out

Environment

  • JS Server SDK Version: any
  • Installation Method: Yarn
  • Node.js Version: any</issue_description>

<agent_instructions>Implement the suggestions in doFetch but also add null checks:
if (options?.tracksAssignment !== undefined || options?.tracksAssignment !== null) { ... }
if (options?.tracksExposure !== undefined || options?.tracksExposure !== null) { ... }</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@zhukaihan Thanks for raising this issue. The ultimate effect of the bug is that `tracksAssignment: false` is getting ignored, although the code path shows ignorance on falsy / undefined fields. We'll fix this asap.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Fix tracking options ignored in FetchOptions fix: tracksAssignment: false and tracksExposure: false in FetchOptions silently ignored Mar 23, 2026
Copilot AI requested a review from zhukaihan March 23, 2026 19:04
@zhukaihan zhukaihan marked this pull request as ready for review March 23, 2026 19:07
@zhukaihan
Copy link
Collaborator

@copilot Fix lint errors.

Copy link
Author

Copilot AI commented Mar 23, 2026

@zhukaihan The model claude-sonnet-4.6 is not available for your account. This can happen if the model was disabled by your organization's policy or if your Copilot plan doesn't include access to it.

You can try again without specifying a model (just @copilot) to use the default, or choose a different model from the model picker.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: adcb7f60-c4cc-41f5-8446-3d068b0e35b8

5 similar comments
Copy link
Author

Copilot AI commented Mar 23, 2026

@zhukaihan The model claude-sonnet-4.6 is not available for your account. This can happen if the model was disabled by your organization's policy or if your Copilot plan doesn't include access to it.

You can try again without specifying a model (just @copilot) to use the default, or choose a different model from the model picker.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: adcb7f60-c4cc-41f5-8446-3d068b0e35b8

Copy link
Author

Copilot AI commented Mar 23, 2026

@zhukaihan The model claude-sonnet-4.6 is not available for your account. This can happen if the model was disabled by your organization's policy or if your Copilot plan doesn't include access to it.

You can try again without specifying a model (just @copilot) to use the default, or choose a different model from the model picker.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: adcb7f60-c4cc-41f5-8446-3d068b0e35b8

Copy link
Author

Copilot AI commented Mar 23, 2026

@zhukaihan The model claude-sonnet-4.6 is not available for your account. This can happen if the model was disabled by your organization's policy or if your Copilot plan doesn't include access to it.

You can try again without specifying a model (just @copilot) to use the default, or choose a different model from the model picker.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: adcb7f60-c4cc-41f5-8446-3d068b0e35b8

Copy link
Author

Copilot AI commented Mar 23, 2026

@zhukaihan The model claude-sonnet-4.6 is not available for your account. This can happen if the model was disabled by your organization's policy or if your Copilot plan doesn't include access to it.

You can try again without specifying a model (just @copilot) to use the default, or choose a different model from the model picker.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: adcb7f60-c4cc-41f5-8446-3d068b0e35b8

Copy link
Author

Copilot AI commented Mar 23, 2026

@zhukaihan The model claude-sonnet-4.6 is not available for your account. This can happen if the model was disabled by your organization's policy or if your Copilot plan doesn't include access to it.

You can try again without specifying a model (just @copilot) to use the default, or choose a different model from the model picker.

If you want to contact GitHub about this error, please mention the following identifier so they can better serve you: adcb7f60-c4cc-41f5-8446-3d068b0e35b8

@zhukaihan zhukaihan requested a review from a team March 23, 2026 19:29
Comment on lines +122 to +123
trackingOption: 'no-track',
exposureTrackingOption: 'no-track',
Copy link
Collaborator

Choose a reason for hiding this comment

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

We already have tests for truthy cases.

@kyeh-amp kyeh-amp requested a review from a team March 23, 2026 21:50
Copy link
Collaborator

@kyeh-amp kyeh-amp left a comment

Choose a reason for hiding this comment

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

Classic.

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.

[Bug] tracksAssignment: false and tracksExposure: false in FetchOptions are silently ignored

3 participants