Skip to content

fix: standardize bond link selection method JSON field naming - #2491

Merged
joseph-henry merged 1 commit into
devfrom
fix/standardize-linkSelectMethod-naming
Jul 29, 2025
Merged

fix: standardize bond link selection method JSON field naming#2491
joseph-henry merged 1 commit into
devfrom
fix/standardize-linkSelectMethod-naming

Conversation

@aaronjohnson

@aaronjohnson aaronjohnson commented Jul 28, 2025

Copy link
Copy Markdown
Contributor

Adds support for "linkSelectMethod" as the JSON configuration field name while maintaining backward compatibility with the legacy "activeReselect" field name.

This change aligns the JSON field name with the internal API naming convention (setLinkSelectMethod/getLinkSelectMethod) and follows the established pattern in the codebase where JSON field names match their corresponding setter method names.

The implementation:

  • Checks for the new field name first, then falls back to the legacy name
  • Emits a deprecation warning when "activeReselect" is used
  • Ensures existing configurations continue to work without modification

Resolves terminology inconsistency identified in docs PR #263

🤖 Generated with Claude Code

Adds support for "linkSelectMethod" as the JSON configuration field name
while maintaining backward compatibility with the legacy "activeReselect"
field name.

This change aligns the JSON field name with the internal API naming
convention (setLinkSelectMethod/getLinkSelectMethod) and follows the
established pattern in the codebase where JSON field names match their
corresponding setter method names.

The implementation:
- Checks for the new field name first, then falls back to the legacy name
- Emits a deprecation warning when "activeReselect" is used
- Ensures existing configurations continue to work without modification

Resolves terminology inconsistency identified in docs PR #263

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR standardizes the JSON field naming for bond link selection method configuration to improve API consistency. The change introduces "linkSelectMethod" as the preferred field name while maintaining backward compatibility with the existing "activeReselect" field.

Key changes:

  • Adds support for "linkSelectMethod" field name with fallback to legacy "activeReselect"
  • Implements deprecation warning for legacy field usage
  • Maintains full backward compatibility for existing configurations

Comment thread service/OneService.cpp
} else {
linkSelectMethodStr = OSUtils::jsonString(customPolicy["activeReselect"], "always");
if (customPolicy.contains("activeReselect")) {
fprintf(stderr, "warning: 'activeReselect' is deprecated, please use 'linkSelectMethod' instead in policy '%s'\n", customPolicyStr.c_str());

Copilot AI Jul 28, 2025

Copy link

Choose a reason for hiding this comment

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

The deprecation warning should use a consistent logging mechanism instead of fprintf(stderr). Consider using the same logging system used elsewhere in the codebase for consistency.

Suggested change
fprintf(stderr, "warning: 'activeReselect' is deprecated, please use 'linkSelectMethod' instead in policy '%s'\n", customPolicyStr.c_str());
OSUtils::log("warning", "'activeReselect' is deprecated, please use 'linkSelectMethod' instead in policy '%s'", customPolicyStr.c_str());

Copilot uses AI. Check for mistakes.
Comment thread service/OneService.cpp
linkSelectMethodStr = OSUtils::jsonString(customPolicy["linkSelectMethod"], "always");
} else {
linkSelectMethodStr = OSUtils::jsonString(customPolicy["activeReselect"], "always");
if (customPolicy.contains("activeReselect")) {

Copilot AI Jul 28, 2025

Copy link

Choose a reason for hiding this comment

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

The check for 'activeReselect' is redundant since OSUtils::jsonString already handles missing keys by returning the default value. The warning will be printed even when the field doesn't exist.

Suggested change
if (customPolicy.contains("activeReselect")) {
if (linkSelectMethodStr != "always") {

Copilot uses AI. Check for mistakes.

@joseph-henry joseph-henry left a comment

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.

This looks great, thanks for syncing this up and fixing it.

@joseph-henry
joseph-henry merged commit a8ead37 into dev Jul 29, 2025
9 checks passed
@adamierymenko
adamierymenko deleted the fix/standardize-linkSelectMethod-naming branch September 11, 2025 17:47
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.

3 participants