Skip to content

Conversation

@pierredup
Copy link
Member

Fixes #1994

@pierredup pierredup added this to the 2.3.9 milestone Oct 18, 2025
@pierredup pierredup self-assigned this Oct 18, 2025
@pierredup pierredup added the bug label Oct 18, 2025
@solidinvoice-bot
Copy link

solidinvoice-bot bot commented Oct 18, 2025

The preview deployment failed. 🔴

Open Build Logs

Last updated at: 2025-10-18 14:22:39 CET

@pierredup pierredup changed the base branch from 2.4.x to 2.3.x October 18, 2025 14:22
@pierredup pierredup merged commit 462ccf9 into 2.3.x Oct 18, 2025
1 check was pending
@pierredup pierredup deleted the SolidInvoice-1994 branch October 18, 2025 14:23
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 18, 2025

Caution

Review failed

Failed to post review comments

Walkthrough

Updates project version to 2.3.8, adds symfony/html-sanitizer dependency, applies HTML sanitization to form fields in Client, Contact, Item, and Tax bundles, adds currency code validation, refactors API token repository query logic, modifies grid cell rendering filter, and allows null values for Client name.

Changes

Cohort / File(s) Summary
Version updates
composer.json, package.json, src/CoreBundle/SolidInvoiceCoreBundle.php
Bumps project version from 2.3.7 to 2.3.8 across configuration files and bundle constant.
Dependency additions
composer.json
Adds symfony/html-sanitizer ^7.1 as a runtime dependency.
Client entity updates
src/ClientBundle/Entity/Client.php
Adds length validation constraint (exactly 3 characters) to currencyCode property; changes setName method signature to accept nullable string parameter.
Form field HTML sanitization
src/ClientBundle/Form/Type/ClientType.php, src/ClientBundle/Form/Type/ContactDetailType.php, src/ClientBundle/Form/Type/ContactType.php, src/InvoiceBundle/Form/Type/ItemType.php, src/QuoteBundle/Form/Type/ItemType.php, src/TaxBundle/Form/Type/TaxType.php
Adds sanitize_html => true option to form fields (name, firstName, lastName, email, value, description) across multiple bundles.
Data grid rendering
src/DataGridBundle/Resources/views/Components/DataGrid.html.twig
Changes grid cell rendering filter from raw HTML to sanitize_html for HTML content processing.
API token repository refactoring
src/UserBundle/Repository/ApiTokenRepository.php
Restructures getApiTokensForUser method to use subquery-based approach instead of join; adds PHP-side array mapping for token data assembly; updates return type documentation.
API token twig component updates
src/UserBundle/Twig/Components/ApiTokens.php
Updates apiTokens() method return type annotation from strongly-typed to loosely-typed structure; adds ip field to return shape; removes unused imports (DateTimeInterface, Ulid).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

The changes span 14 files with mixed complexity: majority involve repetitive, straightforward HTML sanitization additions to form fields (low individual complexity, high volume), offset by the API token repository logic refactoring requiring closer inspection of query restructuring and data mapping logic, plus client entity constraint validation and parameter signature modifications.

Possibly related PRs

  • #1812: Modifies the same ApiTokenRepository::getApiTokensForUser implementation and updates corresponding ApiTokens twig component, sharing identical refactoring of query approach and return type changes.

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Out of Scope Changes Check ⚠️ Warning The PR contains significant changes beyond what is necessary to address issue #1994. The HTML sanitization modifications across eight form files (ClientType, ContactType, ContactDetailType, ItemType in multiple bundles, TaxType, and DataGrid template) add a new dependency (symfony/html-sanitizer ^7.1) and alter form behavior, yet these do not directly relate to fixing the currency field data length error. Additionally, the API token repository refactoring, while related to the PR title, does not address the linked issue about the currency field. These changes appear to be separate feature implementations bundled into this PR. Consider separating the HTML sanitization feature and API token performance optimization into distinct pull requests. This PR should focus specifically on fixing the currency field data overflow issue in #1994, keeping the currencyCode validation constraint and any directly related changes while deferring the HTML sanitization and API token refactoring to separate PRs with their own issue tracking.
Docstring Coverage ⚠️ Warning Docstring coverage is 15.38% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The PR title "Fix performance issues when loading api tokens" refers to a real component of the changeset—the ApiTokenRepository has been refactored with an alternative query approach. However, examining the volume of changes reveals that HTML sanitization modifications across eight form-related files represent the majority of the changeset, along with the currencyCode validation constraint that addresses the actual linked issue. The title captures only one aspect of the changes and is not representative of the primary modifications being introduced, making it partially related but overly narrow.
Linked Issues Check ✅ Passed The linked issue #1994 reports a SQLSTATE[22001] error indicating the currency field is receiving data that exceeds the column length. The PR directly addresses this by adding a validation constraint to the currencyCode field in the Client entity that enforces an exact length of 3 characters, which prevents oversized data from being written to the database. This constraint implementation fulfills the core coding requirement to fix the data overflow issue identified in the linked issue.
✨ 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 SolidInvoice-1994

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 and usage tips.

@pierredup pierredup changed the title Fix performance issues when loading api tokens Validate currency code to 3 characters Oct 18, 2025
@coderabbitai coderabbitai bot mentioned this pull request Dec 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

2 participants