Skip to content

Feature/1.1.4#13

Merged
CAFernandes merged 11 commits into
mainfrom
feature/1.1.4
Jul 15, 2025
Merged

Feature/1.1.4#13
CAFernandes merged 11 commits into
mainfrom
feature/1.1.4

Conversation

@CAFernandes
Copy link
Copy Markdown
Member

Pull Request Template

📋 Descrição

Descreva resumidamente as mudanças feitas neste PR.

🎯 Tipo de Mudança

  • 🐛 Bug fix (mudança que corrige um bug)
  • ✨ Nova feature (mudança que adiciona funcionalidade)
  • 💥 Breaking change (mudança que causa incompatibilidade)
  • 📚 Documentação (mudanças apenas na documentação)
  • 🧹 Refactoring (mudanças que não corrigem bug nem adicionam feature)
  • ⚡ Performance (mudanças que melhoram a performance)
  • 🧪 Testes (adição ou correção de testes)

🧪 Como foi testado?

Descreva os testes que você executou para verificar suas mudanças.

  • Testes unitários passando
  • Testes funcionais passando
  • Testado manualmente
  • Exemplos funcionando

- Introduced `quick-quality-check.sh` for rapid validation of PivotPHP Core v1.1.4, including PHPStan analysis, PSR-12 compliance checks, syntax validation for examples, performance testing, and basic loading checks.
- Added `simple_pre_release.sh` to streamline the pre-release validation process, ensuring essential files exist, validating example syntax, checking autoloader, and running basic benchmarks.
- Created `validate_all_v114.sh` to execute all validation scripts sequentially, providing a comprehensive overview of the project's health and readiness for release.
- Enhanced error handling with `ContextualException` for better debugging and context in error messages.
- Implemented `CallableResolver` utility to handle various callable types, improving route handler validation in the router.
- Updated core application logic to utilize the new `CallableResolver` for improved error handling and route management.
- Added intelligent JSON pooling logic in `JsonBufferPool` to optimize JSON encoding based on data characteristics.
- Refactored cache classes to improve code readability and maintainability.
- Deleted comprehensive, executive, final performance analysis, performance charts, and summary reports to streamline documentation.
- Updated `Response` class to utilize centralized pooling logic from `JsonBufferPool` for consistency in JSON data handling.
- Added a public method in `JsonBufferPool` to check if data should use pooling, ensuring consistent behavior across components.
- Modified tests to ensure proper pooling thresholds and consistency between direct and response pooling.
- Enhanced test cases to validate JSON encoding with pooling, ensuring efficient memory usage and buffer reuse.
@CAFernandes CAFernandes self-assigned this Jul 14, 2025
Copilot AI review requested due to automatic review settings July 14, 2025 19:37

This comment was marked as outdated.

- Added `Environment` class for consistent environment detection across the framework.
- Introduced methods for checking development, production, and testing modes.
- Implemented caching for performance optimization.
- Integrated environment detection with the enhanced exception system.
- Created comprehensive tests for the `Environment` class to ensure reliability.

chore: Update test-all-php-versions.sh to support quality metrics

- Added option to run quality checks in parallel during PHP version tests.
- Improved logging for quality metrics results.

fix: Refactor ContextualException to utilize Environment class

- Replaced scattered development mode checks with centralized `Environment::isDevelopment()` calls.
- Enhanced debug information handling based on the environment.

refactor: Improve JsonBufferPool with consistent constants

- Introduced constants for pooling thresholds and limits for better maintainability.
- Updated tests to utilize new constants for consistency in behavior.
- Implement comprehensive tests for CallableResolver to validate various callable types, including closures, string functions, and array callables with static and instance methods.
- Ensure proper exception handling for non-existent functions and invalid callables.
- Test edge cases for callable resolution, including private and protected methods, and invalid types.
- Add tests for SerializationCache to verify serialization size calculations, cache hits/misses, and cache eviction behavior.
- Include tests for scalar data and object caching, ensuring accurate memory usage calculations and cache statistics.
- Deleted quick-quality-check.sh, setup-precommit.sh, simple_pre_release.sh, test-php-versions-quick.sh, and validate_all_v114.sh scripts to streamline the project.
- Enhanced version management by ensuring the VERSION file is mandatory and validated across various scripts.
- Updated validate-documentation.php and validate_openapi.sh to retrieve and validate the current version from the VERSION file.
- Improved error handling in version-bump.sh for better user feedback on version management.
- Refactored static file registration methods in StaticFileManager and StaticRouteManager for improved readability and maintainability.
- Adjusted tests to accommodate changes in version management and ensure compatibility across PHP versions.
…n script

- Introduced `validate_openapi.sh` to check OpenAPI/Swagger resources, ensuring proper functionality and documentation.
- Added `validate_project.php` to perform comprehensive validation of the project structure, dependencies, and documentation.
- Enhanced error handling in middleware classes by throwing `HttpException` for better response management.
- Updated tests for authentication middleware to expect `HttpException` on failure.
@github-actions
Copy link
Copy Markdown

🚀 Release Readiness Report - PivotPHP Core v1.1.4

✅ All Checks Passed!

  • Version: 1.1.4
  • PHPStan: Level 9, 0 errors
  • Tests: All tests passing
  • Code Style: PSR-12 compliant
  • PHP Compatibility: 8.1 - 8.4
  • Dependencies: All valid
  • Scripts: Consolidated and optimized

📦 Ready for Publication

The project is ready to be tagged and released!

Next Steps:

  1. Create a new tag: git tag -a v1.1.4 -m 'Release v1.1.4'
  2. Push the tag: git push origin v1.1.4
  3. The release workflow will automatically create a GitHub release
  4. Packagist will be automatically updated

@CAFernandes CAFernandes requested a review from Copilot July 15, 2025 02:06

This comment was marked as outdated.

@CAFernandes CAFernandes requested a review from Copilot July 15, 2025 02:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 updates the framework to version 1.1.4 by introducing a unified callable resolver, enhancing error handling with rich context exceptions, and refining JSON pooling behavior across the codebase.

  • Add CallableResolver to centralize and validate all callable types in routing and application.
  • Replace inline JSON error responses with HttpException and ContextualException for consistent, contextual error handling.
  • Extend JsonBufferPool with adaptive pooling thresholds and unify pooling logic in Response.

Reviewed Changes

Copilot reviewed 108 out of 113 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/Utils/CallableResolver.php New utility to resolve and validate different callable types.
src/Routing/Router.php Integrated CallableResolver for handler registration and resolution.
src/Routing/StaticRouteManager.php Refactored static route handlers to throw HttpException.
src/Routing/StaticFileManager.php Updated to use HttpException and PSR-7 streams for file responses.
src/Routing/SimpleStaticFileManager.php Refactored to throw HttpException and use PSR-7 body streams.
src/Middleware/Security/CsrfMiddleware.php Switched to throwing HttpException on CSRF failure.
src/Middleware/Security/AuthMiddleware.php Refactored to throw HttpException instead of building inline responses.
src/Middleware/Core/BaseMiddleware.php Centralized error responses by throwing HttpException.
src/Middleware/CircuitBreaker.php Unified failure responses with HttpException and standardized headers.
src/Json/Pool/JsonBufferPool.php Added adaptive pooling thresholds and public API for pooling decisions.
src/Http/Response.php Delegated JSON pooling decision to JsonBufferPool.shouldUsePoolingForData.
src/Exceptions/Enhanced/ContextualException.php New exception class with contextual data and factory methods.
src/Core/Environment.php Added cached environment detection and debug info retrieval.
src/Core/Application.php Integrated ContextualException for route lookup and handler errors.
scripts/validation/* Centralized version detection via VERSION file in validation scripts.
tests/... Updated tests to expect new exceptions, skip in coverage mode, and align with refactored behavior.
Comments suppressed due to low confidence (2)

src/Routing/StaticRouteManager.php:172

  • Variable $content is undefined in this closure; you likely intended to use the captured string parameter (currently named $response). Consider renaming the parameter to $body (or similar) and using that value instead of $content when creating the PSR-7 stream.
            $res = $res->withBody(\PivotPHP\Core\Http\Pool\Psr7Pool::getStream($content));

src/Http/Response.php:835

  • The JsonBufferPool class is not imported in this file, which will cause an undefined class error. Please add use PivotPHP\Core\Json\Pool\JsonBufferPool; at the top of the file.
        return JsonBufferPool::shouldUsePoolingForData($data);

Comment thread tests/Security/AuthMiddlewareTest.php Outdated
@github-actions
Copy link
Copy Markdown

🚀 Release Readiness Report - PivotPHP Core v1.1.4

✅ All Checks Passed!

  • Version: 1.1.4
  • PHPStan: Level 9, 0 errors
  • Tests: All tests passing
  • Code Style: PSR-12 compliant
  • PHP Compatibility: 8.1 - 8.4
  • Dependencies: All valid
  • Scripts: Consolidated and optimized

📦 Ready for Publication

The project is ready to be tagged and released!

Next Steps:

  1. Create a new tag: git tag -a v1.1.4 -m 'Release v1.1.4'
  2. Push the tag: git push origin v1.1.4
  3. The release workflow will automatically create a GitHub release
  4. Packagist will be automatically updated

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

🚀 Release Readiness Report - PivotPHP Core v1.1.4

✅ All Checks Passed!

  • Version: 1.1.4
  • PHPStan: Level 9, 0 errors
  • Tests: All tests passing
  • Code Style: PSR-12 compliant
  • PHP Compatibility: 8.1 - 8.4
  • Dependencies: All valid
  • Scripts: Consolidated and optimized

📦 Ready for Publication

The project is ready to be tagged and released!

Next Steps:

  1. Create a new tag: git tag -a v1.1.4 -m 'Release v1.1.4'
  2. Push the tag: git push origin v1.1.4
  3. The release workflow will automatically create a GitHub release
  4. Packagist will be automatically updated

@CAFernandes CAFernandes merged commit f597714 into main Jul 15, 2025
7 checks passed
@CAFernandes CAFernandes deleted the feature/1.1.4 branch July 15, 2025 02:27
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