Skip to content

Fix software telemetry constant in generated pro URLs#1397

Merged
SteveJonesDev merged 3 commits intodevelopfrom
codex/fix-software-telemetry-constant
Feb 17, 2026
Merged

Fix software telemetry constant in generated pro URLs#1397
SteveJonesDev merged 3 commits intodevelopfrom
codex/fix-software-telemetry-constant

Conversation

@SteveJonesDev
Copy link
Copy Markdown
Member

@SteveJonesDev SteveJonesDev commented Feb 13, 2026

Summary

  • update edac_generate_link_type() to use EDAC_KEY_VALID (with EDACP_VERSION) when setting the software query arg
  • add GenerateLinkTypeTest::test_software_param_uses_edac_key_valid_constant to ensure similarly named constants do not affect telemetry

Testing

  • php -l includes/helper-functions.php
  • php -l tests/phpunit/helper-functions/GenerateLinkTypeTest.php
  • npm run test:php (fails in this environment: Docker socket permission denied)

Risk

  • low: small conditional update in URL generation plus targeted regression test

Summary by CodeRabbit

  • Bug Fixes

    • Improved pro/free classification so the app more reliably recognizes pro status, reducing incorrect pro assignments.
  • Tests

    • Added unit test coverage to validate the version/license detection behavior and prevent regressions.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @SteveJonesDev, 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 addresses an issue where the software telemetry constant in generated pro URLs was incorrectly determined. The change ensures that the software query parameter accurately reflects whether the 'pro' or 'free' version is in use by modifying the conditional logic. A dedicated unit test has also been added to safeguard against similar issues in the future, improving the reliability of telemetry data.

Highlights

  • Telemetry Constant Correction: The edac_generate_link_type() function was updated to correctly use EDAC_KEY_VALID in conjunction with EDACP_VERSION when determining the 'software' query argument for telemetry, ensuring accurate reporting of 'pro' or 'free' versions.
  • New Regression Test Added: A new unit test, GenerateLinkTypeTest::test_software_param_uses_edac_key_valid_constant, was introduced to specifically verify that the correct constant (EDAC_KEY_VALID) is used for the software telemetry parameter, preventing future regressions from similarly named constants.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • includes/helper-functions.php
    • Modified the conditional logic for the 'software' telemetry parameter to correctly check for EDACP_VERSION and EDAC_KEY_VALID.
  • tests/phpunit/helper-functions/GenerateLinkTypeTest.php
    • Added a new unit test test_software_param_uses_edac_key_valid_constant to verify the correct constant is used for software telemetry.
Activity
  • The author updated the edac_generate_link_type() function to use EDAC_KEY_VALID with EDACP_VERSION for the software query argument.
  • A new test GenerateLinkTypeTest::test_software_param_uses_edac_key_valid_constant was added to prevent regressions.
  • Testing was performed by running php -l includes/helper-functions.php and php -l tests/phpunit/helper-functions/GenerateLinkTypeTest.php.
  • The npm run test:php command was attempted but failed due to a Docker socket permission issue.
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.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 13, 2026

Walkthrough

The link-type generation now determines "pro" status by calling edac_is_pro() instead of directly checking the EDACP_KEY_VALID constant. All other defaults, including software_version fallback behavior, remain unchanged. A new PHPUnit test was added for the software parameter behavior.

Changes

Cohort / File(s) Summary
Helper Function Logic Update
includes/helper-functions.php
Replaced direct EDACP_KEY_VALID truthiness check with edac_is_pro() when computing the software value in edac_generate_link_type; version fallback logic unchanged.
Test Coverage
tests/phpunit/helper-functions/GenerateLinkTypeTest.php
Added GenerateLinkTypeTest::test_software_param_uses_edac_key_valid_constant() to validate edac_generate_link_type()'s software query behavior under manipulated constants/environment.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 I checked the keys with a careful hop,
A little test made the doubts all stop,
"Pro" now asks edac_is_pro() first,
Otherwise "free" — modest, not perverse,
I munch a carrot and do a tiny flip.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: fixing how the software telemetry constant (switching from direct constant check to using edac_is_pro() helper) is used in generated pro URLs.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into develop

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/fix-software-telemetry-constant

No actionable comments were generated in the recent review. 🎉


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@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 correctly fixes a bug where an incorrect constant was used for software telemetry in generated URLs. The addition of a targeted unit test is excellent for preventing regressions. I've suggested a small refactoring to improve maintainability by reusing an existing helper function, which avoids duplicating logic.

Comment thread includes/helper-functions.php Outdated
'platform' => 'wordpress',
'platform_version' => $GLOBALS['wp_version'],
'software' => defined( 'EDACP_KEY_VALID' ) && EDACP_KEY_VALID ? 'pro' : 'free',
'software' => defined( 'EDACP_VERSION' ) && defined( 'EDAC_KEY_VALID' ) && EDAC_KEY_VALID ? 'pro' : 'free',
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.

medium

The logic to determine if the software is 'pro' or 'free' is duplicated. The same logic exists in the edac_is_pro() helper function, which is defined later in this file. To improve maintainability and avoid code duplication, please use the existing edac_is_pro() function here.

		'software'         => edac_is_pro() ? 'pro' : 'free',

@SteveJonesDev SteveJonesDev merged commit bd14ba9 into develop Feb 17, 2026
18 checks passed
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.

2 participants