Skip to content

Fix Skip TLS doc link and model pricing format#699

Open
braginini wants to merge 1 commit into
mainfrom
fix/point-to-skip-tls-doc
Open

Fix Skip TLS doc link and model pricing format#699
braginini wants to merge 1 commit into
mainfrom
fix/point-to-skip-tls-doc

Conversation

@braginini

@braginini braginini commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Issue ticket number and link

Screenshot 2026-07-02 at 18 19 50 Screenshot 2026-07-02 at 18 20 39

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

https://github.com/netbirdio/docs/pull/__

E2E tests

Optional: override the image tags used by the Playwright e2e workflow.
Defaults to main when omitted.

management-cloud-tag: main
reverse-proxy-tag: main

Summary by CodeRabbit

  • Bug Fixes
    • Improved editing of model pricing fields so values can be typed more smoothly without losing cursor position.
    • Added support for comma-based decimal input while keeping displayed prices consistent.
    • Updated the “Learn more” link in the TLS verification help tooltip to point to the latest documentation.

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR updates the "Skip TLS Verification" tooltip documentation link in AIProviderModal.tsx and converts per-1k input/output price fields from numeric inputs to text inputs with local string state, adding helper functions to convert between numeric and text representations while preserving cursor position during typing.

Changes

AIProviderModal Update

Layer / File(s) Summary
Docs link fix
src/modules/agent-network/AIProviderModal.tsx
Updated the "Skip TLS Verification" tooltip "Learn more" link to a new documentation URL path.
Editable price text inputs
src/modules/agent-network/AIProviderModal.tsx
Added useEffect import; introduced priceToInput/priceFromInput helpers to convert between numeric prices and text; ModelRowEditor now maintains local inputStr/outputStr state synced from parent values, and price fields are text inputs that parse and propagate values on each keystroke.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • netbirdio/dashboard#697: Both PRs modify src/modules/agent-network/AIProviderModal.tsx's Skip TLS Verification and related UI behavior in the same component.

Suggested reviewers: mlsmaycon

Poem

A rabbit typed a price with glee,
No more digits fighting cursor-free,
Commas or dots, it parses right,
A fresher link now shines with light,
Hop, hop, hooray for UI delight! 🐇✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description follows the template, but the issue ticket link is missing and the docs-not-needed choice lacks the required explanation. Add the issue ticket number/link and a brief explanation for why documentation is not needed, or mark docs added and include the docs PR URL.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main changes: the Skip TLS doc link and model pricing formatting.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/point-to-skip-tls-doc

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/modules/agent-network/AIProviderModal.tsx

Oops! Something went wrong! :(

ESLint: 9.39.3

TypeError: Converting circular structure to JSON
--> starting at object with constructor 'Object'
| property 'configs' -> object with constructor 'Object'
| property 'flat' -> object with constructor 'Object'
| ...
| property 'plugins' -> object with constructor 'Object'
--- property 'react' closes the circle
Referenced from: /.eslintrc.json
at JSON.stringify ()
at /node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2255:45
at Array.map ()
at ConfigValidator.formatErrors (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2246:23)
at ConfigValidator.validateConfigSchema (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:2277:84)
at ConfigArrayFactory._normalizeConfigData (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3123:19)
at ConfigArrayFactory._loadConfigData (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3088:21)
at ConfigArrayFactory._loadExtendedShareableConfig (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3393:21)
at ConfigArrayFactory._loadExtends (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3261:25)
at ConfigArrayFactory._normalizeObjectConfigDataBody (/node_modules/@eslint/eslintrc/dist/eslintrc.cjs:3199:25)
(node:2) ESLintRCWarning: You are using an eslintrc configuration file, which is deprecated and support will be removed in v10.0.0. Please migrate to an eslint.config.js file. See https://eslint.org/docs/latest/use/configure/migration-guide for details. An eslintrc configuration file is used because you have the ESLINT_USE_FLAT_CONFIG environment variable set to false. If you want to use an eslint.config.js file, remove the environment variable. If you want to find the location of the eslintrc configuration file, use the --debug flag.
(Use node --trace-warnings ... to show where the warning was created)


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/modules/agent-network/AIProviderModal.tsx (1)

640-648: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Fix the docs anchor. https://docs.netbird.io/agent-network/providers#skip-tls-verification lands on the Providers page, but that section doesn’t exist, so the link is broken.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/modules/agent-network/AIProviderModal.tsx` around lines 640 - 648, The
InlineLink in AIProviderModal points to a broken docs anchor for the “Learn
more” link. Update the href used in the providers section to a valid NetBird
docs anchor or the correct page fragment for skip-TLS verification, keeping the
link target and icon usage unchanged.
🧹 Nitpick comments (1)
src/modules/agent-network/AIProviderModal.tsx (1)

1290-1292: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

Comma-replacement can mis-parse thousands-separated values.

s.replace(/,/g, ".") replaces every comma with a dot, so an input like "1,234.56" becomes "1.234.56", and parseFloat silently truncates it to 1.234 instead of 1234.56. Given per-1k prices are typically small decimals, this is unlikely to bite in practice, so treating this as optional.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/modules/agent-network/AIProviderModal.tsx` around lines 1290 - 1292, The
priceFromInput helper currently replaces every comma with a dot, which can
mis-parse values that use commas as thousands separators. Update priceFromInput
in AIProviderModal.tsx to normalize only the decimal separator or otherwise
safely handle formatted numeric input before parseFloat, so inputs like 1,234.56
are not truncated incorrectly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/modules/agent-network/AIProviderModal.tsx`:
- Around line 1282-1293: The price parsing in priceFromInput allows negative or
malformed values to flow through into onChangeInput and onChangeOutput, which
can produce invalid billing rates. Update priceFromInput in AIProviderModal to
validate the parsed result and clamp it to a non-negative number, returning 0
for invalid input and never allowing a negative price. Keep priceToInput
unchanged, but ensure the handlers that use priceFromInput continue to receive
only safe, non-negative values.

---

Outside diff comments:
In `@src/modules/agent-network/AIProviderModal.tsx`:
- Around line 640-648: The InlineLink in AIProviderModal points to a broken docs
anchor for the “Learn more” link. Update the href used in the providers section
to a valid NetBird docs anchor or the correct page fragment for skip-TLS
verification, keeping the link target and icon usage unchanged.

---

Nitpick comments:
In `@src/modules/agent-network/AIProviderModal.tsx`:
- Around line 1290-1292: The priceFromInput helper currently replaces every
comma with a dot, which can mis-parse values that use commas as thousands
separators. Update priceFromInput in AIProviderModal.tsx to normalize only the
decimal separator or otherwise safely handle formatted numeric input before
parseFloat, so inputs like 1,234.56 are not truncated incorrectly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 26f4e3cc-5b2a-4d76-9c46-a82cd51d053d

📥 Commits

Reviewing files that changed from the base of the PR and between 30dd75d and ff87556.

📒 Files selected for processing (1)
  • src/modules/agent-network/AIProviderModal.tsx

Comment on lines +1282 to +1293
// priceToInput renders a stored price as an editable string, always using "."
// as the decimal separator regardless of the browser locale.
function priceToInput(n: number): string {
return Number.isFinite(n) ? String(n) : "";
}

// priceFromInput parses an operator-typed price, accepting a "," as the decimal
// separator (some keyboards/locales) and normalising it to a plain number.
function priceFromInput(s: string): number {
return parseFloat(s.replace(/,/g, ".")) || 0;
}

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.

🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win

No validation against negative or malformed prices.

priceFromInput accepts any parseable float, including negative values (e.g. "-5"-5), and propagates it straight to onChangeInput/onChangeOutput on every keystroke without clamping. Since these values feed per-1k cost tracking, a stray negative sign could silently produce a negative billing rate.

🛡️ Proposed fix to clamp to non-negative
 function priceFromInput(s: string): number {
-  return parseFloat(s.replace(/,/g, ".")) || 0;
+  const n = parseFloat(s.replace(/,/g, "."));
+  return Number.isFinite(n) && n >= 0 ? n : 0;
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// priceToInput renders a stored price as an editable string, always using "."
// as the decimal separator regardless of the browser locale.
function priceToInput(n: number): string {
return Number.isFinite(n) ? String(n) : "";
}
// priceFromInput parses an operator-typed price, accepting a "," as the decimal
// separator (some keyboards/locales) and normalising it to a plain number.
function priceFromInput(s: string): number {
return parseFloat(s.replace(/,/g, ".")) || 0;
}
// priceToInput renders a stored price as an editable string, always using "."
// as the decimal separator regardless of the browser locale.
function priceToInput(n: number): string {
return Number.isFinite(n) ? String(n) : "";
}
// priceFromInput parses an operator-typed price, accepting a "," as the decimal
// separator (some keyboards/locales) and normalising it to a plain number.
function priceFromInput(s: string): number {
const n = parseFloat(s.replace(/,/g, "."));
return Number.isFinite(n) && n >= 0 ? n : 0;
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/modules/agent-network/AIProviderModal.tsx` around lines 1282 - 1293, The
price parsing in priceFromInput allows negative or malformed values to flow
through into onChangeInput and onChangeOutput, which can produce invalid billing
rates. Update priceFromInput in AIProviderModal to validate the parsed result
and clamp it to a non-negative number, returning 0 for invalid input and never
allowing a negative price. Keep priceToInput unchanged, but ensure the handlers
that use priceFromInput continue to receive only safe, non-negative values.

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.

2 participants