Skip to content

Add trackingToken to Device request object#1823

Merged
horgh merged 1 commit intomainfrom
greg/eng-4047
Feb 25, 2026
Merged

Add trackingToken to Device request object#1823
horgh merged 1 commit intomainfrom
greg/eng-4047

Conversation

@oschwald
Copy link
Member

Summary

  • Add optional trackingToken field to Device request object for explicit device linking via the Device Tracking Add-on

ENG-4047

Test plan

  • Unit tests pass
  • New field serializes to tracking_token via snakecaseKeys()
  • Backward compatible (field is optional)
  • Lint passes

🤖 Generated with Claude Code

This adds the optional trackingToken field to the Device request
object for explicit device linking via the Device Tracking Add-on.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gemini-code-assist
Copy link

Summary of Changes

Hello @oschwald, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces an enhancement to the "Device" request object by incorporating an optional "trackingToken" field. This addition facilitates explicit device linking, improving the integration with the Device Tracking Add-on. The change is fully backward compatible and includes updated documentation and comprehensive unit tests.

Highlights

  • New Feature: Device Tracking Token: An optional "trackingToken" field has been added to the "Device" request object, enabling explicit device linking via the Device Tracking Add-on.
  • Documentation and Testing: The "CHANGELOG.md" and "README.md" have been updated to reflect the new "trackingToken" field, and a dedicated unit test ensures its correct functionality.
Changelog
  • CHANGELOG.md
    • Added a new entry for version 8.4.0, detailing the introduction of the "/device/tracking_token" input for explicit device linking.
  • README.md
    • Updated the example usage for "minFraud.Device" to include the new "trackingToken" field.
  • src/request/device.spec.ts
    • Added a new unit test to verify that the "trackingToken" property is correctly set on the "Device" object.
  • src/request/device.ts
    • Added the "trackingToken" property to the "DeviceProps" interface, making it an optional field.
    • Implemented the "trackingToken" property within the "Device" class.
Activity
  • Unit tests have been confirmed to pass.
  • The new "trackingToken" field has been verified to serialize correctly to "tracking_token" using snakecaseKeys().
  • The change is backward compatible as the field is optional.
  • Linting checks have passed.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds an optional trackingToken field to the Device request object. The changes are well-implemented across the interface, class, documentation, and example usage. I've provided one suggestion to improve test coverage by adding a test that verifies the serialization of the new field, as this is mentioned in the test plan but not currently covered by the automated tests.

Comment on lines +31 to +37
it('sets trackingToken correctly', () => {
const device = new Device({
ipAddress: '1.1.1.1',
trackingToken: 'abc123',
});
expect(device.trackingToken).toBe('abc123');
});

Choose a reason for hiding this comment

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

medium

The test plan mentions that the new trackingToken field serializes to tracking_token, but this is not covered in the tests. To ensure the serialization works as expected and to prevent future regressions, it would be valuable to add a test case that verifies this behavior. This test would likely involve the Transaction class and could be placed in transaction.spec.ts if that's more appropriate.

Here's an example of what such a test could look like:

import Transaction from '../transaction';

it('serializes device with tracking_token', () => {
  const transaction = new Transaction({
    device: new Device({
      ipAddress: '1.1.1.1',
      trackingToken: 'abc123',
    }),
  });

  const result = JSON.parse(transaction.toString());
  expect(result.device.tracking_token).toBe('abc123');
});

Copy link
Member Author

Choose a reason for hiding this comment

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

AFAICT, this is a pre-existing issue for all the request tests in this library.

@horgh horgh merged commit 677d514 into main Feb 25, 2026
13 checks passed
@horgh horgh deleted the greg/eng-4047 branch February 25, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants