From 725e80059d175b74c5f598c02b75bb58ea7092d7 Mon Sep 17 00:00:00 2001 From: Osmane Nala Date: Mon, 30 Nov 2026 23:01:36 +0200 Subject: [PATCH 01/19] =?UTF-8?q?Actualizar=20depend=C3=AAncias=20com=20av?= =?UTF-8?q?isos=20de=20seguran=C3=A7a?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit composer update dentro das restrições existentes: laravel/framework 13.39 -> 13.44.1, symfony/* 8.1 -> 8.2 e web-auth/webauthn-lib. composer audit sem avisos. Co-Authored-By: Claude Opus 5.5 --- composer.lock | 1159 ++++++++++++++++++++++++++++--------------------- 1 file changed, 670 insertions(+), 489 deletions(-) diff --git a/composer.lock b/composer.lock index b0b21cb..b95db95 100644 --- a/composer.lock +++ b/composer.lock @@ -119,7 +119,8 @@ "type": "github" } ], - "time": "2026-09-12T10:28:18+00:00" + "time": "2026-09-12T10:28:18+00:00", + "published-time": "2026-09-12T12:23:30+00:00" }, { "name": "carbonphp/carbon-doctrine-types", @@ -193,7 +194,8 @@ "type": "tidelift" } ], - "time": "2026-09-06T14:11:38+00:00" + "time": "2026-09-06T14:11:38+00:00", + "published-time": "2026-09-06T14:15:00+00:00" }, { "name": "dasprid/enum", @@ -318,24 +320,25 @@ "issues": "https://github.com/dflydev/dflydev-dot-access-data/issues", "source": "https://github.com/dflydev/dflydev-dot-access-data/tree/v3.0.3" }, - "time": "2024-07-08T12:26:09+00:00" + "time": "2024-07-08T12:26:09+00:00", + "published-time": "2024-07-08T12:27:13+00:00" }, { "name": "doctrine/deprecations", - "version": "1.1.6", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/doctrine/deprecations.git", - "reference": "d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca" + "reference": "d2e16653a734c8784c1851ad68b02f997b53ca82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca", - "reference": "d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/d2e16653a734c8784c1851ad68b02f997b53ca82", + "reference": "d2e16653a734c8784c1851ad68b02f997b53ca82", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0" + "php": "^7.4 || ^8.0" }, "conflict": { "phpunit/phpunit": "<=7.5 || >=14" @@ -364,9 +367,10 @@ "homepage": "https://www.doctrine-project.org/", "support": { "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/1.1.6" + "source": "https://github.com/doctrine/deprecations/tree/1.2.0" }, - "time": "2026-02-07T07:09:04+00:00" + "time": "2026-11-11T10:04:49+00:00", + "published-time": "2026-11-11T10:12:24+00:00" }, { "name": "doctrine/inflector", @@ -456,7 +460,8 @@ "type": "tidelift" } ], - "time": "2026-10-26T08:14:14+00:00" + "time": "2026-10-26T08:14:14+00:00", + "published-time": "2026-10-26T20:06:59+00:00" }, { "name": "doctrine/lexer", @@ -531,7 +536,8 @@ "type": "tidelift" } ], - "time": "2026-10-01T06:59:29+00:00" + "time": "2026-10-01T06:59:29+00:00", + "published-time": "2026-10-01T07:01:28+00:00" }, { "name": "dragonmantank/cron-expression", @@ -595,30 +601,31 @@ "type": "github" } ], - "time": "2026-10-19T17:53:57+00:00" + "time": "2026-10-19T17:53:57+00:00", + "published-time": "2026-10-19T17:54:31+00:00" }, { "name": "egulias/email-validator", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/egulias/EmailValidator.git", - "reference": "d42c8731f0624ad6bdc8d3e5e9a4524f68801cfa" + "reference": "9bef884e12278a7b89b64adbfb9379c021d3c102" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/d42c8731f0624ad6bdc8d3e5e9a4524f68801cfa", - "reference": "d42c8731f0624ad6bdc8d3e5e9a4524f68801cfa", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/9bef884e12278a7b89b64adbfb9379c021d3c102", + "reference": "9bef884e12278a7b89b64adbfb9379c021d3c102", "shasum": "" }, "require": { - "doctrine/lexer": "^2.0 || ^3.0", + "doctrine/lexer": "^3.0.3", "php": ">=8.1", - "symfony/polyfill-intl-idn": "^1.26" + "symfony/polyfill-intl-idn": "^1.43" }, "require-dev": { - "phpunit/phpunit": "^10.2", - "vimeo/psalm": "^5.12" + "phpunit/phpunit": "^10.5.67", + "vimeo/psalm": "^5.26.1" }, "suggest": { "ext-intl": "PHP Internationalization Libraries are required to use the SpoofChecking validation" @@ -654,7 +661,7 @@ ], "support": { "issues": "https://github.com/egulias/EmailValidator/issues", - "source": "https://github.com/egulias/EmailValidator/tree/4.0.4" + "source": "https://github.com/egulias/EmailValidator/tree/4.0.5" }, "funding": [ { @@ -662,7 +669,8 @@ "type": "github" } ], - "time": "2025-03-06T22:45:56+00:00" + "time": "2026-11-22T16:52:20+00:00", + "published-time": "2026-11-22T22:05:57+00:00" }, { "name": "fruitcake/php-cors", @@ -733,7 +741,8 @@ "type": "github" } ], - "time": "2025-12-03T09:33:47+00:00" + "time": "2025-12-03T09:33:47+00:00", + "published-time": "2025-12-03T09:37:01+00:00" }, { "name": "graham-campbell/result-type", @@ -795,29 +804,31 @@ "type": "tidelift" } ], - "time": "2026-08-24T09:06:52+00:00" + "time": "2026-08-24T09:06:52+00:00", + "published-time": "2026-08-24T09:07:57+00:00" }, { "name": "guzzlehttp/guzzle", - "version": "8.3.1", + "version": "8.6.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "7d9b1f430bb65ac664e120af227bf9a795ad6333" + "reference": "ba6574fd975ab16f87dc356729a36777c03851e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/7d9b1f430bb65ac664e120af227bf9a795ad6333", - "reference": "7d9b1f430bb65ac664e120af227bf9a795ad6333", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/ba6574fd975ab16f87dc356729a36777c03851e8", + "reference": "ba6574fd975ab16f87dc356729a36777c03851e8", "shasum": "" }, "require": { "ext-json": "*", - "guzzlehttp/promises": "^3.1", - "guzzlehttp/psr7": "^3.2", + "guzzlehttp/promises": "^3.2", + "guzzlehttp/psr7": "^3.6", "php": "^7.4 || ^8.0", "psr/http-client": "^1.0", "psr/http-factory": "^1.0", + "symfony/deprecation-contracts": "^2.5 || ^3.0", "symfony/polyfill-php80": "^1.25", "symfony/polyfill-php82": "^1.27" }, @@ -905,7 +916,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/8.3.1" + "source": "https://github.com/guzzle/guzzle/tree/8.6.0" }, "funding": [ { @@ -921,20 +932,21 @@ "type": "tidelift" } ], - "time": "2026-10-25T21:35:34+00:00" + "time": "2026-11-22T16:48:13+00:00", + "published-time": "2026-11-22T16:50:37+00:00" }, { "name": "guzzlehttp/promises", - "version": "3.1.0", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "094d0ec418eb3b1411ea271a180ec95cae6ae933" + "reference": "a201cc78db93065f891278f86eaeaa1c97c5a158" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/094d0ec418eb3b1411ea271a180ec95cae6ae933", - "reference": "094d0ec418eb3b1411ea271a180ec95cae6ae933", + "url": "https://api.github.com/repos/guzzle/promises/zipball/a201cc78db93065f891278f86eaeaa1c97c5a158", + "reference": "a201cc78db93065f891278f86eaeaa1c97c5a158", "shasum": "" }, "require": { @@ -989,7 +1001,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/3.1.0" + "source": "https://github.com/guzzle/promises/tree/3.2.0" }, "funding": [ { @@ -1005,26 +1017,28 @@ "type": "tidelift" } ], - "time": "2026-10-18T12:48:16+00:00" + "time": "2026-11-21T03:48:02+00:00", + "published-time": "2026-11-21T03:48:27+00:00" }, { "name": "guzzlehttp/psr7", - "version": "3.2.0", + "version": "3.6.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "cdc139396207a5eba10c242d241fb014cb098390" + "reference": "1fa0f8319c046b7dec80030460254283d851388e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/cdc139396207a5eba10c242d241fb014cb098390", - "reference": "cdc139396207a5eba10c242d241fb014cb098390", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/1fa0f8319c046b7dec80030460254283d851388e", + "reference": "1fa0f8319c046b7dec80030460254283d851388e", "shasum": "" }, "require": { "php": "^7.4 || ^8.0", "psr/http-factory": "^1.1", "psr/http-message": "^2.0", + "symfony/deprecation-contracts": "^2.5 || ^3.0", "symfony/polyfill-php80": "^1.25", "symfony/polyfill-php82": "^1.27" }, @@ -1040,6 +1054,7 @@ "phpunit/phpunit": "^9.6.34" }, "suggest": { + "ext-intl": "Convert internationalized hosts with Idna", "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" }, "type": "library", @@ -1108,7 +1123,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/3.2.0" + "source": "https://github.com/guzzle/psr7/tree/3.6.0" }, "funding": [ { @@ -1124,7 +1139,8 @@ "type": "tidelift" } ], - "time": "2026-10-17T23:57:19+00:00" + "time": "2026-11-22T00:00:35+00:00", + "published-time": "2026-11-22T00:01:04+00:00" }, { "name": "guzzlehttp/uri-template", @@ -1210,7 +1226,8 @@ "type": "tidelift" } ], - "time": "2026-08-24T17:13:02+00:00" + "time": "2026-08-24T17:13:02+00:00", + "published-time": "2026-08-24T17:13:22+00:00" }, { "name": "inertiajs/inertia-laravel", @@ -1403,16 +1420,16 @@ }, { "name": "laravel/framework", - "version": "v13.39.0", + "version": "v13.44.1", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "d52c3b3129e4c8e213c97cdc68f94b0b7d27f181" + "reference": "8a8c4a84852869e13190d89f9da873cd9a70f14c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/d52c3b3129e4c8e213c97cdc68f94b0b7d27f181", - "reference": "d52c3b3129e4c8e213c97cdc68f94b0b7d27f181", + "url": "https://api.github.com/repos/laravel/framework/zipball/8a8c4a84852869e13190d89f9da873cd9a70f14c", + "reference": "8a8c4a84852869e13190d89f9da873cd9a70f14c", "shasum": "" }, "require": { @@ -1438,7 +1455,7 @@ "league/commonmark": "^2.8.1", "league/flysystem": "^3.25.1", "league/flysystem-local": "^3.25.1", - "league/uri": "^7.5.1", + "league/uri": "^7.6", "monolog/monolog": "^3.10", "nesbot/carbon": "^3.8.4", "nunomaduro/termwind": "^2.0", @@ -1467,6 +1484,7 @@ "voku/portable-ascii": "^2.0.2" }, "conflict": { + "laravel/horizon": "<5.47.0", "tightenco/collect": "<5.5.33" }, "provide": { @@ -1515,11 +1533,12 @@ "spatie/once": "*" }, "require-dev": { - "ably/ably-php": "^1.0", + "ably/pubsub-server": "^1.0|^2.0", "aws/aws-sdk-php": "^3.322.9", "ext-gmp": "*", "fakerphp/faker": "^1.24", "intervention/image": "^4.2", + "jasonmccreary/double": "^1.2.1", "laravel/pint": "^1.18", "league/flysystem-aws-s3-v3": "^3.25.1", "league/flysystem-ftp": "^3.25.1", @@ -1531,7 +1550,7 @@ "orchestra/testbench-core": "^11.6.0", "pda/pheanstalk": "^7.0.0 || ^8.0.0", "php-http/discovery": "^1.15", - "phpstan/phpstan": "2.3.1", + "phpstan/phpstan": "2.3.5", "phpunit/phpunit": "^11.5.50 || ^12.5.8 || ^13.0.3", "predis/predis": "^2.3 || ^3.0", "rector/rector": "2.6.3", @@ -1544,7 +1563,7 @@ "web-token/jwt-library": "^4.1" }, "suggest": { - "ably/ably-php": "Required to use the Ably broadcast driver (^1.0).", + "ably/pubsub-server": "Required to use the Ably broadcast driver (^1.0|^2.0).", "aws/aws-sdk-php": "Required to use the SQS queue driver, DynamoDb failed job storage, and SES mail driver (^3.322.9).", "brianium/paratest": "Required to run tests in parallel (^7.0 || ^8.0).", "ext-apcu": "Required to use the APC cache driver.", @@ -1630,7 +1649,8 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2026-10-27T14:04:39+00:00" + "time": "2026-11-24T16:10:06+00:00", + "published-time": "2026-11-24T16:10:17+00:00" }, { "name": "laravel/passkeys", @@ -1698,20 +1718,21 @@ "issues": "https://github.com/laravel/passkeys-server/issues", "source": "https://github.com/laravel/passkeys-server" }, - "time": "2026-05-18T16:26:00+00:00" + "time": "2026-05-18T16:26:00+00:00", + "published-time": "2026-05-18T16:26:25+00:00" }, { "name": "laravel/prompts", - "version": "v0.3.26", + "version": "v0.3.28", "source": { "type": "git", "url": "https://github.com/laravel/prompts.git", - "reference": "2d1e9bf6bab8d3f383c254db7f2b4ea8816d55e0" + "reference": "72247703c4d4ac1d6122955c90433aa9429bd236" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/prompts/zipball/2d1e9bf6bab8d3f383c254db7f2b4ea8816d55e0", - "reference": "2d1e9bf6bab8d3f383c254db7f2b4ea8816d55e0", + "url": "https://api.github.com/repos/laravel/prompts/zipball/72247703c4d4ac1d6122955c90433aa9429bd236", + "reference": "72247703c4d4ac1d6122955c90433aa9429bd236", "shasum": "" }, "require": { @@ -1754,22 +1775,23 @@ ], "description": "Add beautiful and user-friendly forms to your command-line applications.", "support": { - "source": "https://github.com/laravel/prompts/tree/v0.3.26" + "source": "https://github.com/laravel/prompts/tree/v0.3.28" }, - "time": "2026-10-09T14:45:13+00:00" + "time": "2026-11-23T14:41:10+00:00", + "published-time": "2026-11-24T16:27:03+00:00" }, { "name": "laravel/serializable-closure", - "version": "v2.1.0", + "version": "v2.2.0", "source": { "type": "git", "url": "https://github.com/laravel/serializable-closure.git", - "reference": "2d5869a838bbcf37e0d8b0568fc41914e81374b5" + "reference": "2bfb44e8af009b553ed2c060c94b0bc3c67b4769" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/2d5869a838bbcf37e0d8b0568fc41914e81374b5", - "reference": "2d5869a838bbcf37e0d8b0568fc41914e81374b5", + "url": "https://api.github.com/repos/laravel/serializable-closure/zipball/2bfb44e8af009b553ed2c060c94b0bc3c67b4769", + "reference": "2bfb44e8af009b553ed2c060c94b0bc3c67b4769", "shasum": "" }, "require": { @@ -1817,7 +1839,8 @@ "issues": "https://github.com/laravel/serializable-closure/issues", "source": "https://github.com/laravel/serializable-closure" }, - "time": "2026-09-22T14:32:34+00:00" + "time": "2026-10-14T21:20:29+00:00", + "published-time": "2026-11-10T16:11:08+00:00" }, { "name": "laravel/tinker", @@ -1956,16 +1979,16 @@ }, { "name": "league/commonmark", - "version": "2.10.4", + "version": "2.10.10", "source": { "type": "git", "url": "https://github.com/thephpleague/commonmark.git", - "reference": "40821b7606d8d946bac57dbd2290076c722e3a65" + "reference": "3e956235b26ea34ea721a302e27eae9a32cb9ef0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/40821b7606d8d946bac57dbd2290076c722e3a65", - "reference": "40821b7606d8d946bac57dbd2290076c722e3a65", + "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/3e956235b26ea34ea721a302e27eae9a32cb9ef0", + "reference": "3e956235b26ea34ea721a302e27eae9a32cb9ef0", "shasum": "" }, "require": { @@ -2059,7 +2082,8 @@ "type": "tidelift" } ], - "time": "2026-10-17T19:59:50+00:00" + "time": "2026-11-26T14:08:53+00:00", + "published-time": "2026-11-26T14:12:37+00:00" }, { "name": "league/config", @@ -2141,7 +2165,8 @@ "type": "github" } ], - "time": "2022-12-11T20:36:23+00:00" + "time": "2022-12-11T20:36:23+00:00", + "published-time": "2022-12-11T20:36:45+00:00" }, { "name": "league/flysystem", @@ -2224,7 +2249,8 @@ "issues": "https://github.com/thephpleague/flysystem/issues", "source": "https://github.com/thephpleague/flysystem/tree/3.36.0" }, - "time": "2026-09-02T08:00:27+00:00" + "time": "2026-09-02T08:00:27+00:00", + "published-time": "2026-09-02T08:01:40+00:00" }, { "name": "league/flysystem-local", @@ -2273,7 +2299,8 @@ "support": { "source": "https://github.com/thephpleague/flysystem-local/tree/3.35.3" }, - "time": "2026-08-12T13:29:21+00:00" + "time": "2026-08-12T13:29:21+00:00", + "published-time": "2026-08-22T12:57:18+00:00" }, { "name": "league/mime-type-detection", @@ -2329,25 +2356,26 @@ "type": "tidelift" } ], - "time": "2026-07-09T11:49:27+00:00" + "time": "2026-07-09T11:49:27+00:00", + "published-time": "2026-07-09T11:50:09+00:00" }, { "name": "league/uri", - "version": "7.9.0", + "version": "7.10.1", "source": { "type": "git", "url": "https://github.com/thephpleague/uri.git", - "reference": "fcc872a3d872aa13f935e0cd1887b9abb06da07f" + "reference": "c376d3a2e99e6dee74708116fa8424dbec77021b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/uri/zipball/fcc872a3d872aa13f935e0cd1887b9abb06da07f", - "reference": "fcc872a3d872aa13f935e0cd1887b9abb06da07f", + "url": "https://api.github.com/repos/thephpleague/uri/zipball/c376d3a2e99e6dee74708116fa8424dbec77021b", + "reference": "c376d3a2e99e6dee74708116fa8424dbec77021b", "shasum": "" }, "require": { "ext-mbstring": "*", - "league/uri-interfaces": "^7.9.0", + "league/uri-interfaces": "^7.10.1", "php": "^8.1", "psr/http-factory": "^1" }, @@ -2420,7 +2448,7 @@ "docs": "https://uri.thephpleague.com", "forum": "https://thephpleague.slack.com", "issues": "https://github.com/thephpleague/uri-src/issues", - "source": "https://github.com/thephpleague/uri/tree/7.9.0" + "source": "https://github.com/thephpleague/uri/tree/7.10.1" }, "funding": [ { @@ -2428,20 +2456,21 @@ "type": "github" } ], - "time": "2026-10-16T15:19:33+00:00" + "time": "2026-11-28T14:19:41+00:00", + "published-time": "2026-11-28T14:27:14+00:00" }, { "name": "league/uri-interfaces", - "version": "7.9.0", + "version": "7.10.1", "source": { "type": "git", "url": "https://github.com/thephpleague/uri-interfaces.git", - "reference": "eb5f6d24e6a4fe0a8e9c78ded4eb1dfff1404f58" + "reference": "fc6586f439980add067357477e4f6d7be4209ab0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/eb5f6d24e6a4fe0a8e9c78ded4eb1dfff1404f58", - "reference": "eb5f6d24e6a4fe0a8e9c78ded4eb1dfff1404f58", + "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/fc6586f439980add067357477e4f6d7be4209ab0", + "reference": "fc6586f439980add067357477e4f6d7be4209ab0", "shasum": "" }, "require": { @@ -2504,7 +2533,7 @@ "docs": "https://uri.thephpleague.com", "forum": "https://thephpleague.slack.com", "issues": "https://github.com/thephpleague/uri-src/issues", - "source": "https://github.com/thephpleague/uri-interfaces/tree/7.9.0" + "source": "https://github.com/thephpleague/uri-interfaces/tree/7.10.1" }, "funding": [ { @@ -2512,20 +2541,21 @@ "type": "github" } ], - "time": "2026-10-16T15:19:33+00:00" + "time": "2026-11-28T14:18:10+00:00", + "published-time": "2026-11-28T14:27:18+00:00" }, { "name": "monolog/monolog", - "version": "3.12.1", + "version": "3.13.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "d7059e4c691d05ea1222b5124bed0f961be46e15" + "reference": "1f5f55bb4a9a230ff6d8a4ceccea31d10b0142ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/d7059e4c691d05ea1222b5124bed0f961be46e15", - "reference": "d7059e4c691d05ea1222b5124bed0f961be46e15", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/1f5f55bb4a9a230ff6d8a4ceccea31d10b0142ac", + "reference": "1f5f55bb4a9a230ff6d8a4ceccea31d10b0142ac", "shasum": "" }, "require": { @@ -2605,7 +2635,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/3.12.1" + "source": "https://github.com/Seldaek/monolog/tree/3.13.0" }, "funding": [ { @@ -2617,7 +2647,8 @@ "type": "tidelift" } ], - "time": "2026-09-29T19:21:12+00:00" + "time": "2026-11-16T10:43:05+00:00", + "published-time": "2026-11-16T10:45:37+00:00" }, { "name": "nesbot/carbon", @@ -2723,7 +2754,8 @@ "type": "tidelift" } ], - "time": "2026-10-25T14:32:48+00:00" + "time": "2026-10-25T14:32:48+00:00", + "published-time": "2026-10-25T14:41:05+00:00" }, { "name": "nette/schema", @@ -2790,7 +2822,8 @@ "issues": "https://github.com/nette/schema/issues", "source": "https://github.com/nette/schema/tree/v1.4.0" }, - "time": "2026-10-22T02:12:50+00:00" + "time": "2026-10-22T02:12:50+00:00", + "published-time": "2026-10-22T02:14:45+00:00" }, { "name": "nette/utils", @@ -2881,7 +2914,8 @@ "issues": "https://github.com/nette/utils/issues", "source": "https://github.com/nette/utils/tree/v4.1.6" }, - "time": "2026-10-20T17:07:56+00:00" + "time": "2026-10-20T17:07:56+00:00", + "published-time": "2026-10-20T17:48:30+00:00" }, { "name": "nikic/php-parser", @@ -2942,31 +2976,31 @@ }, { "name": "nunomaduro/termwind", - "version": "v2.4.0", + "version": "v2.4.1", "source": { "type": "git", "url": "https://github.com/nunomaduro/termwind.git", - "reference": "712a31b768f5daea284c2169a7d227031001b9a8" + "reference": "9b85ae4d802403bfc004ea633ce542bc262ee5c3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nunomaduro/termwind/zipball/712a31b768f5daea284c2169a7d227031001b9a8", - "reference": "712a31b768f5daea284c2169a7d227031001b9a8", + "url": "https://api.github.com/repos/nunomaduro/termwind/zipball/9b85ae4d802403bfc004ea633ce542bc262ee5c3", + "reference": "9b85ae4d802403bfc004ea633ce542bc262ee5c3", "shasum": "" }, "require": { "ext-mbstring": "*", "php": "^8.2", - "symfony/console": "^7.4.4 || ^8.0.4" + "symfony/console": "^7.4.23 || ^8.1.11" }, "require-dev": { - "illuminate/console": "^11.47.0", - "laravel/pint": "^1.27.1", - "mockery/mockery": "^1.6.12", - "pestphp/pest": "^2.36.0 || ^3.8.4 || ^4.3.2", - "phpstan/phpstan": "^1.12.32", + "illuminate/console": "^11.51 || ^12.70 || ^13.40", + "laravel/pint": "^1.30.4", + "mockery/mockery": "^1.6.15", + "pestphp/pest": "^2.36.1 || ^3.8.7 || ^4.7.8 || ^5.3.5", + "phpstan/phpstan": "^1.12.34", "phpstan/phpstan-strict-rules": "^1.6.2", - "symfony/var-dumper": "^7.3.5 || ^8.0.4", + "symfony/var-dumper": "^7.4.22 || ^8.1.10", "thecodingmachine/phpstan-strict-rules": "^1.0.0" }, "type": "library", @@ -3009,7 +3043,7 @@ ], "support": { "issues": "https://github.com/nunomaduro/termwind/issues", - "source": "https://github.com/nunomaduro/termwind/tree/v2.4.0" + "source": "https://github.com/nunomaduro/termwind/tree/v2.4.1" }, "funding": [ { @@ -3025,20 +3059,21 @@ "type": "github" } ], - "time": "2026-02-16T23:10:27+00:00" + "time": "2026-11-07T03:57:16+00:00", + "published-time": "2026-11-07T04:01:24+00:00" }, { "name": "paragonie/constant_time_encoding", - "version": "v3.1.3", + "version": "v3.1.5", "source": { "type": "git", "url": "https://github.com/paragonie/constant_time_encoding.git", - "reference": "d5b01a39b3415c2cd581d3bd3a3575c1ebbd8e77" + "reference": "ceed38ba49d98b85808edfc4f04750ff61eb9739" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/d5b01a39b3415c2cd581d3bd3a3575c1ebbd8e77", - "reference": "d5b01a39b3415c2cd581d3bd3a3575c1ebbd8e77", + "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/ceed38ba49d98b85808edfc4f04750ff61eb9739", + "reference": "ceed38ba49d98b85808edfc4f04750ff61eb9739", "shasum": "" }, "require": { @@ -3094,7 +3129,8 @@ "issues": "https://github.com/paragonie/constant_time_encoding/issues", "source": "https://github.com/paragonie/constant_time_encoding" }, - "time": "2025-09-24T15:06:41+00:00" + "time": "2026-11-18T13:55:22+00:00", + "published-time": "2026-11-18T13:55:46+00:00" }, { "name": "phpdocumentor/reflection-common", @@ -3152,7 +3188,8 @@ "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.2.1" }, - "time": "2025-11-10T21:21:55+00:00" + "time": "2025-11-10T21:21:55+00:00", + "published-time": "2026-09-27T10:14:49+00:00" }, { "name": "phpdocumentor/reflection-docblock", @@ -3217,7 +3254,8 @@ "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/6.0.3" }, - "time": "2026-03-18T20:49:53+00:00" + "time": "2026-03-18T20:49:53+00:00", + "published-time": "2026-03-18T20:51:16+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -3275,7 +3313,8 @@ "issues": "https://github.com/phpDocumentor/TypeResolver/issues", "source": "https://github.com/phpDocumentor/TypeResolver/tree/2.1.0" }, - "time": "2026-09-27T19:32:54+00:00" + "time": "2026-09-27T19:32:54+00:00", + "published-time": "2026-09-28T18:39:55+00:00" }, { "name": "phpoption/phpoption", @@ -3350,20 +3389,21 @@ "type": "tidelift" } ], - "time": "2026-08-24T00:54:40+00:00" + "time": "2026-08-24T00:54:40+00:00", + "published-time": "2026-08-24T01:09:05+00:00" }, { "name": "phpstan/phpdoc-parser", - "version": "2.3.9", + "version": "2.5.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "2c122d2f890ae4b9e6ede898a9ac36b2c07e2a17" + "reference": "839c252522bb9d2be16ce89d99487d2a75eadc8e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/2c122d2f890ae4b9e6ede898a9ac36b2c07e2a17", - "reference": "2c122d2f890ae4b9e6ede898a9ac36b2c07e2a17", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/839c252522bb9d2be16ce89d99487d2a75eadc8e", + "reference": "839c252522bb9d2be16ce89d99487d2a75eadc8e", "shasum": "" }, "require": { @@ -3395,9 +3435,10 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/2.3.9" + "source": "https://github.com/phpstan/phpdoc-parser/tree/2.5.1" }, - "time": "2026-10-27T22:32:31+00:00" + "time": "2026-11-28T13:46:42+00:00", + "published-time": "2026-11-28T13:47:37+00:00" }, { "name": "pragmarx/google2fa", @@ -3509,7 +3550,8 @@ "issues": "https://github.com/php-fig/clock/issues", "source": "https://github.com/php-fig/clock/tree/1.0.0" }, - "time": "2022-11-25T14:36:26+00:00" + "time": "2022-11-25T14:36:26+00:00", + "published-time": "2022-11-25T14:59:22+00:00" }, { "name": "psr/container", @@ -3562,7 +3604,8 @@ "issues": "https://github.com/php-fig/container/issues", "source": "https://github.com/php-fig/container/tree/2.0.2" }, - "time": "2021-11-05T16:47:00+00:00" + "time": "2021-11-05T16:47:00+00:00", + "published-time": "2021-11-05T16:53:27+00:00" }, { "name": "psr/event-dispatcher", @@ -3612,7 +3655,8 @@ "issues": "https://github.com/php-fig/event-dispatcher/issues", "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" }, - "time": "2019-01-08T18:20:26+00:00" + "time": "2019-01-08T18:20:26+00:00", + "published-time": "2019-03-25T15:31:44+00:00" }, { "name": "psr/http-client", @@ -3664,7 +3708,8 @@ "support": { "source": "https://github.com/php-fig/http-client" }, - "time": "2023-09-23T14:17:50+00:00" + "time": "2023-09-23T14:17:50+00:00", + "published-time": "2023-09-23T14:18:12+00:00" }, { "name": "psr/http-factory", @@ -3719,7 +3764,8 @@ "support": { "source": "https://github.com/php-fig/http-factory" }, - "time": "2024-04-15T12:06:14+00:00" + "time": "2024-04-15T12:06:14+00:00", + "published-time": "2024-05-10T07:32:19+00:00" }, { "name": "psr/http-message", @@ -3772,7 +3818,8 @@ "support": { "source": "https://github.com/php-fig/http-message/tree/2.0" }, - "time": "2023-04-04T09:54:51+00:00" + "time": "2023-04-04T09:54:51+00:00", + "published-time": "2023-04-04T09:55:35+00:00" }, { "name": "psr/log", @@ -3822,7 +3869,8 @@ "support": { "source": "https://github.com/php-fig/log/tree/3.0.2" }, - "time": "2024-09-11T13:17:53+00:00" + "time": "2024-09-11T13:17:53+00:00", + "published-time": "2024-09-11T13:21:14+00:00" }, { "name": "psr/simple-cache", @@ -3873,7 +3921,8 @@ "support": { "source": "https://github.com/php-fig/simple-cache/tree/3.0.0" }, - "time": "2021-10-29T13:26:27+00:00" + "time": "2021-10-29T13:26:27+00:00", + "published-time": "2021-10-29T13:27:19+00:00" }, { "name": "psy/psysh", @@ -4028,20 +4077,21 @@ "issues": "https://github.com/ramsey/collection/issues", "source": "https://github.com/ramsey/collection/tree/2.1.1" }, - "time": "2025-03-22T05:38:12+00:00" + "time": "2025-03-22T05:38:12+00:00", + "published-time": "2025-03-22T05:39:22+00:00" }, { "name": "ramsey/uuid", - "version": "4.9.4", + "version": "4.10.0", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "75d73f48d02797c2c285a7e9f348fadc0102ffe2" + "reference": "f9aa3efc8015fcbc013d84d699583b268ccb593a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/75d73f48d02797c2c285a7e9f348fadc0102ffe2", - "reference": "75d73f48d02797c2c285a7e9f348fadc0102ffe2", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/f9aa3efc8015fcbc013d84d699583b268ccb593a", + "reference": "f9aa3efc8015fcbc013d84d699583b268ccb593a", "shasum": "" }, "require": { @@ -4053,23 +4103,22 @@ "rhumsaa/uuid": "self.version" }, "require-dev": { - "captainhook/captainhook": "^5.25", - "captainhook/plugin-composer": "^5.3", - "dealerdirect/phpcodesniffer-composer-installer": "^1.0", - "ergebnis/composer-normalize": "^2.47", - "mockery/mockery": "^1.6", - "paragonie/random-lib": "^2", - "php-mock/php-mock": "^2.6", - "php-mock/php-mock-mockery": "^1.5", + "captainhook/captainhook": "^5.29.3", + "captainhook/plugin-composer": "^5.3.3", + "dealerdirect/phpcodesniffer-composer-installer": "^1.2.1", + "mockery/mockery": "^1.6.15", + "paragonie/random-lib": "^2.0.3", + "php-mock/php-mock": "^2.7.0", + "php-mock/php-mock-mockery": "^1.5.0", "php-parallel-lint/php-parallel-lint": "^1.4.0", "phpbench/phpbench": "^1.2.14", - "phpstan/extension-installer": "^1.4", - "phpstan/phpstan": "^2.1", - "phpstan/phpstan-mockery": "^2.0", - "phpstan/phpstan-phpunit": "^2.0", - "phpunit/phpunit": "^9.6", - "slevomat/coding-standard": "^8.18", - "squizlabs/php_codesniffer": "^3.13" + "phpstan/extension-installer": "^1.4.3", + "phpstan/phpstan": "^2.3.5", + "phpstan/phpstan-mockery": "^2.0.0", + "phpstan/phpstan-phpunit": "^2.1.2", + "phpunit/phpunit": "^9.6.39", + "slevomat/coding-standard": "^8.31.3", + "squizlabs/php_codesniffer": "^4.0.4" }, "suggest": { "ext-bcmath": "Enables faster math with arbitrary-precision integers using BCMath.", @@ -4104,9 +4153,10 @@ ], "support": { "issues": "https://github.com/ramsey/uuid/issues", - "source": "https://github.com/ramsey/uuid/tree/4.9.4" + "source": "https://github.com/ramsey/uuid/tree/4.10.0" }, - "time": "2026-09-16T11:39:30+00:00" + "time": "2026-11-14T23:23:20+00:00", + "published-time": "2026-11-14T23:35:39+00:00" }, { "name": "spomky-labs/cbor-php", @@ -4178,7 +4228,8 @@ "type": "patreon" } ], - "time": "2026-09-15T06:55:29+00:00" + "time": "2026-09-15T06:55:29+00:00", + "published-time": "2026-09-15T06:57:54+00:00" }, { "name": "spomky-labs/pki-framework", @@ -4288,20 +4339,21 @@ "type": "patreon" } ], - "time": "2026-09-12T19:02:49+00:00" + "time": "2026-09-12T19:02:49+00:00", + "published-time": "2026-09-12T19:03:18+00:00" }, { "name": "symfony/clock", - "version": "v8.1.9", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/clock.git", - "reference": "945ea3b64d6da9c1c2c354fe5c07b27455df6442" + "reference": "7e6b34563da2870b8041066a12f21e2f69101458" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/clock/zipball/945ea3b64d6da9c1c2c354fe5c07b27455df6442", - "reference": "945ea3b64d6da9c1c2c354fe5c07b27455df6442", + "url": "https://api.github.com/repos/symfony/clock/zipball/7e6b34563da2870b8041066a12f21e2f69101458", + "reference": "7e6b34563da2870b8041066a12f21e2f69101458", "shasum": "" }, "require": { @@ -4345,7 +4397,7 @@ "time" ], "support": { - "source": "https://github.com/symfony/clock/tree/v8.1.9" + "source": "https://github.com/symfony/clock/tree/v8.2.0" }, "funding": [ { @@ -4365,32 +4417,33 @@ "type": "tidelift" } ], - "time": "2026-10-12T14:32:04+00:00" + "time": "2026-10-12T14:32:11+00:00", + "published-time": "2026-11-28T12:13:22+00:00" }, { "name": "symfony/console", - "version": "v8.1.9", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "630e74196a2635ec0f06c12bd3fb47cfedf85157" + "reference": "ea1860277087a43c75a02591d71a5a217682f494" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/630e74196a2635ec0f06c12bd3fb47cfedf85157", - "reference": "630e74196a2635ec0f06c12bd3fb47cfedf85157", + "url": "https://api.github.com/repos/symfony/console/zipball/ea1860277087a43c75a02591d71a5a217682f494", + "reference": "ea1860277087a43c75a02591d71a5a217682f494", "shasum": "" }, "require": { "php": ">=8.4.1", "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-mbstring": "^1.0", - "symfony/polyfill-php85": "^1.32", + "symfony/polyfill-php85": "^1.33", "symfony/service-contracts": "^2.5|^3", "symfony/string": "^7.4.6|^8.0.6" }, "conflict": { - "symfony/dependency-injection": "<8.1", + "symfony/dependency-injection": "<8.2", "symfony/event-dispatcher": "<8.1" }, "provide": { @@ -4399,7 +4452,7 @@ "require-dev": { "psr/log": "^1|^2|^3", "symfony/config": "^7.4|^8.0", - "symfony/dependency-injection": "^8.1", + "symfony/dependency-injection": "^8.2", "symfony/event-dispatcher": "^8.1", "symfony/filesystem": "^7.4|^8.0", "symfony/http-foundation": "^7.4|^8.0", @@ -4445,7 +4498,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v8.1.9" + "source": "https://github.com/symfony/console/tree/v8.2.0" }, "funding": [ { @@ -4465,20 +4518,21 @@ "type": "tidelift" } ], - "time": "2026-10-12T19:11:16+00:00" + "time": "2026-11-24T16:01:15+00:00", + "published-time": "2026-11-28T12:13:07+00:00" }, { "name": "symfony/css-selector", - "version": "v8.1.6", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "08e2905152a39cf3fd1745d83f8c483e258887d9" + "reference": "9cfd588b8b07cf83e3426b030dbafd2291c132d9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/08e2905152a39cf3fd1745d83f8c483e258887d9", - "reference": "08e2905152a39cf3fd1745d83f8c483e258887d9", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/9cfd588b8b07cf83e3426b030dbafd2291c132d9", + "reference": "9cfd588b8b07cf83e3426b030dbafd2291c132d9", "shasum": "" }, "require": { @@ -4514,7 +4568,7 @@ "description": "Converts CSS selectors to XPath expressions", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/css-selector/tree/v8.1.6" + "source": "https://github.com/symfony/css-selector/tree/v8.2.0" }, "funding": [ { @@ -4534,20 +4588,21 @@ "type": "tidelift" } ], - "time": "2026-08-23T10:06:25+00:00" + "time": "2026-10-18T14:56:39+00:00", + "published-time": "2026-11-28T12:11:16+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.7.1", + "version": "v3.8.1", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "f3202fa1b5097b0af062dc978b32ecf63404e31d" + "reference": "feb1edf4e546af3b85c5caebe8359a20db230ca3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/f3202fa1b5097b0af062dc978b32ecf63404e31d", - "reference": "f3202fa1b5097b0af062dc978b32ecf63404e31d", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/feb1edf4e546af3b85c5caebe8359a20db230ca3", + "reference": "feb1edf4e546af3b85c5caebe8359a20db230ca3", "shasum": "" }, "require": { @@ -4560,7 +4615,7 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "3.7-dev" + "dev-main": "3.8-dev" } }, "autoload": { @@ -4585,7 +4640,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.7.1" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.8.1" }, "funding": [ { @@ -4605,27 +4660,28 @@ "type": "tidelift" } ], - "time": "2026-06-05T06:23:12+00:00" + "time": "2026-09-16T14:15:10+00:00", + "published-time": "2026-11-04T11:25:34+00:00" }, { "name": "symfony/error-handler", - "version": "v8.1.8", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "c146daceccd5d4f864c051b233c276641cec527b" + "reference": "ea571e24449e210a6b1f0d292f8374c95f63731f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/c146daceccd5d4f864c051b233c276641cec527b", - "reference": "c146daceccd5d4f864c051b233c276641cec527b", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/ea571e24449e210a6b1f0d292f8374c95f63731f", + "reference": "ea571e24449e210a6b1f0d292f8374c95f63731f", "shasum": "" }, "require": { "php": ">=8.4.1", "psr/log": "^1|^2|^3", "symfony/polyfill-php85": "^1.32", - "symfony/var-dumper": "^7.4|^8.0" + "symfony/var-dumper": "^8.1" }, "conflict": { "symfony/deprecation-contracts": "<2.5" @@ -4666,7 +4722,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v8.1.8" + "source": "https://github.com/symfony/error-handler/tree/v8.2.0" }, "funding": [ { @@ -4686,28 +4742,30 @@ "type": "tidelift" } ], - "time": "2026-09-22T18:58:53+00:00" + "time": "2026-11-27T14:48:42+00:00", + "published-time": "2026-11-28T12:13:29+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v8.1.5", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "7458da64220376b2e0dc2d8451bf43382c1ad297" + "reference": "b18c4241475a44e262ceee9066eac8927324a64c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/7458da64220376b2e0dc2d8451bf43382c1ad297", - "reference": "7458da64220376b2e0dc2d8451bf43382c1ad297", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/b18c4241475a44e262ceee9066eac8927324a64c", + "reference": "b18c4241475a44e262ceee9066eac8927324a64c", "shasum": "" }, "require": { "php": ">=8.4.1", "symfony/deprecation-contracts": "^2.5|^3", - "symfony/event-dispatcher-contracts": "^2.5|^3" + "symfony/event-dispatcher-contracts": "^3.8.1" }, "conflict": { + "symfony/dependency-injection": "<8.2", "symfony/security-http": "<7.4", "symfony/service-contracts": "<2.5" }, @@ -4718,13 +4776,14 @@ "require-dev": { "psr/log": "^1|^2|^3", "symfony/config": "^7.4|^8.0", - "symfony/dependency-injection": "^7.4|^8.0", + "symfony/dependency-injection": "^8.2", "symfony/error-handler": "^7.4|^8.0", "symfony/expression-language": "^7.4|^8.0", "symfony/framework-bundle": "^7.4|^8.0", "symfony/http-foundation": "^7.4|^8.0", "symfony/service-contracts": "^2.5|^3", - "symfony/stopwatch": "^7.4|^8.0" + "symfony/stopwatch": "^7.4|^8.0", + "symfony/var-dumper": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -4752,7 +4811,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v8.1.5" + "source": "https://github.com/symfony/event-dispatcher/tree/v8.2.0" }, "funding": [ { @@ -4772,20 +4831,21 @@ "type": "tidelift" } ], - "time": "2026-08-21T17:47:34+00:00" + "time": "2026-11-04T11:35:44+00:00", + "published-time": "2026-11-28T12:11:10+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v3.7.1", + "version": "v3.8.1", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "c7de7a00ffb67842132da02ea92988a39ccd9f4e" + "reference": "658e29751424da3ef4758c60f769e59d1b2981eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/c7de7a00ffb67842132da02ea92988a39ccd9f4e", - "reference": "c7de7a00ffb67842132da02ea92988a39ccd9f4e", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/658e29751424da3ef4758c60f769e59d1b2981eb", + "reference": "658e29751424da3ef4758c60f769e59d1b2981eb", "shasum": "" }, "require": { @@ -4799,7 +4859,7 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "3.7-dev" + "dev-main": "3.8-dev" } }, "autoload": { @@ -4832,7 +4892,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.7.1" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.8.1" }, "funding": [ { @@ -4852,20 +4912,21 @@ "type": "tidelift" } ], - "time": "2026-06-05T06:23:12+00:00" + "time": "2026-09-16T14:15:10+00:00", + "published-time": "2026-11-04T11:25:36+00:00" }, { "name": "symfony/finder", - "version": "v8.1.8", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "bd4fed193a3132c91c5c93595cbfc78988915822" + "reference": "79610bbc37de349047f9a85676f6aa5ce4308e51" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/bd4fed193a3132c91c5c93595cbfc78988915822", - "reference": "bd4fed193a3132c91c5c93595cbfc78988915822", + "url": "https://api.github.com/repos/symfony/finder/zipball/79610bbc37de349047f9a85676f6aa5ce4308e51", + "reference": "79610bbc37de349047f9a85676f6aa5ce4308e51", "shasum": "" }, "require": { @@ -4900,7 +4961,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v8.1.8" + "source": "https://github.com/symfony/finder/tree/v8.2.0" }, "funding": [ { @@ -4920,25 +4981,27 @@ "type": "tidelift" } ], - "time": "2026-09-26T06:33:49+00:00" + "time": "2026-11-27T14:09:33+00:00", + "published-time": "2026-11-28T12:12:27+00:00" }, { "name": "symfony/http-foundation", - "version": "v8.1.9", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "7850897fb8659f98491b03be79ac48600bdaf9ab" + "reference": "1685f3e33f16f0114c3232f470da627090d9ce48" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/7850897fb8659f98491b03be79ac48600bdaf9ab", - "reference": "7850897fb8659f98491b03be79ac48600bdaf9ab", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/1685f3e33f16f0114c3232f470da627090d9ce48", + "reference": "1685f3e33f16f0114c3232f470da627090d9ce48", "shasum": "" }, "require": { "php": ">=8.4.1", "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-deepclone": "^1.43.1", "symfony/polyfill-mbstring": "^1.1" }, "conflict": { @@ -4981,7 +5044,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v8.1.9" + "source": "https://github.com/symfony/http-foundation/tree/v8.2.0" }, "funding": [ { @@ -5001,20 +5064,21 @@ "type": "tidelift" } ], - "time": "2026-10-08T16:57:43+00:00" + "time": "2026-11-27T14:09:33+00:00", + "published-time": "2026-11-28T12:13:01+00:00" }, { "name": "symfony/http-kernel", - "version": "v8.1.9", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "55c6935bb4c004a72b55f723e79d5404881dcad3" + "reference": "76872b19c99773485622d973cfa3c0a9bdf5f847" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/55c6935bb4c004a72b55f723e79d5404881dcad3", - "reference": "55c6935bb4c004a72b55f723e79d5404881dcad3", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/76872b19c99773485622d973cfa3c0a9bdf5f847", + "reference": "76872b19c99773485622d973cfa3c0a9bdf5f847", "shasum": "" }, "require": { @@ -5022,17 +5086,20 @@ "psr/log": "^1|^2|^3", "symfony/deprecation-contracts": "^2.5|^3", "symfony/error-handler": "^7.4|^8.0", - "symfony/event-dispatcher": "^7.4|^8.0", - "symfony/http-foundation": "^7.4|^8.0", + "symfony/event-dispatcher": "^8.2", + "symfony/http-foundation": "^8.2", "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "symfony/dependency-injection": "<8.1", + "symfony/console": "<8.2", + "symfony/dependency-injection": "<8.2", "symfony/flex": "<2.10", "symfony/http-client-contracts": "<2.5", + "symfony/rate-limiter": "<8.2", + "symfony/routing": "<8.2", "symfony/serializer": "<7.4.15|>=8.0,<8.0.15|>=8.1,<8.1.2", "symfony/translation-contracts": "<2.5", - "symfony/var-dumper": "<8.1", + "symfony/var-dumper": "<8.2", "symfony/web-profiler-bundle": "<8.1", "twig/twig": "<3.21" }, @@ -5040,28 +5107,35 @@ "psr/log-implementation": "1.0|2.0|3.0" }, "require-dev": { + "phpstan/phpdoc-parser": "^1.0|^2.0", "psr/cache": "^1.0|^2.0|^3.0", "symfony/browser-kit": "^7.4|^8.0", + "symfony/cache": "^8.2", "symfony/clock": "^7.4|^8.0", "symfony/config": "^7.4|^8.0", - "symfony/console": "^7.4|^8.0", + "symfony/console": "^8.2", "symfony/css-selector": "^7.4|^8.0", - "symfony/dependency-injection": "^8.1", + "symfony/dependency-injection": "^8.2", "symfony/dom-crawler": "^7.4|^8.0", - "symfony/expression-language": "^7.4|^8.0", + "symfony/expression-language": "^8.2", "symfony/finder": "^7.4|^8.0", + "symfony/http-client": "^7.4|^8.0", "symfony/http-client-contracts": "^2.5|^3", + "symfony/json-streamer": "^7.4|^8.0", + "symfony/lock": "^7.4|^8.0", + "symfony/object-mapper": "^7.4|^8.0", "symfony/process": "^7.4|^8.0", "symfony/property-access": "^7.4|^8.0", "symfony/rate-limiter": "^7.4|^8.0", - "symfony/routing": "^7.4|^8.0", + "symfony/routing": "^8.2", "symfony/serializer": "^7.4|^8.0", "symfony/stopwatch": "^7.4|^8.0", "symfony/translation": "^7.4|^8.0", "symfony/translation-contracts": "^2.5|^3", + "symfony/type-info": "^7.4|^8.0", "symfony/uid": "^7.4|^8.0", "symfony/validator": "^7.4|^8.0", - "symfony/var-dumper": "^8.1", + "symfony/var-dumper": "^8.2", "symfony/var-exporter": "^7.4|^8.0", "twig/twig": "^3.21|^4.0" }, @@ -5091,7 +5165,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v8.1.9" + "source": "https://github.com/symfony/http-kernel/tree/v8.2.0" }, "funding": [ { @@ -5111,20 +5185,21 @@ "type": "tidelift" } ], - "time": "2026-10-14T06:47:03+00:00" + "time": "2026-11-28T12:09:59+00:00", + "published-time": "2026-11-28T12:13:18+00:00" }, { "name": "symfony/mailer", - "version": "v8.1.7", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/mailer.git", - "reference": "8783380ecdafa23d36fc90c5873fd44b635c6e10" + "reference": "b328a1749e4842ff2ded121aee5dcc45e5df80b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mailer/zipball/8783380ecdafa23d36fc90c5873fd44b635c6e10", - "reference": "8783380ecdafa23d36fc90c5873fd44b635c6e10", + "url": "https://api.github.com/repos/symfony/mailer/zipball/b328a1749e4842ff2ded121aee5dcc45e5df80b7", + "reference": "b328a1749e4842ff2ded121aee5dcc45e5df80b7", "shasum": "" }, "require": { @@ -5132,18 +5207,28 @@ "php": ">=8.4.1", "psr/event-dispatcher": "^1", "psr/log": "^1|^2|^3", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/event-dispatcher": "^7.4|^8.0", - "symfony/mime": "^7.4|^8.0", + "symfony/mime": "^8.2", "symfony/service-contracts": "^2.5|^3" }, "conflict": { + "symfony/config": "<8.2", + "symfony/console": "<8.2", + "symfony/dependency-injection": "<8.2", "symfony/http-client-contracts": "<2.5" }, "require-dev": { - "symfony/console": "^7.4|^8.0", + "symfony/clock": "^7.4|^8.0", + "symfony/config": "^8.2", + "symfony/console": "^8.2", + "symfony/dependency-injection": "^8.2", "symfony/http-client": "^7.4|^8.0", "symfony/messenger": "^7.4|^8.0", - "symfony/twig-bridge": "^7.4|^8.0" + "symfony/process": "^7.4|^8.0", + "symfony/rate-limiter": "^7.4|^8.0", + "symfony/twig-bridge": "^7.4|^8.0", + "symfony/webhook": "^8.2" }, "type": "library", "autoload": { @@ -5171,7 +5256,7 @@ "description": "Helps sending emails", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/mailer/tree/v8.1.7" + "source": "https://github.com/symfony/mailer/tree/v8.2.0" }, "funding": [ { @@ -5191,20 +5276,21 @@ "type": "tidelift" } ], - "time": "2026-09-15T06:01:24+00:00" + "time": "2026-11-27T14:25:25+00:00", + "published-time": "2026-11-28T12:13:46+00:00" }, { "name": "symfony/mime", - "version": "v8.1.7", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "773ac57f20e2795bdadb65b5b1b5f4850d498283" + "reference": "e25af849162db5d5a8cfc54f26c9294546ddef50" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/773ac57f20e2795bdadb65b5b1b5f4850d498283", - "reference": "773ac57f20e2795bdadb65b5b1b5f4850d498283", + "url": "https://api.github.com/repos/symfony/mime/zipball/e25af849162db5d5a8cfc54f26c9294546ddef50", + "reference": "e25af849162db5d5a8cfc54f26c9294546ddef50", "shasum": "" }, "require": { @@ -5215,18 +5301,25 @@ "conflict": { "egulias/email-validator": "~3.0.0", "phpdocumentor/reflection-docblock": "<5.2|>=7", - "phpdocumentor/type-resolver": "<1.5.1" + "phpdocumentor/type-resolver": "<1.5.1", + "symfony/dependency-injection": "<8.1" }, "require-dev": { "egulias/email-validator": "^2.1.10|^3.1|^4", "league/html-to-markdown": "^5.0", "phpdocumentor/reflection-docblock": "^5.2|^6.0", - "symfony/dependency-injection": "^7.4|^8.0", + "symfony/clock": "^7.4|^8.0", + "symfony/config": "^7.4|^8.0", + "symfony/dependency-injection": "^8.1", + "symfony/filesystem": "^7.4|^8.0", "symfony/process": "^7.4|^8.0", "symfony/property-access": "^7.4|^8.0", "symfony/property-info": "^7.4|^8.0", "symfony/serializer": "^7.4.17|^8.1.5" }, + "suggest": { + "symfony/process": "For PGP/MIME signing and encryption support" + }, "type": "library", "autoload": { "psr-4": { @@ -5257,7 +5350,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v8.1.7" + "source": "https://github.com/symfony/mime/tree/v8.2.0" }, "funding": [ { @@ -5277,7 +5370,8 @@ "type": "tidelift" } ], - "time": "2026-09-04T11:02:17+00:00" + "time": "2026-11-27T14:25:25+00:00", + "published-time": "2026-11-28T12:11:31+00:00" }, { "name": "symfony/polyfill-ctype", @@ -5360,20 +5454,109 @@ "type": "tidelift" } ], - "time": "2026-04-10T16:19:22+00:00" + "time": "2026-04-10T16:19:22+00:00", + "published-time": "2026-04-26T14:44:50+00:00" }, { - "name": "symfony/polyfill-intl-grapheme", - "version": "v1.43.0", + "name": "symfony/polyfill-deepclone", + "version": "v1.43.2", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "5cac8f4db97208823aa353f59a01faad2da52c75" + "url": "https://github.com/symfony/polyfill-deepclone.git", + "reference": "82274308b59f6e96f53a3fb37fc40877d843e5a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/5cac8f4db97208823aa353f59a01faad2da52c75", - "reference": "5cac8f4db97208823aa353f59a01faad2da52c75", + "url": "https://api.github.com/repos/symfony/polyfill-deepclone/zipball/82274308b59f6e96f53a3fb37fc40877d843e5a5", + "reference": "82274308b59f6e96f53a3fb37fc40877d843e5a5", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "provide": { + "ext-deepclone": "*" + }, + "suggest": { + "ext-deepclone": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\DeepClone\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the deepclone extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "deepclone", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-deepclone/tree/v1.43.2" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-10-14T07:17:09+00:00", + "published-time": "2026-10-14T09:42:25+00:00" + }, + { + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.43.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "5a8f33c87aeecffce24e721b5064fab05f4becf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/5a8f33c87aeecffce24e721b5064fab05f4becf8", + "reference": "5a8f33c87aeecffce24e721b5064fab05f4becf8", "shasum": "" }, "require": { @@ -5422,7 +5605,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.43.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.43.3" }, "funding": [ { @@ -5442,7 +5625,8 @@ "type": "tidelift" } ], - "time": "2026-09-25T15:46:47+00:00" + "time": "2026-10-15T09:18:53+00:00", + "published-time": "2026-10-28T10:07:44+00:00" }, { "name": "symfony/polyfill-intl-idn", @@ -5529,7 +5713,8 @@ "type": "tidelift" } ], - "time": "2026-09-23T14:40:04+00:00" + "time": "2026-09-23T14:40:04+00:00", + "published-time": "2026-09-30T10:23:39+00:00" }, { "name": "symfony/polyfill-intl-normalizer", @@ -5614,20 +5799,21 @@ "type": "tidelift" } ], - "time": "2026-09-23T22:02:09+00:00" + "time": "2026-09-23T22:02:09+00:00", + "published-time": "2026-09-30T10:23:47+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.43.0", + "version": "v1.43.3", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "4d5d331bf731e0aedbc6b2f5e61135b7b7996a72" + "reference": "122889ed24dc000165bcbfd77ec412f15cbdfc6a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/4d5d331bf731e0aedbc6b2f5e61135b7b7996a72", - "reference": "4d5d331bf731e0aedbc6b2f5e61135b7b7996a72", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/122889ed24dc000165bcbfd77ec412f15cbdfc6a", + "reference": "122889ed24dc000165bcbfd77ec412f15cbdfc6a", "shasum": "" }, "require": { @@ -5679,7 +5865,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.43.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.43.3" }, "funding": [ { @@ -5699,7 +5885,8 @@ "type": "tidelift" } ], - "time": "2026-09-24T15:19:04+00:00" + "time": "2026-10-28T09:35:49+00:00", + "published-time": "2026-10-28T10:07:45+00:00" }, { "name": "symfony/polyfill-php80", @@ -5783,7 +5970,8 @@ "type": "tidelift" } ], - "time": "2026-09-25T15:50:05+00:00" + "time": "2026-09-25T15:50:05+00:00", + "published-time": "2026-09-30T10:23:35+00:00" }, { "name": "symfony/polyfill-php81", @@ -5863,7 +6051,8 @@ "type": "tidelift" } ], - "time": "2026-05-26T12:45:58+00:00" + "time": "2026-05-26T12:45:58+00:00", + "published-time": "2026-05-26T13:40:34+00:00" }, { "name": "symfony/polyfill-php82", @@ -5943,7 +6132,8 @@ "type": "tidelift" } ], - "time": "2026-09-25T15:50:05+00:00" + "time": "2026-09-25T15:50:05+00:00", + "published-time": "2026-09-30T10:23:32+00:00" }, { "name": "symfony/polyfill-php84", @@ -6023,20 +6213,21 @@ "type": "tidelift" } ], - "time": "2026-09-23T22:01:09+00:00" + "time": "2026-09-23T22:01:09+00:00", + "published-time": "2026-09-30T10:23:33+00:00" }, { "name": "symfony/polyfill-php85", - "version": "v1.43.0", + "version": "v1.44.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php85.git", - "reference": "86a42cbcc07adc331481a5ab310a4024bfc227f6" + "reference": "94c794cb5ba51784bc259f11e9f128593297d8dc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php85/zipball/86a42cbcc07adc331481a5ab310a4024bfc227f6", - "reference": "86a42cbcc07adc331481a5ab310a4024bfc227f6", + "url": "https://api.github.com/repos/symfony/polyfill-php85/zipball/94c794cb5ba51784bc259f11e9f128593297d8dc", + "reference": "94c794cb5ba51784bc259f11e9f128593297d8dc", "shasum": "" }, "require": { @@ -6083,7 +6274,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php85/tree/v1.43.0" + "source": "https://github.com/symfony/polyfill-php85/tree/v1.44.0" }, "funding": [ { @@ -6103,7 +6294,8 @@ "type": "tidelift" } ], - "time": "2026-09-25T15:46:47+00:00" + "time": "2026-10-30T15:20:09+00:00", + "published-time": "2026-11-15T14:20:22+00:00" }, { "name": "symfony/polyfill-php86", @@ -6183,7 +6375,8 @@ "type": "tidelift" } ], - "time": "2026-09-25T15:46:47+00:00" + "time": "2026-09-25T15:46:47+00:00", + "published-time": "2026-09-30T10:23:43+00:00" }, { "name": "symfony/polyfill-time", @@ -6266,108 +6459,33 @@ "type": "tidelift" } ], - "time": "2026-08-07T13:08:13+00:00" - }, - { - "name": "symfony/polyfill-uuid", - "version": "v1.43.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-uuid.git", - "reference": "b23ff8245cc5c4479ea2be3d0132d2e6dd433993" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-uuid/zipball/b23ff8245cc5c4479ea2be3d0132d2e6dd433993", - "reference": "b23ff8245cc5c4479ea2be3d0132d2e6dd433993", - "shasum": "" - }, - "require": { - "php": ">=7.2" - }, - "provide": { - "ext-uuid": "*" - }, - "suggest": { - "ext-uuid": "For best performance" - }, - "type": "library", - "extra": { - "thanks": { - "url": "https://github.com/symfony/polyfill", - "name": "symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Uuid\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Grégoire Pineau", - "email": "lyrixx@lyrixx.info" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for uuid functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "uuid" - ], - "support": { - "source": "https://github.com/symfony/polyfill-uuid/tree/v1.43.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://github.com/nicolas-grekas", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2026-09-24T05:20:52+00:00" + "time": "2026-08-07T13:08:13+00:00", + "published-time": "2026-08-24T11:45:15+00:00" }, { "name": "symfony/process", - "version": "v8.1.9", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "59a682fd049b2d4d37c444f5ac21b7d01b8c7189" + "reference": "2c176461fd9614ffa1bb292ca7c95205d0e928c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/59a682fd049b2d4d37c444f5ac21b7d01b8c7189", - "reference": "59a682fd049b2d4d37c444f5ac21b7d01b8c7189", + "url": "https://api.github.com/repos/symfony/process/zipball/2c176461fd9614ffa1bb292ca7c95205d0e928c9", + "reference": "2c176461fd9614ffa1bb292ca7c95205d0e928c9", "shasum": "" }, "require": { "php": ">=8.4.1" }, + "conflict": { + "symfony/dependency-injection": "<8.1" + }, + "require-dev": { + "symfony/config": "^7.4|^8.0", + "symfony/dependency-injection": "^8.1" + }, "type": "library", "autoload": { "psr-4": { @@ -6394,7 +6512,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v8.1.9" + "source": "https://github.com/symfony/process/tree/v8.2.0" }, "funding": [ { @@ -6414,28 +6532,35 @@ "type": "tidelift" } ], - "time": "2026-10-08T16:57:43+00:00" + "time": "2026-11-23T09:50:06+00:00", + "published-time": "2026-11-28T12:12:23+00:00" }, { "name": "symfony/property-access", - "version": "v8.1.4", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/property-access.git", - "reference": "1a41232c678972b93ce499a504e19ea09dfcd0b2" + "reference": "ef39edef17b04c451ef16d3c384b055a540c544d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-access/zipball/1a41232c678972b93ce499a504e19ea09dfcd0b2", - "reference": "1a41232c678972b93ce499a504e19ea09dfcd0b2", + "url": "https://api.github.com/repos/symfony/property-access/zipball/ef39edef17b04c451ef16d3c384b055a540c544d", + "reference": "ef39edef17b04c451ef16d3c384b055a540c544d", "shasum": "" }, "require": { "php": ">=8.4.1", "symfony/property-info": "^7.4.4|^8.0.4" }, + "conflict": { + "symfony/config": "<8.2", + "symfony/dependency-injection": "<8.2" + }, "require-dev": { "symfony/cache": "^7.4|^8.0", + "symfony/config": "^8.2", + "symfony/dependency-injection": "^8.2", "symfony/var-exporter": "^7.4|^8.0" }, "type": "library", @@ -6475,7 +6600,7 @@ "reflection" ], "support": { - "source": "https://github.com/symfony/property-access/tree/v8.1.4" + "source": "https://github.com/symfony/property-access/tree/v8.2.0" }, "funding": [ { @@ -6495,36 +6620,42 @@ "type": "tidelift" } ], - "time": "2026-07-30T12:40:56+00:00" + "time": "2026-11-27T13:28:56+00:00", + "published-time": "2026-11-28T12:11:09+00:00" }, { "name": "symfony/property-info", - "version": "v8.1.8", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/property-info.git", - "reference": "fe727d4888a92ac9200a2c1b8e0a995b6022afa7" + "reference": "b9383c59655b11ce74c656580470a386ffb36a8f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-info/zipball/fe727d4888a92ac9200a2c1b8e0a995b6022afa7", - "reference": "fe727d4888a92ac9200a2c1b8e0a995b6022afa7", + "url": "https://api.github.com/repos/symfony/property-info/zipball/b9383c59655b11ce74c656580470a386ffb36a8f", + "reference": "b9383c59655b11ce74c656580470a386ffb36a8f", "shasum": "" }, "require": { "php": ">=8.4.1", "symfony/string": "^7.4|^8.0", - "symfony/type-info": "^7.4.7|^8.0.7" + "symfony/type-info": "^7.4.24|^8.1.12" }, "conflict": { "phpdocumentor/reflection-docblock": "<5.2|>=7", - "phpdocumentor/type-resolver": "<1.5.1" + "phpdocumentor/type-resolver": "<1.5.1", + "symfony/cache": "<8.2", + "symfony/config": "<8.2", + "symfony/dependency-injection": "<8.2" }, "require-dev": { "phpdocumentor/reflection-docblock": "^5.2|^6.0", "phpstan/phpdoc-parser": "^1.0|^2.0", "symfony/cache": "^7.4|^8.0", - "symfony/dependency-injection": "^7.4|^8.0", + "symfony/config": "^8.2", + "symfony/dependency-injection": "^8.2", + "symfony/http-kernel": "^7.4|^8.0", "symfony/serializer": "^7.4|^8.0" }, "type": "library", @@ -6561,7 +6692,7 @@ "validator" ], "support": { - "source": "https://github.com/symfony/property-info/tree/v8.1.8" + "source": "https://github.com/symfony/property-info/tree/v8.2.0" }, "funding": [ { @@ -6581,32 +6712,43 @@ "type": "tidelift" } ], - "time": "2026-09-28T19:13:15+00:00" + "time": "2026-11-23T20:28:37+00:00", + "published-time": "2026-11-28T12:13:06+00:00" }, { "name": "symfony/routing", - "version": "v8.1.9", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "edb06fb6ced3c1faaaed74c1c6c0f176a614c330" + "reference": "8011ee5bd1b7a9236b9f2292ca8e674ab2c8ca0a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/edb06fb6ced3c1faaaed74c1c6c0f176a614c330", - "reference": "edb06fb6ced3c1faaaed74c1c6c0f176a614c330", + "url": "https://api.github.com/repos/symfony/routing/zipball/8011ee5bd1b7a9236b9f2292ca8e674ab2c8ca0a", + "reference": "8011ee5bd1b7a9236b9f2292ca8e674ab2c8ca0a", "shasum": "" }, "require": { "php": ">=8.4.1", "symfony/deprecation-contracts": "^2.5|^3" }, + "conflict": { + "symfony/config": "<8.2", + "symfony/console": "<8.2", + "symfony/dependency-injection": "<8.2", + "symfony/framework-bundle": "<8.2" + }, "require-dev": { + "psr/container": "^1.1|^2.0", "psr/log": "^1|^2|^3", - "symfony/config": "^7.4|^8.0", - "symfony/dependency-injection": "^7.4|^8.0", + "symfony/config": "^8.2", + "symfony/console": "^8.2", + "symfony/dependency-injection": "^8.2", "symfony/expression-language": "^7.4|^8.0", "symfony/http-foundation": "^7.4|^8.0", + "symfony/http-kernel": "^7.4|^8.0", + "symfony/service-contracts": "^2.5|^3", "symfony/yaml": "^7.4|^8.0" }, "type": "library", @@ -6641,7 +6783,7 @@ "url" ], "support": { - "source": "https://github.com/symfony/routing/tree/v8.1.9" + "source": "https://github.com/symfony/routing/tree/v8.2.0" }, "funding": [ { @@ -6661,20 +6803,21 @@ "type": "tidelift" } ], - "time": "2026-10-12T12:37:13+00:00" + "time": "2026-11-24T18:01:43+00:00", + "published-time": "2026-11-28T12:12:00+00:00" }, { "name": "symfony/serializer", - "version": "v8.1.9", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/serializer.git", - "reference": "bc6f84d67225d7a25d56af6d4bd52e9e34997a96" + "reference": "1f4e3b5cde126e0c542bbead01fcfe4611a693cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/serializer/zipball/bc6f84d67225d7a25d56af6d4bd52e9e34997a96", - "reference": "bc6f84d67225d7a25d56af6d4bd52e9e34997a96", + "url": "https://api.github.com/repos/symfony/serializer/zipball/1f4e3b5cde126e0c542bbead01fcfe4611a693cb", + "reference": "1f4e3b5cde126e0c542bbead01fcfe4611a693cb", "shasum": "" }, "require": { @@ -6685,20 +6828,26 @@ "conflict": { "phpdocumentor/reflection-docblock": "<5.2|>=7", "phpdocumentor/type-resolver": "<1.5.1", + "symfony/cache": "<8.2", + "symfony/config": "<8.2", + "symfony/console": "<8.2", + "symfony/dependency-injection": "<8.2", + "symfony/framework-bundle": "<8.2", "symfony/property-access": "<8.1", "symfony/property-info": "<7.4.15", - "symfony/type-info": "<7.4" + "symfony/type-info": "<8.2" }, "require-dev": { "phpdocumentor/reflection-docblock": "^5.2|^6.0", "phpstan/phpdoc-parser": "^1.0|^2.0", "seld/jsonlint": "^1.10", "symfony/cache": "^7.4|^8.0", - "symfony/config": "^7.4|^8.0", - "symfony/console": "^7.4|^8.0", - "symfony/dependency-injection": "^7.4|^8.0", + "symfony/config": "^8.2", + "symfony/console": "^8.2", + "symfony/dependency-injection": "^8.2", "symfony/error-handler": "^7.4|^8.0", "symfony/filesystem": "^7.4|^8.0", + "symfony/finder": "^7.4|^8.0", "symfony/form": "^7.4|^8.0", "symfony/http-foundation": "^7.4|^8.0", "symfony/http-kernel": "^7.4|^8.0", @@ -6707,7 +6856,7 @@ "symfony/property-access": "^8.1", "symfony/property-info": "^7.4.15|~8.0.15|^8.1.2", "symfony/translation-contracts": "^2.5|^3", - "symfony/type-info": "^7.4|^8.0", + "symfony/type-info": "^8.2", "symfony/uid": "^7.4|^8.0", "symfony/validator": "^7.4|^8.0", "symfony/var-dumper": "^7.4|^8.0", @@ -6740,7 +6889,7 @@ "description": "Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/serializer/tree/v8.1.9" + "source": "https://github.com/symfony/serializer/tree/v8.2.0" }, "funding": [ { @@ -6760,20 +6909,21 @@ "type": "tidelift" } ], - "time": "2026-10-12T19:11:16+00:00" + "time": "2026-11-27T14:09:33+00:00", + "published-time": "2026-11-28T12:12:51+00:00" }, { "name": "symfony/service-contracts", - "version": "v3.7.3", + "version": "v3.8.1", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "15e6a07ec2a2c75ceb1b21dd98105ee8456d2257" + "reference": "052852a96fd5e5ebdb617dba22031e41a3300fb5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/15e6a07ec2a2c75ceb1b21dd98105ee8456d2257", - "reference": "15e6a07ec2a2c75ceb1b21dd98105ee8456d2257", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/052852a96fd5e5ebdb617dba22031e41a3300fb5", + "reference": "052852a96fd5e5ebdb617dba22031e41a3300fb5", "shasum": "" }, "require": { @@ -6791,7 +6941,7 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "3.7-dev" + "dev-main": "3.8-dev" } }, "autoload": { @@ -6827,7 +6977,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.7.3" + "source": "https://github.com/symfony/service-contracts/tree/v3.8.1" }, "funding": [ { @@ -6847,20 +6997,21 @@ "type": "tidelift" } ], - "time": "2026-07-27T15:39:01+00:00" + "time": "2026-10-20T17:38:25+00:00", + "published-time": "2026-11-04T11:25:33+00:00" }, { "name": "symfony/string", - "version": "v8.1.9", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "07fb208558f941eab50ec49c89c2a6a93fb11f01" + "reference": "24a5a339853a0742edfc8a456d55e3314d489555" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/07fb208558f941eab50ec49c89c2a6a93fb11f01", - "reference": "07fb208558f941eab50ec49c89c2a6a93fb11f01", + "url": "https://api.github.com/repos/symfony/string/zipball/24a5a339853a0742edfc8a456d55e3314d489555", + "reference": "24a5a339853a0742edfc8a456d55e3314d489555", "shasum": "" }, "require": { @@ -6917,7 +7068,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v8.1.9" + "source": "https://github.com/symfony/string/tree/v8.2.0" }, "funding": [ { @@ -6937,20 +7088,21 @@ "type": "tidelift" } ], - "time": "2026-10-03T15:16:03+00:00" + "time": "2026-11-27T13:28:56+00:00", + "published-time": "2026-11-28T12:12:38+00:00" }, { "name": "symfony/translation", - "version": "v8.1.5", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "d9e1caba0d6b6f9a26710af8a2f88d37f001215a" + "reference": "264c617ec5632d333b0802fa17c3736ecce72125" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/d9e1caba0d6b6f9a26710af8a2f88d37f001215a", - "reference": "d9e1caba0d6b6f9a26710af8a2f88d37f001215a", + "url": "https://api.github.com/repos/symfony/translation/zipball/264c617ec5632d333b0802fa17c3736ecce72125", + "reference": "264c617ec5632d333b0802fa17c3736ecce72125", "shasum": "" }, "require": { @@ -6960,6 +7112,10 @@ }, "conflict": { "nikic/php-parser": "<5.0", + "symfony/config": "<8.2", + "symfony/console": "<8.2", + "symfony/dependency-injection": "<8.2", + "symfony/framework-bundle": "<8.2", "symfony/http-client-contracts": "<2.5", "symfony/service-contracts": "<2.5" }, @@ -6968,11 +7124,13 @@ }, "require-dev": { "nikic/php-parser": "^5.0", + "psr/container": "^1.1|^2.0", "psr/log": "^1|^2|^3", - "symfony/config": "^7.4|^8.0", - "symfony/console": "^7.4|^8.0", - "symfony/dependency-injection": "^7.4|^8.0", + "symfony/config": "^8.2", + "symfony/console": "^8.2", + "symfony/dependency-injection": "^8.2", "symfony/finder": "^7.4|^8.0", + "symfony/framework-bundle": "^8.2", "symfony/http-client-contracts": "^2.5|^3.0", "symfony/http-kernel": "^7.4|^8.0", "symfony/intl": "^7.4|^8.0", @@ -7010,7 +7168,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v8.1.5" + "source": "https://github.com/symfony/translation/tree/v8.2.0" }, "funding": [ { @@ -7030,20 +7188,21 @@ "type": "tidelift" } ], - "time": "2026-08-21T17:47:34+00:00" + "time": "2026-11-26T07:35:06+00:00", + "published-time": "2026-11-28T12:11:43+00:00" }, { "name": "symfony/translation-contracts", - "version": "v3.7.1", + "version": "v3.8.1", "source": { "type": "git", "url": "https://github.com/symfony/translation-contracts.git", - "reference": "ccb206b98faccc511ebae8e5fad50f2dc0b30621" + "reference": "0a3ae917402632fcba2aeddae9c98332f3d7dd05" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/ccb206b98faccc511ebae8e5fad50f2dc0b30621", - "reference": "ccb206b98faccc511ebae8e5fad50f2dc0b30621", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/0a3ae917402632fcba2aeddae9c98332f3d7dd05", + "reference": "0a3ae917402632fcba2aeddae9c98332f3d7dd05", "shasum": "" }, "require": { @@ -7056,7 +7215,7 @@ "name": "symfony/contracts" }, "branch-alias": { - "dev-main": "3.7-dev" + "dev-main": "3.8-dev" } }, "autoload": { @@ -7092,7 +7251,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/translation-contracts/tree/v3.7.1" + "source": "https://github.com/symfony/translation-contracts/tree/v3.8.1" }, "funding": [ { @@ -7112,20 +7271,21 @@ "type": "tidelift" } ], - "time": "2026-06-05T06:23:12+00:00" + "time": "2026-10-03T08:17:19+00:00", + "published-time": "2026-11-04T11:25:31+00:00" }, { "name": "symfony/type-info", - "version": "v8.1.8", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/type-info.git", - "reference": "18e1d891f0b8776141f281f7b6f5e67e4df9d9cd" + "reference": "5c580dedcbcd312b8544af28f0a6bb7cf375d4fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/type-info/zipball/18e1d891f0b8776141f281f7b6f5e67e4df9d9cd", - "reference": "18e1d891f0b8776141f281f7b6f5e67e4df9d9cd", + "url": "https://api.github.com/repos/symfony/type-info/zipball/5c580dedcbcd312b8544af28f0a6bb7cf375d4fc", + "reference": "5c580dedcbcd312b8544af28f0a6bb7cf375d4fc", "shasum": "" }, "require": { @@ -7133,10 +7293,13 @@ "psr/container": "^1.1|^2.0" }, "conflict": { - "phpstan/phpdoc-parser": "<1.30" + "phpstan/phpdoc-parser": "<1.30", + "symfony/dependency-injection": "<8.1" }, "require-dev": { - "phpstan/phpdoc-parser": "^1.30|^2.0" + "phpstan/phpdoc-parser": "^1.30|^2.0", + "symfony/config": "^7.4|^8.0", + "symfony/dependency-injection": "^8.1" }, "type": "library", "autoload": { @@ -7174,7 +7337,7 @@ "type" ], "support": { - "source": "https://github.com/symfony/type-info/tree/v8.1.8" + "source": "https://github.com/symfony/type-info/tree/v8.2.0" }, "funding": [ { @@ -7194,28 +7357,35 @@ "type": "tidelift" } ], - "time": "2026-09-28T19:13:15+00:00" + "time": "2026-11-16T12:56:42+00:00", + "published-time": "2026-11-28T12:11:50+00:00" }, { "name": "symfony/uid", - "version": "v8.1.9", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/uid.git", - "reference": "cb487cf30380f0b0b090973bb9c0588193c06685" + "reference": "99e23541e3c9f3ef266be02ff7556671bbdd4544" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/uid/zipball/cb487cf30380f0b0b090973bb9c0588193c06685", - "reference": "cb487cf30380f0b0b090973bb9c0588193c06685", + "url": "https://api.github.com/repos/symfony/uid/zipball/99e23541e3c9f3ef266be02ff7556671bbdd4544", + "reference": "99e23541e3c9f3ef266be02ff7556671bbdd4544", "shasum": "" }, "require": { - "php": ">=8.4.1", - "symfony/polyfill-uuid": "^1.15" + "php": ">=8.4.1" + }, + "conflict": { + "symfony/console": "<8.2", + "symfony/dependency-injection": "<8.1" }, "require-dev": { - "symfony/console": "^7.4|^8.0" + "symfony/config": "^7.4|^8.0", + "symfony/console": "^8.2", + "symfony/dependency-injection": "^8.1", + "symfony/http-kernel": "^7.4|^8.0" }, "type": "library", "autoload": { @@ -7252,7 +7422,7 @@ "uuid" ], "support": { - "source": "https://github.com/symfony/uid/tree/v8.1.9" + "source": "https://github.com/symfony/uid/tree/v8.2.0" }, "funding": [ { @@ -7272,20 +7442,21 @@ "type": "tidelift" } ], - "time": "2026-10-12T14:32:04+00:00" + "time": "2026-10-22T16:53:57+00:00", + "published-time": "2026-11-28T12:13:01+00:00" }, { "name": "symfony/var-dumper", - "version": "v8.1.9", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "b8c168c764c09f5d931f290c9dbdd13f1bf142f3" + "reference": "459bfdcf52cdea470ff75ce9a81b91acf6b90964" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/b8c168c764c09f5d931f290c9dbdd13f1bf142f3", - "reference": "b8c168c764c09f5d931f290c9dbdd13f1bf142f3", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/459bfdcf52cdea470ff75ce9a81b91acf6b90964", + "reference": "459bfdcf52cdea470ff75ce9a81b91acf6b90964", "shasum": "" }, "require": { @@ -7293,12 +7464,13 @@ "symfony/polyfill-mbstring": "^1.0" }, "conflict": { - "symfony/console": "<7.4", + "symfony/console": "<8.2", "symfony/error-handler": "<7.4" }, "require-dev": { - "symfony/console": "^7.4|^8.0", + "symfony/console": "^8.2", "symfony/http-kernel": "^7.4|^8.0", + "symfony/messenger": "^7.4|^8.0", "symfony/process": "^7.4|^8.0", "symfony/uid": "^7.4|^8.0", "twig/twig": "^3.12|^4.0" @@ -7339,7 +7511,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v8.1.9" + "source": "https://github.com/symfony/var-dumper/tree/v8.2.0" }, "funding": [ { @@ -7359,7 +7531,8 @@ "type": "tidelift" } ], - "time": "2026-10-13T05:48:51+00:00" + "time": "2026-11-12T10:33:36+00:00", + "published-time": "2026-11-28T12:12:43+00:00" }, { "name": "tijsverkoyen/css-to-inline-styles", @@ -7414,20 +7587,21 @@ "issues": "https://github.com/tijsverkoyen/CssToInlineStyles/issues", "source": "https://github.com/tijsverkoyen/CssToInlineStyles/tree/v2.4.0" }, - "time": "2025-12-02T11:56:42+00:00" + "time": "2025-12-02T11:56:42+00:00", + "published-time": "2025-12-11T21:29:16+00:00" }, { "name": "vlucas/phpdotenv", - "version": "v5.8.0", + "version": "v5.8.1", "source": { "type": "git", "url": "https://github.com/phpdotenv/phpdotenv.git", - "reference": "96149103e62ac67e915f6d2ef59b72dee2e011e0" + "reference": "ba37876e98122ca15151247ce1187d20ee8bf4e0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpdotenv/phpdotenv/zipball/96149103e62ac67e915f6d2ef59b72dee2e011e0", - "reference": "96149103e62ac67e915f6d2ef59b72dee2e011e0", + "url": "https://api.github.com/repos/phpdotenv/phpdotenv/zipball/ba37876e98122ca15151247ce1187d20ee8bf4e0", + "reference": "ba37876e98122ca15151247ce1187d20ee8bf4e0", "shasum": "" }, "require": { @@ -7486,7 +7660,7 @@ ], "support": { "issues": "https://github.com/phpdotenv/phpdotenv/issues", - "source": "https://github.com/phpdotenv/phpdotenv/tree/v5.8.0" + "source": "https://github.com/phpdotenv/phpdotenv/tree/v5.8.1" }, "funding": [ { @@ -7498,7 +7672,8 @@ "type": "tidelift" } ], - "time": "2026-10-25T16:26:19+00:00" + "time": "2026-11-23T00:53:11+00:00", + "published-time": "2026-11-23T00:53:39+00:00" }, { "name": "voku/portable-ascii", @@ -7572,7 +7747,8 @@ "type": "tidelift" } ], - "time": "2026-04-26T05:33:54+00:00" + "time": "2026-04-26T05:33:54+00:00", + "published-time": "2026-04-26T05:43:38+00:00" }, { "name": "web-auth/cose-lib", @@ -7647,20 +7823,21 @@ "type": "patreon" } ], - "time": "2026-09-15T17:30:33+00:00" + "time": "2026-09-15T17:30:33+00:00", + "published-time": "2026-09-15T17:39:51+00:00" }, { "name": "web-auth/webauthn-lib", - "version": "5.3.9", + "version": "5.3.17", "source": { "type": "git", "url": "https://github.com/web-auth/webauthn-lib.git", - "reference": "727e378fb7a36c26be5c911e4a0120c146741ce7" + "reference": "7f38dbcf07cd22ec104fa6eb720df22eb4196b47" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/web-auth/webauthn-lib/zipball/727e378fb7a36c26be5c911e4a0120c146741ce7", - "reference": "727e378fb7a36c26be5c911e4a0120c146741ce7", + "url": "https://api.github.com/repos/web-auth/webauthn-lib/zipball/7f38dbcf07cd22ec104fa6eb720df22eb4196b47", + "reference": "7f38dbcf07cd22ec104fa6eb720df22eb4196b47", "shasum": "" }, "require": { @@ -7721,7 +7898,7 @@ "webauthn" ], "support": { - "source": "https://github.com/web-auth/webauthn-lib/tree/5.3.9" + "source": "https://github.com/web-auth/webauthn-lib/tree/5.3.17" }, "funding": [ { @@ -7733,20 +7910,21 @@ "type": "patreon" } ], - "time": "2026-09-10T21:10:45+00:00" + "time": "2026-11-23T18:46:47+00:00", + "published-time": "2026-11-24T07:58:53+00:00" }, { "name": "webmozart/assert", - "version": "2.5.0", + "version": "2.5.1", "source": { "type": "git", "url": "https://github.com/webmozarts/assert.git", - "reference": "8a163706bbcac613733dba03f51e13b5eb1bb819" + "reference": "e578132c01bd0c64108386ab20d8217cd175ddec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/8a163706bbcac613733dba03f51e13b5eb1bb819", - "reference": "8a163706bbcac613733dba03f51e13b5eb1bb819", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/e578132c01bd0c64108386ab20d8217cd175ddec", + "reference": "e578132c01bd0c64108386ab20d8217cd175ddec", "shasum": "" }, "require": { @@ -7797,9 +7975,10 @@ ], "support": { "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/2.5.0" + "source": "https://github.com/webmozarts/assert/tree/2.5.1" }, - "time": "2026-10-05T23:14:19+00:00" + "time": "2026-11-15T13:41:13+00:00", + "published-time": "2026-11-15T13:41:42+00:00" } ], "packages-dev": [ @@ -11513,16 +11692,16 @@ }, { "name": "symfony/yaml", - "version": "v8.1.9", + "version": "v8.2.0", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "6107ee26a25215c3df3af0a3315e56bb4fd0b7db" + "reference": "f73c6c770da98c69037cccfebc314cead3333599" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/6107ee26a25215c3df3af0a3315e56bb4fd0b7db", - "reference": "6107ee26a25215c3df3af0a3315e56bb4fd0b7db", + "url": "https://api.github.com/repos/symfony/yaml/zipball/f73c6c770da98c69037cccfebc314cead3333599", + "reference": "f73c6c770da98c69037cccfebc314cead3333599", "shasum": "" }, "require": { @@ -11530,10 +11709,11 @@ "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "symfony/console": "<7.4" + "symfony/console": "<8.2" }, "require-dev": { - "symfony/console": "^7.4|^8.0", + "opis/json-schema": "^2.6", + "symfony/console": "^8.2", "yaml/yaml-test-suite": "*" }, "bin": [ @@ -11565,7 +11745,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v8.1.9" + "source": "https://github.com/symfony/yaml/tree/v8.2.0" }, "funding": [ { @@ -11585,7 +11765,8 @@ "type": "tidelift" } ], - "time": "2026-10-12T12:37:13+00:00" + "time": "2026-11-27T13:28:56+00:00", + "published-time": "2026-11-28T12:11:52+00:00" }, { "name": "ta-tikoma/phpunit-architecture-test", @@ -11706,5 +11887,5 @@ "php": "^8.3" }, "platform-dev": {}, - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.11.0" } From d652b03467b4dcbdd97e80d61755be111b8c452f Mon Sep 17 00:00:00 2001 From: Osmane Nala Date: Mon, 30 Nov 2026 23:01:36 +0200 Subject: [PATCH 02/19] Corrigir hash do pacote inventory-write de desenvolvimento MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit O pin do manifest.json tinha sido calculado sobre a cópia CRLF do Windows; o git guarda LF, por isso qualquer clone limpo recusava o escritor de recepção. Pin actualizado para os bytes canónicos e pacotes inventory-*/order-cancellation marcados -text para preservar os bytes exactos. Co-Authored-By: Claude Opus 5.5 --- .gitattributes | 2 ++ app/Services/AgreementOrderLimits.php | 2 +- app/Services/ReceiptStockMovement.php | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitattributes b/.gitattributes index 4638d9f..a8f47d0 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,6 +3,8 @@ # Preserve the exact bytes of pinned shared runtime artifacts and their hashes. /packages/budget-control/** -text /packages/payables/** -text +/packages/inventory-*/** -text +/packages/order-cancellation/** -text /resources/data/geography/cartografia-moz.json -text whitespace=cr-at-eol *.blade.php diff=html diff --git a/app/Services/AgreementOrderLimits.php b/app/Services/AgreementOrderLimits.php index 8f91a8a..f07207d 100644 --- a/app/Services/AgreementOrderLimits.php +++ b/app/Services/AgreementOrderLimits.php @@ -267,7 +267,7 @@ final class AgreementOrderLimits } $root = base_path('packages/inventory-write/development'); $bytes = file_get_contents($root.'/manifest.json'); - if ($bytes === false || ! hash_equals('90cf565537e7fd48eb54a87bcfd6d585cf53239f075764910047838b3b8b4c38', hash('sha256', $bytes))) { + if ($bytes === false || ! hash_equals('c7ba216ff4f61f1435f7fc7ac423bf56dc729c228aa3acb165b960675cb96dbb', hash('sha256', $bytes))) { throw new \LogicException('Artefacto aritmético incompatível.'); } $manifest = json_decode($bytes, true, 512, JSON_THROW_ON_ERROR); diff --git a/app/Services/ReceiptStockMovement.php b/app/Services/ReceiptStockMovement.php index 5581973..929a84b 100644 --- a/app/Services/ReceiptStockMovement.php +++ b/app/Services/ReceiptStockMovement.php @@ -26,7 +26,7 @@ final class ReceiptStockMovement abort_unless(($connection->getDriverName() === 'sqlite' && $connection->getDatabaseName() === ':memory:') || ($connection->getDriverName() === 'pgsql' && preg_match('/^compras_receipts_test_[a-f0-9]{12}$/D', $connection->getDatabaseName())), 503, 'Base QA isolada obrigatória.'); $root = base_path('packages/inventory-write/development'); - $pin = '90cf565537e7fd48eb54a87bcfd6d585cf53239f075764910047838b3b8b4c38'; + $pin = 'c7ba216ff4f61f1435f7fc7ac423bf56dc729c228aa3acb165b960675cb96dbb'; $files[] = 'src/QuantityConversion.php'; } else { $conversion->assertLegacyCompatible(); From 7615accf0746a86071924806d2652d5a23152965 Mon Sep 17 00:00:00 2001 From: Osmane Nala Date: Mon, 30 Nov 2026 23:01:36 +0200 Subject: [PATCH 03/19] Corrigir os dois erros do PHPStan MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - private-audit: env() pode devolver bool; só descodifica JSON quando é texto. - migração de rascunhos: recriar triggers SQLite com DB::statement. Co-Authored-By: Claude Opus 5.5 --- config/private-audit.php | 6 +++++- ...026_11_22_000002_allow_incomplete_requisition_drafts.php | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/config/private-audit.php b/config/private-audit.php index 614d4c2..c0b5c9a 100644 --- a/config/private-audit.php +++ b/config/private-audit.php @@ -1,7 +1,11 @@ false, // Explicit installation transition receipt: tenant => immutable export ID => original SHA-256. - 'legacy_export_transitions' => json_decode(env('COMPRAS_AUDIT_LEGACY_TRANSITIONS', '{}'), true, 32, JSON_THROW_ON_ERROR), + 'legacy_export_transitions' => is_string($legacyTransitions) && $legacyTransitions !== '' + ? json_decode($legacyTransitions, true, 32, JSON_THROW_ON_ERROR) + : [], ]; diff --git a/database/migrations/2026_11_22_000002_allow_incomplete_requisition_drafts.php b/database/migrations/2026_11_22_000002_allow_incomplete_requisition_drafts.php index 7df8ae7..b047f3b 100644 --- a/database/migrations/2026_11_22_000002_allow_incomplete_requisition_drafts.php +++ b/database/migrations/2026_11_22_000002_allow_incomplete_requisition_drafts.php @@ -61,7 +61,8 @@ return new class extends Migration { foreach ($triggers as $name => $sql) { if (! DB::table('sqlite_master')->where('type', 'trigger')->where('name', $name)->exists()) { - DB::unprepared($sql); + // Re-create the trigger exactly as SQLite stored it before the table rebuild. + DB::statement($sql); } } } From 8e1e8799a539ae7daeeab0724fe13de96c948ace Mon Sep 17 00:00:00 2001 From: Osmane Nala Date: Mon, 30 Nov 2026 23:01:36 +0200 Subject: [PATCH 04/19] =?UTF-8?q?Tornar=20a=20suite=20de=20testes=20port?= =?UTF-8?q?=C3=A1vel=20e=20alinhada=20com=20o=20c=C3=B3digo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - sgfTempoPath(): substitui caminhos C:/laragon fixos (SGF_TEMPO_ROOT, por omissão a pasta irmã sgf-tempo, igual ao Laragon). - skipUnlessIsolatedPostgres(): testes que exigem a base QA PostgreSQL isolada passam a ser ignorados com motivo em SQLite em vez de rebentar. - Artefacto de distribuição orçamental gerado localmente: ignorado se ausente. - Páginas públicas /consulta e /proposta: testes alinhados com os redireccionamentos para os módulos reais (decisão de 29/11). - Impressão da ordem: texto do aviso orçamental actualizado. Co-Authored-By: Claude Opus 5.5 --- .../BudgetDistributionArtifactTest.php | 6 + tests/Feature/CommonReceiptStockTest.php | 196 ++++-- tests/Feature/CommonStockReadTest.php | 89 ++- tests/Feature/ExampleTest.php | 6 +- tests/Feature/InvestmentPolicyTest.php | 5 +- tests/Feature/NativePayablePageTest.php | 289 ++++++-- tests/Feature/PublicPreviewTest.php | 42 +- tests/Feature/PurchaseAwardOrderTest.php | 6 +- tests/Feature/ReceiptAdapterReplayTest.php | 36 +- .../Feature/RequisitionLedgerAccountsTest.php | 4 +- tests/Feature/StockOperationsTest.php | 4 +- tests/Feature/SupplierBankTest.php | 5 +- .../WarehouseReturnIntegrationTest.php | 641 ++++++++++++++---- tests/Pest.php | 20 +- tests/Support/RequisitionLedgerQaRuntime.php | 2 +- tests/Unit/BudgetDistributionPlanTest.php | 10 +- 16 files changed, 1062 insertions(+), 299 deletions(-) diff --git a/tests/Feature/BudgetDistributionArtifactTest.php b/tests/Feature/BudgetDistributionArtifactTest.php index 0d1e21a..9beb760 100644 --- a/tests/Feature/BudgetDistributionArtifactTest.php +++ b/tests/Feature/BudgetDistributionArtifactTest.php @@ -6,6 +6,9 @@ use Symfony\Component\Process\Process; beforeEach(function () { $proof = json_decode(file_get_contents(base_path('docs/proofs/rq01-distribution-artifact.json')), true, 32, JSON_THROW_ON_ERROR); + if (! is_dir(base_path($proof['path']))) { + $this->markTestSkipped('The frozen distribution artifact is generated locally by scripts/prepare-budget-distribution-artifact.php.'); + } $this->artifactDirectory = storage_path('framework/testing/distribution-integrity-'.Str::uuid()); mkdir($this->artifactDirectory.'/src', 0700, true); foreach ($proof['files'] as $file => $hash) { @@ -18,6 +21,9 @@ beforeEach(function () { }); afterEach(function () { + if (! isset($this->artifactDirectory)) { + return; + } foreach (glob($this->artifactDirectory.'/src/*') as $file) { unlink($file); } diff --git a/tests/Feature/CommonReceiptStockTest.php b/tests/Feature/CommonReceiptStockTest.php index 60134ef..64a47f4 100644 --- a/tests/Feature/CommonReceiptStockTest.php +++ b/tests/Feature/CommonReceiptStockTest.php @@ -2,9 +2,15 @@ namespace Tests\Feature; -use App\Models\{GoodsReceipt,GoodsReceiptItem,StockMovement}; -use App\Services\{ConflictGuard,ReceiptStockMovement,ReceiptWorkflow}; -use Illuminate\Support\Facades\{Artisan,DB}; +use App\Models\GoodsReceipt; +use App\Models\GoodsReceiptItem; +use App\Models\StockMovement; +use App\Services\ConflictGuard; +use App\Services\ReceiptStockMovement; +use App\Services\ReceiptWorkflow; +use Illuminate\Support\Facades\Artisan; +use Illuminate\Support\Facades\DB; +use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; use Tests\TestCase; require_once __DIR__.'/../Support/ReceiptFixture.php'; @@ -13,59 +19,141 @@ final class CommonReceiptStockTest extends TestCase { public function test_native_receipt_shared_writer_and_single_book_evidence(): void { - $i=DB::selectOne("SELECT current_database() AS name,current_user AS role,inet_server_port() AS port,current_setting('cluster_name') AS cluster"); - $this->assertMatchesRegularExpression('/^compras_receipts_test_([a-f0-9]{12})$/D',$i->name);$tag=substr($i->name,-12); - $this->assertSame('stock_receipt_qa_'.$tag,$i->role);$this->assertSame(55439,(int)$i->port);$this->assertSame('sgf_modular_regression_'.getenv('SGF_ISOLATED_REGRESSION_RUN'),$i->cluster); - if(!DB::getSchemaBuilder()->hasTable('users')){Artisan::call('migrate',['--force'=>true]);} - $this->assertSame(0,DB::table('users')->count(),'Use the fresh QA database, never a retained fixture'); - $root=realpath((string)getenv('STOCK_RECEIPT_ROOT'));$this->assertNotFalse($root); - $f=\receiptFixture('10.000');$this->actingAs($f['receiver']);$url='/ordens/'.$f['order']->id.'/recepcoes'; - $body=\receiptPayload($f,'6.000');$body['items'][0]['accepted_quantity']='4.000';$body['items'][0]['quality_status']='reservations';$body['items'][0]['notes']='Synthetic acceptance: four accepted, two damaged.'; - $receipt=$this->postJson($url,$body)->assertCreated()->json('id'); - $this->postJson($url,$body)->assertOk()->assertJsonPath('id',$receipt)->assertJsonPath('created',false); - $line=GoodsReceiptItem::query()->where('goods_receipt_id',$receipt)->firstOrFail();$movement=StockMovement::query()->where('goods_receipt_item_id',$line->id)->firstOrFail(); - $this->assertSame(4000,(int)$movement->quantity_milli);$this->assertSame(2000,(int)$line->rejected_milli); - $this->assertMatchesRegularExpression('/^[a-f0-9]{64}$/D',$movement->snapshot['inventory_source_hash']); - $coreReplay=DB::transaction(function () use ($f,$line,$movement){ - app(ConflictGuard::class)->lockCompany($f['receiver']);$w=app(ReceiptStockMovement::class)->for($f['receiver']); - return $w->write($line->id,$movement->snapshot['inventory_source_hash']); - });$this->assertTrue($coreReplay['replayed']);$this->assertSame($movement->id,$coreReplay['movement_id']); - try{DB::transaction(function()use($f,$line){app(ConflictGuard::class)->lockCompany($f['receiver']);app(ReceiptStockMovement::class)->for($f['receiver'])->write($line->id,str_repeat('0',64));});$this->fail('Old origin hash must be refused');} - catch(\Symfony\Component\HttpKernel\Exception\HttpExceptionInterface $e){$this->assertSame(409,$e->getStatusCode());} - $bad=$body;$bad['items'][0]['accepted_quantity']='3.000';$this->postJson($url,$bad)->assertUnprocessable(); - $rejected=\receiptPayload($f,'2.000');$rejected['warehouse_id']=null;$rejected['items'][0]['stock_item_id']=null;$rejected['items'][0]['accepted_quantity']='0';$rejected['items'][0]['quality_status']='nonconforming';$rejected['items'][0]['notes']='Synthetic rejection.'; - $this->postJson($url,$rejected)->assertCreated()->assertJsonPath('status','rejected'); - $this->assertSame(1,StockMovement::query()->count()); - $this->actingAs($f['issuer'])->postJson($url,\receiptPayload($f,'1.000'))->assertForbidden();$this->actingAs($f['receiver']); + skipUnlessIsolatedPostgres($this); + $i = DB::selectOne("SELECT current_database() AS name,current_user AS role,inet_server_port() AS port,current_setting('cluster_name') AS cluster"); + $this->assertMatchesRegularExpression('/^compras_receipts_test_([a-f0-9]{12})$/D', $i->name); + $tag = substr($i->name, -12); + $this->assertSame('stock_receipt_qa_'.$tag, $i->role); + $this->assertSame(55439, (int) $i->port); + $this->assertSame('sgf_modular_regression_'.getenv('SGF_ISOLATED_REGRESSION_RUN'), $i->cluster); + if (! DB::getSchemaBuilder()->hasTable('users')) { + Artisan::call('migrate', ['--force' => true]); + } + $this->assertSame(0, DB::table('users')->count(), 'Use the fresh QA database, never a retained fixture'); + $root = realpath((string) getenv('STOCK_RECEIPT_ROOT')); + $this->assertNotFalse($root); + $f = \receiptFixture('10.000'); + $this->actingAs($f['receiver']); + $url = '/ordens/'.$f['order']->id.'/recepcoes'; + $body = \receiptPayload($f, '6.000'); + $body['items'][0]['accepted_quantity'] = '4.000'; + $body['items'][0]['quality_status'] = 'reservations'; + $body['items'][0]['notes'] = 'Synthetic acceptance: four accepted, two damaged.'; + $receipt = $this->postJson($url, $body)->assertCreated()->json('id'); + $this->postJson($url, $body)->assertOk()->assertJsonPath('id', $receipt)->assertJsonPath('created', false); + $line = GoodsReceiptItem::query()->where('goods_receipt_id', $receipt)->firstOrFail(); + $movement = StockMovement::query()->where('goods_receipt_item_id', $line->id)->firstOrFail(); + $this->assertSame(4000, (int) $movement->quantity_milli); + $this->assertSame(2000, (int) $line->rejected_milli); + $this->assertMatchesRegularExpression('/^[a-f0-9]{64}$/D', $movement->snapshot['inventory_source_hash']); + $coreReplay = DB::transaction(function () use ($f, $line, $movement) { + app(ConflictGuard::class)->lockCompany($f['receiver']); + $w = app(ReceiptStockMovement::class)->for($f['receiver']); + + return $w->write($line->id, $movement->snapshot['inventory_source_hash']); + }); + $this->assertTrue($coreReplay['replayed']); + $this->assertSame($movement->id, $coreReplay['movement_id']); + try { + DB::transaction(function () use ($f, $line) { + app(ConflictGuard::class)->lockCompany($f['receiver']); + app(ReceiptStockMovement::class)->for($f['receiver'])->write($line->id, str_repeat('0', 64)); + }); + $this->fail('Old origin hash must be refused'); + } catch (HttpExceptionInterface $e) { + $this->assertSame(409, $e->getStatusCode()); + } + $bad = $body; + $bad['items'][0]['accepted_quantity'] = '3.000'; + $this->postJson($url, $bad)->assertUnprocessable(); + $rejected = \receiptPayload($f, '2.000'); + $rejected['warehouse_id'] = null; + $rejected['items'][0]['stock_item_id'] = null; + $rejected['items'][0]['accepted_quantity'] = '0'; + $rejected['items'][0]['quality_status'] = 'nonconforming'; + $rejected['items'][0]['notes'] = 'Synthetic rejection.'; + $this->postJson($url, $rejected)->assertCreated()->assertJsonPath('status', 'rejected'); + $this->assertSame(1, StockMovement::query()->count()); + $this->actingAs($f['issuer'])->postJson($url, \receiptPayload($f, '1.000'))->assertForbidden(); + $this->actingAs($f['receiver']); // Fault after the shared SQL insert must undo receipt, movement and native audit. - $failure=\receiptFixture();$this->actingAs($failure['receiver']);$payload=\receiptPayload($failure,'1.000');$fault=true; - $before=array_map(fn($t)=>DB::table($t)->count(),['goods_receipts','goods_receipt_items','stock_movements','audit_logs']); - DB::listen(function($q)use(&$fault){if($fault&&preg_match('/insert into .*stock_movements/i',$q->sql)){$fault=false;throw new \RuntimeException('Synthetic failure after inventory insert');}}); - try{app(ReceiptWorkflow::class)->confirm($failure['receiver'],$failure['order'],$payload);$this->fail('Injected failure missing');} - catch(\RuntimeException $e){$this->assertSame('Synthetic failure after inventory insert',$e->getMessage());} - $this->assertSame($before,array_map(fn($t)=>DB::table($t)->count(),['goods_receipts','goods_receipt_items','stock_movements','audit_logs'])); - $recovered=app(ReceiptWorkflow::class)->confirm($failure['receiver'],$failure['order'],$payload); - $this->assertSame(1,StockMovement::query()->whereIn('goods_receipt_item_id',$recovered->items->pluck('id'))->count()); + $failure = \receiptFixture(); + $this->actingAs($failure['receiver']); + $payload = \receiptPayload($failure, '1.000'); + $fault = true; + $before = array_map(fn ($t) => DB::table($t)->count(), ['goods_receipts', 'goods_receipt_items', 'stock_movements', 'audit_logs']); + DB::listen(function ($q) use (&$fault) { + if ($fault && preg_match('/insert into .*stock_movements/i', $q->sql)) { + $fault = false; + throw new \RuntimeException('Synthetic failure after inventory insert'); + } + }); + try { + app(ReceiptWorkflow::class)->confirm($failure['receiver'], $failure['order'], $payload); + $this->fail('Injected failure missing'); + } catch (\RuntimeException $e) { + $this->assertSame('Synthetic failure after inventory insert', $e->getMessage()); + } + $this->assertSame($before, array_map(fn ($t) => DB::table($t)->count(), ['goods_receipts', 'goods_receipt_items', 'stock_movements', 'audit_logs'])); + $recovered = app(ReceiptWorkflow::class)->confirm($failure['receiver'], $failure['order'], $payload); + $this->assertSame(1, StockMovement::query()->whereIn('goods_receipt_item_id', $recovered->items->pluck('id'))->count()); // Two real PHP processes contend on the company lock, then recover the same receipt. - $concurrent=\receiptFixture();$this->actingAs($concurrent['receiver']);$payload=\receiptPayload($concurrent,'1.000');$process=null; + $concurrent = \receiptFixture(); + $this->actingAs($concurrent['receiver']); + $payload = \receiptPayload($concurrent, '1.000'); + $process = null; DB::beginTransaction(); - try{ - $winner=app(ReceiptWorkflow::class)->confirm($concurrent['receiver'],$concurrent['order'],$payload); - $input=$root.'/worker.json';$application='stock_receipt_worker_'.$tag; - file_put_contents($input,json_encode(['actor'=>$concurrent['receiver']->id,'order'=>$concurrent['order']->id,'payload'=>$payload,'application'=>$application],JSON_THROW_ON_ERROR)); - $pipes=[];$process=proc_open([PHP_BINARY,base_path('tests/Support/common-receipt-worker.php'),$input],[0=>['pipe','r'],1=>['file',$root.'/worker.stdout','w'],2=>['file',$root.'/worker.stderr','w']],$pipes,base_path()); - $this->assertIsResource($process);fclose($pipes[0]);$deadline=microtime(true)+10;$wait=null;$parent=(int)DB::selectOne('SELECT pg_backend_pid() AS pid')->pid; - do{DB::select('SELECT pg_stat_clear_snapshot()');$wait=DB::selectOne("SELECT wait_event,to_json(pg_blocking_pids(pid)) AS blockers FROM pg_stat_activity WHERE application_name=? AND wait_event_type='Lock'",[$application]);if(!$wait)usleep(25000);}while(!$wait&µtime(true)<$deadline); - $this->assertNotNull($wait);$this->assertContains($parent,json_decode($wait->blockers,true));DB::commit(); - $deadline=microtime(true)+15;do{$status=proc_get_status($process);if(!$status['running'])break;usleep(25000);}while(microtime(true)<$deadline); - $this->assertFalse($status['running']);$exit=proc_close($process);$process=null;if($exit===-1)$exit=$status['exitcode'];$this->assertSame(0,$exit); - $second=json_decode(file_get_contents($input.'.result'),true,512,JSON_THROW_ON_ERROR);$this->assertSame(200,$second['status']);$this->assertSame($winner->id,$second['receipt_id']); - $this->assertSame(1,GoodsReceipt::query()->where('purchase_order_id',$concurrent['order']->id)->count()); - $this->assertSame(1,StockMovement::query()->whereIn('goods_receipt_item_id',$winner->items->pluck('id'))->count()); - }finally{if(is_resource($process)){proc_terminate($process);proc_close($process);}while(DB::transactionLevel()>0)DB::rollBack();} - file_put_contents($root.'/receipt-results.json',json_encode(['identity'=>$i,'physical_accepted_milli'=>4000,'rejected_milli'=>2000,'movement_count_main'=>1, - 'source_version_stale_refused'=>true,'core_replay_same_movement'=>true,'fault_atomic_and_recovered'=>true,'concurrency'=>['actual_lock_wait'=>true,'wait_event'=>$wait->wait_event,'same_receipt'=>true,'one_movement'=>true], - 'link'=>['tenant'=>(int)$f['tenant']->id,'warehouse'=>(int)$f['warehouse']->id,'item'=>(int)$f['stock']->id,'movement'=>(int)$movement->id,'reference'=>$movement->snapshot['reference']], - 'writer_manifest_sha256'=>hash_file('sha256',base_path('packages/inventory-write/releases/0.1.0/manifest.json'))],JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR)); + try { + $winner = app(ReceiptWorkflow::class)->confirm($concurrent['receiver'], $concurrent['order'], $payload); + $input = $root.'/worker.json'; + $application = 'stock_receipt_worker_'.$tag; + file_put_contents($input, json_encode(['actor' => $concurrent['receiver']->id, 'order' => $concurrent['order']->id, 'payload' => $payload, 'application' => $application], JSON_THROW_ON_ERROR)); + $pipes = []; + $process = proc_open([PHP_BINARY, base_path('tests/Support/common-receipt-worker.php'), $input], [0 => ['pipe', 'r'], 1 => ['file', $root.'/worker.stdout', 'w'], 2 => ['file', $root.'/worker.stderr', 'w']], $pipes, base_path()); + $this->assertIsResource($process); + fclose($pipes[0]); + $deadline = microtime(true) + 10; + $wait = null; + $parent = (int) DB::selectOne('SELECT pg_backend_pid() AS pid')->pid; + do { + DB::select('SELECT pg_stat_clear_snapshot()'); + $wait = DB::selectOne("SELECT wait_event,to_json(pg_blocking_pids(pid)) AS blockers FROM pg_stat_activity WHERE application_name=? AND wait_event_type='Lock'", [$application]); + if (! $wait) { + usleep(25000); + } + } while (! $wait && microtime(true) < $deadline); + $this->assertNotNull($wait); + $this->assertContains($parent, json_decode($wait->blockers, true)); + DB::commit(); + $deadline = microtime(true) + 15; + do { + $status = proc_get_status($process); + if (! $status['running']) { + break; + }usleep(25000); + } while (microtime(true) < $deadline); + $this->assertFalse($status['running']); + $exit = proc_close($process); + $process = null; + if ($exit === -1) { + $exit = $status['exitcode']; + }$this->assertSame(0, $exit); + $second = json_decode(file_get_contents($input.'.result'), true, 512, JSON_THROW_ON_ERROR); + $this->assertSame(200, $second['status']); + $this->assertSame($winner->id, $second['receipt_id']); + $this->assertSame(1, GoodsReceipt::query()->where('purchase_order_id', $concurrent['order']->id)->count()); + $this->assertSame(1, StockMovement::query()->whereIn('goods_receipt_item_id', $winner->items->pluck('id'))->count()); + } finally { + if (is_resource($process)) { + proc_terminate($process); + proc_close($process); + }while (DB::transactionLevel() > 0) { + DB::rollBack(); + } + } + file_put_contents($root.'/receipt-results.json', json_encode(['identity' => $i, 'physical_accepted_milli' => 4000, 'rejected_milli' => 2000, 'movement_count_main' => 1, + 'source_version_stale_refused' => true, 'core_replay_same_movement' => true, 'fault_atomic_and_recovered' => true, 'concurrency' => ['actual_lock_wait' => true, 'wait_event' => $wait->wait_event, 'same_receipt' => true, 'one_movement' => true], + 'link' => ['tenant' => (int) $f['tenant']->id, 'warehouse' => (int) $f['warehouse']->id, 'item' => (int) $f['stock']->id, 'movement' => (int) $movement->id, 'reference' => $movement->snapshot['reference']], + 'writer_manifest_sha256' => hash_file('sha256',base_path('packages/inventory-write/releases/0.1.0/manifest.json'))], JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR)); } } diff --git a/tests/Feature/CommonStockReadTest.php b/tests/Feature/CommonStockReadTest.php index aade9db..3567974 100644 --- a/tests/Feature/CommonStockReadTest.php +++ b/tests/Feature/CommonStockReadTest.php @@ -10,12 +10,15 @@ final class CommonStockReadTest extends TestCase { public function test_authenticated_native_composition_and_common_reader(): void { - $run=(string)getenv('SGF_ISOLATED_REGRESSION_RUN'); - $this->assertMatchesRegularExpression('/^[a-f0-9]{12}$/D',$run); - $identity=DB::selectOne("SELECT current_database() AS name,current_user AS role,inet_server_port() AS port,current_setting('cluster_name') AS cluster"); - $this->assertMatchesRegularExpression('/^stock_read_compras_([a-f0-9]{12})$/D',$identity->name); - $tag=substr($identity->name,-12); - $this->assertSame('stock_read_qa_'.$tag,$identity->role);$this->assertSame(55439,(int)$identity->port);$this->assertSame('sgf_modular_regression_'.$run,$identity->cluster); + skipUnlessIsolatedPostgres($this); + $run = (string) getenv('SGF_ISOLATED_REGRESSION_RUN'); + $this->assertMatchesRegularExpression('/^[a-f0-9]{12}$/D', $run); + $identity = DB::selectOne("SELECT current_database() AS name,current_user AS role,inet_server_port() AS port,current_setting('cluster_name') AS cluster"); + $this->assertMatchesRegularExpression('/^stock_read_compras_([a-f0-9]{12})$/D', $identity->name); + $tag = substr($identity->name, -12); + $this->assertSame('stock_read_qa_'.$tag, $identity->role); + $this->assertSame(55439, (int) $identity->port); + $this->assertSame('sgf_modular_regression_'.$run, $identity->cluster); // Fresh, dedicated QA database only. Never migrate/reset any existing host. $this->assertFalse(DB::getSchemaBuilder()->hasTable('users')); DB::transaction(function () { @@ -26,9 +29,9 @@ final class CommonStockReadTest extends TestCase DB::statement('CREATE TABLE organization_profiles(id bigint PRIMARY KEY,tenant_id bigint,name text,permissions jsonb,work_contexts jsonb)'); DB::statement('CREATE TABLE organization_memberships(id bigint PRIMARY KEY,tenant_id bigint,user_id bigint,profile_id bigint,expires_at timestamp,maintenance boolean)'); }); - $actor=User::forceCreate(['tenant_id'=>77,'purchasing_role'=>'warehouse','name'=>'Synthetic warehouse','email'=>'stock@example.test','password'=>bin2hex(random_bytes(16))]); - $denied=User::forceCreate(['tenant_id'=>77,'purchasing_role'=>'requester','name'=>'Synthetic requester','email'=>'request@example.test','password'=>bin2hex(random_bytes(16))]); - $schema='sgf_stock_read_'.bin2hex(random_bytes(6)); + $actor = User::forceCreate(['tenant_id' => 77, 'purchasing_role' => 'warehouse', 'name' => 'Synthetic warehouse', 'email' => 'stock@example.test', 'password' => bin2hex(random_bytes(16))]); + $denied = User::forceCreate(['tenant_id' => 77, 'purchasing_role' => 'requester', 'name' => 'Synthetic requester', 'email' => 'request@example.test', 'password' => bin2hex(random_bytes(16))]); + $schema = 'sgf_stock_read_'.bin2hex(random_bytes(6)); DB::transaction(function () use ($schema) { DB::statement("CREATE SCHEMA $schema"); DB::statement("CREATE TABLE $schema.stock_items(id bigint PRIMARY KEY,tenant_id bigint,code text,name text,unit text)"); @@ -45,41 +48,57 @@ final class CommonStockReadTest extends TestCase DB::statement("CREATE FUNCTION $schema.immutable() RETURNS trigger LANGUAGE plpgsql AS 'BEGIN RAISE EXCEPTION ''Inventory ledger is append-only''; END'"); DB::statement("CREATE TRIGGER immutable BEFORE UPDATE OR DELETE ON $schema.stock_movements FOR EACH ROW EXECUTE FUNCTION $schema.immutable()"); }); - $binding=['schema'=>$schema,'source_tenant_id'=>77,'warehouse_ids'=>[11,12],'append_only'=>true]; - $key='77:'.$actor->id;config(['stock_read.synthetic_sources.'.$key=>$binding]); + $binding = ['schema' => $schema, 'source_tenant_id' => 77, 'warehouse_ids' => [11, 12], 'append_only' => true]; + $key = '77:'.$actor->id; + config(['stock_read.synthetic_sources.'.$key => $binding]); $this->getJson('/api/stock-read')->assertUnauthorized(); $this->actingAs($denied)->getJson('/api/stock-read')->assertForbidden(); $this->actingAs($actor); - $queries=[];foreach(['items','warehouses','balances','movements'] as $view)foreach([25,100] as $size)$queries[]='view='.$view.'&per_page='.$size; - $queries=[...$queries,'view=balances&per_page=25&page=2','view=items&per_page=25&page=5','view=balances&warehouse_id=12','view=items&search=QA-000001']; - $cases=[]; - foreach($queries as $query){ - $r=$this->getJson('/api/stock-read?'.$query)->assertOk(); - $this->assertStringNotContainsString('DO_NOT_RETURN',$r->getContent());$this->assertStringNotContainsString('Foreign',$r->getContent());$this->assertStringNotContainsString('Restricted warehouse',$r->getContent()); - $cases[$query]=['sha256'=>hash('sha256',json_encode([$r->json('rows'),$r->json('pagination')],JSON_THROW_ON_ERROR)),'total'=>$r->json('pagination.total')]; + $queries = []; + foreach (['items', 'warehouses', 'balances', 'movements'] as $view) { + foreach ([25, 100] as $size) { + $queries[] = 'view='.$view.'&per_page='.$size; + } } - $snapshot=$this->getJson('/api/stock-read')->assertOk()->assertJsonPath('rows.0.physical_milli','8000')->json('snapshot'); - $this->getJson('/api/stock-read?warehouse_id=13')->assertForbidden();$this->getJson('/api/stock-read?warehouse_id=21')->assertForbidden(); - $this->getJson('/api/stock-read?tenant_id=88')->assertUnprocessable();$this->getJson('/api/stock-read?per_page=101')->assertUnprocessable(); + $queries = [...$queries, 'view=balances&per_page=25&page=2', 'view=items&per_page=25&page=5', 'view=balances&warehouse_id=12', 'view=items&search=QA-000001']; + $cases = []; + foreach ($queries as $query) { + $r = $this->getJson('/api/stock-read?'.$query)->assertOk(); + $this->assertStringNotContainsString('DO_NOT_RETURN', $r->getContent()); + $this->assertStringNotContainsString('Foreign', $r->getContent()); + $this->assertStringNotContainsString('Restricted warehouse', $r->getContent()); + $cases[$query] = ['sha256' => hash('sha256', json_encode([$r->json('rows'), $r->json('pagination')], JSON_THROW_ON_ERROR)), 'total' => $r->json('pagination.total')]; + } + $snapshot = $this->getJson('/api/stock-read')->assertOk()->assertJsonPath('rows.0.physical_milli', '8000')->json('snapshot'); + $this->getJson('/api/stock-read?warehouse_id=13')->assertForbidden(); + $this->getJson('/api/stock-read?warehouse_id=21')->assertForbidden(); + $this->getJson('/api/stock-read?tenant_id=88')->assertUnprocessable(); + $this->getJson('/api/stock-read?per_page=101')->assertUnprocessable(); $this->getJson('/api/stock-read?snapshot=invalid')->assertConflict(); - DB::table($schema.'.stock_movements')->insert(['tenant_id'=>77,'stock_item_id'=>1,'warehouse_id'=>11,'quantity_milli'=>-1000,'movement_type'=>'issue','snapshot'=>'{}','moved_at'=>now()]); + DB::table($schema.'.stock_movements')->insert(['tenant_id' => 77, 'stock_item_id' => 1, 'warehouse_id' => 11, 'quantity_milli' => -1000, 'movement_type' => 'issue', 'snapshot' => '{}', 'moved_at' => now()]); $this->getJson('/api/stock-read?snapshot='.urlencode($snapshot))->assertConflict(); - $this->getJson('/api/stock-read')->assertOk()->assertJsonPath('rows.0.physical_milli','7000'); + $this->getJson('/api/stock-read')->assertOk()->assertJsonPath('rows.0.physical_milli', '7000'); // Exercise configured native permissions too, without inventing a new right. - DB::table('organization_access')->insert(['tenant_id'=>77,'active'=>true]); - DB::table('organization_profiles')->insert(['id'=>1,'tenant_id'=>77,'name'=>'Synthetic warehouse profile','permissions'=>'["warehouse"]','work_contexts'=>'[]']); - DB::table('organization_memberships')->insert(['id'=>1,'tenant_id'=>77,'user_id'=>$actor->id,'profile_id'=>1,'maintenance'=>false]); + DB::table('organization_access')->insert(['tenant_id' => 77, 'active' => true]); + DB::table('organization_profiles')->insert(['id' => 1, 'tenant_id' => 77, 'name' => 'Synthetic warehouse profile', 'permissions' => '["warehouse"]', 'work_contexts' => '[]']); + DB::table('organization_memberships')->insert(['id' => 1, 'tenant_id' => 77, 'user_id' => $actor->id, 'profile_id' => 1, 'maintenance' => false]); $this->getJson('/api/stock-read')->assertOk(); - DB::table('organization_profiles')->where('id',1)->update(['permissions'=>'["requester"]']); + DB::table('organization_profiles')->where('id', 1)->update(['permissions' => '["requester"]']); $this->getJson('/api/stock-read')->assertForbidden(); - DB::table('organization_profiles')->where('id',1)->update(['permissions'=>'["warehouse"]']); + DB::table('organization_profiles')->where('id', 1)->update(['permissions' => '["warehouse"]']); $this->getJson('/api/stock-read')->assertOk(); - config(['stock_read.synthetic_sources.'.$key=>null]);$this->getJson('/api/stock-read')->assertStatus(503)->assertJsonPath('status','unavailable'); - config(['stock_read.synthetic_sources.'.$key=>array_replace($binding,['source_tenant_id'=>88])]);$this->getJson('/api/stock-read')->assertStatus(503); - config(['stock_read.synthetic_sources.'.$key=>$binding]);$this->getJson('/api/stock-read')->assertOk(); - $output=getenv('STOCK_READ_COMPOSITION_OUTPUT');$root=realpath((string)getenv('STOCK_READ_COMPOSITION_ROOT')); - if(!$output||!$root||realpath(dirname($output))!==$root)throw new \RuntimeException('Unexpected private proof directory'); - file_put_contents($output,json_encode(['identity'=>$identity,'cases'=>$cases,'native_snapshot'=>$snapshot,'native_roles_and_profiles_revalidated'=>true, - 'warehouse_isolation'=>true,'stale_snapshot_refused'=>true,'unknown_source_refused'=>true,'package_manifest_sha256'=>config('stock_read.package_manifest_sha256')],JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR)); + config(['stock_read.synthetic_sources.'.$key => null]); + $this->getJson('/api/stock-read')->assertStatus(503)->assertJsonPath('status', 'unavailable'); + config(['stock_read.synthetic_sources.'.$key => array_replace($binding, ['source_tenant_id' => 88])]); + $this->getJson('/api/stock-read')->assertStatus(503); + config(['stock_read.synthetic_sources.'.$key => $binding]); + $this->getJson('/api/stock-read')->assertOk(); + $output = getenv('STOCK_READ_COMPOSITION_OUTPUT'); + $root = realpath((string) getenv('STOCK_READ_COMPOSITION_ROOT')); + if (! $output || ! $root || realpath(dirname($output)) !== $root) { + throw new \RuntimeException('Unexpected private proof directory'); + } + file_put_contents($output, json_encode(['identity' => $identity, 'cases' => $cases, 'native_snapshot' => $snapshot, 'native_roles_and_profiles_revalidated' => true, + 'warehouse_isolation' => true, 'stale_snapshot_refused' => true, 'unknown_source_refused' => true, 'package_manifest_sha256' => config('stock_read.package_manifest_sha256')], JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR)); } } diff --git a/tests/Feature/ExampleTest.php b/tests/Feature/ExampleTest.php index ef7b533..584142e 100644 --- a/tests/Feature/ExampleTest.php +++ b/tests/Feature/ExampleTest.php @@ -1,7 +1,5 @@ get(route('home')); - - $response->assertOk(); +test('home sends guests to the login page', function () { + $this->get(route('home'))->assertRedirect('/login'); }); diff --git a/tests/Feature/InvestmentPolicyTest.php b/tests/Feature/InvestmentPolicyTest.php index 8075c61..284f216 100644 --- a/tests/Feature/InvestmentPolicyTest.php +++ b/tests/Feature/InvestmentPolicyTest.php @@ -136,7 +136,8 @@ test('an administrator losing eligibility before publication blocks the second s expect($policy->refresh()->status)->toBe('pending'); }); -test('public investment example contains no company policies', function () { +test('former public investment example redirects to the authenticated policies module', function () { auth()->forgetGuards(); - $this->get('/consulta/investimento')->assertOk()->assertInertia(fn ($page) => $page->where('initialScreen', 'investment')->where('auth.user', null)->missing('policies')->missing('reviews')); + $this->get('/consulta/investimento')->assertRedirect('/regras-investimento'); + $this->get('/regras-investimento')->assertRedirect('/login'); }); diff --git a/tests/Feature/NativePayablePageTest.php b/tests/Feature/NativePayablePageTest.php index 4308518..3733b6e 100644 --- a/tests/Feature/NativePayablePageTest.php +++ b/tests/Feature/NativePayablePageTest.php @@ -1,10 +1,14 @@ assertMatchesRegularExpression('/^compras_receipts_test_[a-f0-9]{12}$/D',$i->db);$this->assertSame('stock_receipt_qa_'.substr($i->db,-12),$i->role);$this->assertSame(55439,(int)$i->port);$this->assertSame('sgf_modular_regression_'.getenv('SGF_ISOLATED_REGRESSION_RUN'),$i->cluster); - if(!DB::getSchemaBuilder()->hasTable('users'))Artisan::call('migrate',['--force'=>true]); - $this->f=\paymentFixture();$this->instance='native-page-'.$this->f['tenant']->id;config(['common-payables.enabled'=>true,'common-payables.history_enabled'=>true,'common-payables.paged_read_enabled'=>true,'common-payables.source_instance'=>$this->instance]); - $this->reader=User::factory()->create(['tenant_id'=>$this->f['tenant']->id,'purchasing_role'=>PurchasingRole::Finance]); - foreach([[$this->f['author'],['view','prepare','validate']],[$this->f['validator'],['view','prepare','validate']],[$this->reader,['view']]] as [$u,$actions])foreach($actions as $a)DB::table('pa_access')->insert(['tenant_id'=>$u->tenant_id,'company_id'=>0,'unit_id'=>0,'user_id'=>$u->id,'person'=>'native-page-person-'.$u->id,'action'=>$a]); - foreach([['30.00','confirmed'],['10.00','pending'],['5.00','rejected']] as [$amount,$status]){$this->actingAs($this->f['author']);$p=app(ExternalPaymentWorkflow::class)->register($this->f['author'],$this->f['invoice'],[...$this->f['payment_data'],'amount'=>$amount,'external_reference'=>'NATIVE-PAGE-'.$status]);if($status!=='pending'){$this->actingAs($this->f['validator']);app(ExternalPaymentWorkflow::class)->review($this->f['validator'],$p,$status,'Synthetic independent original payment review.');}} - $this->actingAs($this->f['author']);$p=app(SupplierPayables::class)->engine($this->f['author'])->command('prepare_history',$this->f['invoice']->id,'Synthetic original history proposal.',(string)Str::uuid());$this->actingAs($this->f['validator']);app(SupplierPayables::class)->engine($this->f['validator'])->command('validate_history',$p['proposal_id'],'Synthetic distinct original history review.',(string)Str::uuid());$this->actingAs($this->reader); + parent::setUp(); + skipUnlessIsolatedPostgres($this); + $i = DB::selectOne("SELECT current_database() AS db,current_user AS role,inet_server_port() AS port,current_setting('cluster_name') AS cluster"); + $this->assertMatchesRegularExpression('/^compras_receipts_test_[a-f0-9]{12}$/D', $i->db); + $this->assertSame('stock_receipt_qa_'.substr($i->db, -12), $i->role); + $this->assertSame(55439, (int) $i->port); + $this->assertSame('sgf_modular_regression_'.getenv('SGF_ISOLATED_REGRESSION_RUN'), $i->cluster); + if (! DB::getSchemaBuilder()->hasTable('users')) { + Artisan::call('migrate', ['--force' => true]); + } + $this->f = \paymentFixture(); + $this->instance = 'native-page-'.$this->f['tenant']->id; + config(['common-payables.enabled' => true, 'common-payables.history_enabled' => true, 'common-payables.paged_read_enabled' => true, 'common-payables.source_instance' => $this->instance]); + $this->reader = User::factory()->create(['tenant_id' => $this->f['tenant']->id, 'purchasing_role' => PurchasingRole::Finance]); + foreach ([[$this->f['author'], ['view', 'prepare', 'validate']], [$this->f['validator'], ['view', 'prepare', 'validate']], [$this->reader, ['view']]] as [$u,$actions]) { + foreach ($actions as $a) { + DB::table('pa_access')->insert(['tenant_id' => $u->tenant_id, 'company_id' => 0, 'unit_id' => 0, 'user_id' => $u->id, 'person' => 'native-page-person-'.$u->id, 'action' => $a]); + } + } + foreach ([['30.00', 'confirmed'], ['10.00', 'pending'], ['5.00', 'rejected']] as [$amount,$status]) { + $this->actingAs($this->f['author']); + $p = app(ExternalPaymentWorkflow::class)->register($this->f['author'], $this->f['invoice'], [...$this->f['payment_data'], 'amount' => $amount, 'external_reference' => 'NATIVE-PAGE-'.$status]); + if ($status !== 'pending') { + $this->actingAs($this->f['validator']); + app(ExternalPaymentWorkflow::class)->review($this->f['validator'], $p, $status, 'Synthetic independent original payment review.'); + } + } + $this->actingAs($this->f['author']); + $p = app(SupplierPayables::class)->engine($this->f['author'])->command('prepare_history', $this->f['invoice']->id, 'Synthetic original history proposal.', (string) Str::uuid()); + $this->actingAs($this->f['validator']); + app(SupplierPayables::class)->engine($this->f['validator'])->command('validate_history', $p['proposal_id'], 'Synthetic distinct original history review.', (string) Str::uuid()); + $this->actingAs($this->reader); } - private function service():SupplierPayables{return app(SupplierPayables::class);} - private function clones(int $count):void + + private function service(): SupplierPayables { - $row=DB::table('invoices')->where('id',$this->f['invoice']->id)->first();$line=(array)DB::table('invoice_items')->where('invoice_id',$row->id)->first();unset($line['id']);$audit=(array)DB::table('audit_logs')->where('tenant_id',$row->tenant_id)->where('action','invoice.validated')->where('after->invoice_id',$row->id)->first();unset($audit['id']); - for($n=1;$n<=$count;$n++){$copy=(array)$row;unset($copy['id']);$copy['number']='PAGE-'.str_pad((string)$n,5,'0',STR_PAD_LEFT);$snapshot=json_decode($copy['snapshot'],true);$snapshot['supplier']['name']=$n%2===0?'Page Alpha':'Page Beta';$copy['snapshot']=json_encode($snapshot,JSON_THROW_ON_ERROR);$id=DB::table('invoices')->insertGetId($copy);DB::table('invoice_items')->insert(array_replace($line,['invoice_id'=>$id]));$after=json_decode($audit['after'],true);$after['invoice_id']=$id;DB::table('audit_logs')->insert(array_replace($audit,['after'=>json_encode($after,JSON_THROW_ON_ERROR)]));} + return app(SupplierPayables::class); } - private function positions(array $data):string{$rows=$data['obligations'];usort($rows,fn($a,$b)=>$a['id']<=>$b['id']);return Payables::canonical($rows);} - private function duplicateRegistration():void + + private function clones(int $count): void { - $p=DB::table('external_payments')->where('tenant_id',$this->f['tenant']->id)->where('invoice_id',$this->f['invoice']->id)->where('status','confirmed')->first();$row=(array)DB::table('audit_logs')->where('tenant_id',$p->tenant_id)->where('action','payment.registered')->where('after->payment_id',$p->id)->first();unset($row['id']);DB::table('audit_logs')->insert($row); + $row = DB::table('invoices')->where('id', $this->f['invoice']->id)->first(); + $line = (array) DB::table('invoice_items')->where('invoice_id', $row->id)->first(); + unset($line['id']); + $audit = (array) DB::table('audit_logs')->where('tenant_id', $row->tenant_id)->where('action', 'invoice.validated')->where('after->invoice_id', $row->id)->first(); + unset($audit['id']); + for ($n = 1; $n <= $count; $n++) { + $copy = (array) $row; + unset($copy['id']); + $copy['number'] = 'PAGE-'.str_pad((string) $n, 5, '0', STR_PAD_LEFT); + $snapshot = json_decode($copy['snapshot'], true); + $snapshot['supplier']['name'] = $n % 2 === 0 ? 'Page Alpha' : 'Page Beta'; + $copy['snapshot'] = json_encode($snapshot, JSON_THROW_ON_ERROR); + $id = DB::table('invoices')->insertGetId($copy); + DB::table('invoice_items')->insert(array_replace($line, ['invoice_id' => $id])); + $after = json_decode($audit['after'], true); + $after['invoice_id'] = $id; + DB::table('audit_logs')->insert(array_replace($audit, ['after' => json_encode($after, JSON_THROW_ON_ERROR)])); + } } - public function test_native_page_matches_live_documents_and_existing_financial_positions():void + + private function positions(array $data): string { - $old=$this->service()->engine($this->reader)->listing([$this->f['invoice']->id]);$new=$this->service()->listing($this->reader);$this->assertSame(Payables::canonical($old['documents']),Payables::canonical($new['documents']));$this->assertSame($this->positions($old),$this->positions($new));$o=$new['obligations'][0];$this->assertSame(6000,$o['principal_minor']);$this->assertSame(3000,$o['balance_minor']);$this->assertSame(1000,$o['pending_payments_minor']);$this->assertSame(500,$o['rejected_payments_minor']);$this->assertNull($o['due_on']);$this->assertFalse($new['permissions']['prepare']);$this->getJson('/api/supplier-payables')->assertOk()->assertJsonPath('pagination.documents.total',1)->assertJsonPath('obligations.0.balance_minor',3000); + $rows = $data['obligations']; + usort($rows, fn ($a, $b) => $a['id'] <=> $b['id']); + + return Payables::canonical($rows); } - public function test_native_invoice_filter_survives_document_and_evidence_pagination():void + + private function duplicateRegistration(): void { - $this->clones(50);$a=$this->getJson('/api/supplier-payables')->assertOk()->assertJsonPath('pagination.documents.total',51)->assertJsonCount(25,'documents')->json('documents');$b=$this->getJson('/api/supplier-payables?page=2')->assertOk()->assertJsonCount(25,'documents')->json('documents');$this->assertEmpty(array_intersect(array_column($a,'local_id'),array_column($b,'local_id')));$this->assertGreaterThan($b[0]['local_id'],$a[24]['local_id']); - $id=$this->f['invoice']->id;$this->getJson('/api/supplier-payables?invoice='.$id)->assertOk()->assertJsonPath('documents.0.local_id',$id)->assertJsonPath('obligations.0.balance_minor',3000)->assertJsonPath('listing_query.invoice',$id);$this->getJson('/api/supplier-payables?recognition=recognised')->assertOk()->assertJsonPath('pagination.documents.total',1);$this->getJson('/api/supplier-payables?recognition=unrecognised&per_page=100')->assertOk()->assertJsonPath('pagination.documents.total',50)->assertJsonCount(0,'obligations');$this->getJson('/api/supplier-payables?q=Page%20Alpha')->assertOk()->assertJsonPath('pagination.documents.total',25);$this->getJson('/api/supplier-payables?q=%25')->assertOk()->assertJsonPath('pagination.documents.total',0); - $page=$this->get('/obrigacoes-fornecedores?invoice='.$id)->assertOk()->getContent();$this->assertTrue(str_contains($page,'action="/obrigacoes-fornecedores"'),'Native page action retained');$this->assertTrue(str_contains($page,'name="invoice"'),'Invoice filter retained in search form');$this->assertTrue(str_contains($page,'value="'.$id.'"'),'Original invoice selection retained'); + $p = DB::table('external_payments')->where('tenant_id', $this->f['tenant']->id)->where('invoice_id', $this->f['invoice']->id)->where('status', 'confirmed')->first(); + $row = (array) DB::table('audit_logs')->where('tenant_id', $p->tenant_id)->where('action', 'payment.registered')->where('after->payment_id', $p->id)->first(); + unset($row['id']); + DB::table('audit_logs')->insert($row); } - public function test_native_page_batches_sources_and_payment_audits_without_writer_locks():void + + public function test_native_page_matches_live_documents_and_existing_financial_positions(): void { - $this->clones(50);$queries=[];$capture=true;DB::listen(function($q)use(&$queries,&$capture){if($capture)$queries[]=$q->sql;});$this->service()->listing($this->reader);$capture=false;$small=count($queries);$this->assertEmpty(array_filter($queries,fn($q)=>str_contains(strtolower($q),'for update')));$queries=[];$capture=true;$data=$this->service()->listing($this->reader,null,['per_page'=>100]);$capture=false;$this->assertCount(51,$data['documents']);$this->assertSame($small+2,count($queries),'Only two nonempty proposal/event data queries are added when original recognised invoice enters the window');$this->assertCount(2,array_filter($queries,fn($q)=>str_contains($q,'from "audit_logs"')));$this->assertCount(1,array_filter($queries,fn($q)=>str_contains($q,'from "external_payments"'))); - file_put_contents((string)getenv('STOCK_RECEIPT_ROOT').'/native-page-query.json',json_encode(['documents'=>51,'page_sizes'=>[25,100],'page25_queries'=>$small,'page100_queries'=>count($queries),'extra_queries_reason'=>'Proposal/event data SELECTs skipped by paginator for empty evidence windows.','audit_selects'=>2,'payment_selects'=>1,'no_writer_lock'=>true],JSON_PRETTY_PRINT)); + $old = $this->service()->engine($this->reader)->listing([$this->f['invoice']->id]); + $new = $this->service()->listing($this->reader); + $this->assertSame(Payables::canonical($old['documents']), Payables::canonical($new['documents'])); + $this->assertSame($this->positions($old), $this->positions($new)); + $o = $new['obligations'][0]; + $this->assertSame(6000, $o['principal_minor']); + $this->assertSame(3000, $o['balance_minor']); + $this->assertSame(1000, $o['pending_payments_minor']); + $this->assertSame(500, $o['rejected_payments_minor']); + $this->assertNull($o['due_on']); + $this->assertFalse($new['permissions']['prepare']); + $this->getJson('/api/supplier-payables')->assertOk()->assertJsonPath('pagination.documents.total', 1)->assertJsonPath('obligations.0.balance_minor', 3000); } - public function test_native_page_refuses_tenant_leaks_revoked_rights_and_stale_role():void + + public function test_native_invoice_filter_survives_document_and_evidence_pagination(): void { - DB::table('pa_access')->where('user_id',$this->reader->id)->delete();$this->getJson('/api/supplier-payables')->assertForbidden();DB::table('pa_access')->insert(['tenant_id'=>$this->reader->tenant_id,'company_id'=>0,'unit_id'=>0,'user_id'=>$this->reader->id,'person'=>'native-page-person-'.$this->reader->id,'action'=>'view']);DB::table('users')->where('id',$this->reader->id)->update(['purchasing_role'=>'requester']);$this->getJson('/api/supplier-payables')->assertForbidden();DB::table('users')->where('id',$this->reader->id)->update(['purchasing_role'=>'finance']); - $tenant=Tenant::query()->create(['name'=>'Foreign native page tenant']);$other=User::factory()->create(['tenant_id'=>$tenant->id,'purchasing_role'=>PurchasingRole::Finance]);DB::table('pa_access')->insert(['tenant_id'=>$tenant->id,'company_id'=>0,'unit_id'=>0,'user_id'=>$other->id,'person'=>'foreign-native-page','action'=>'view']);$this->actingAs($other);$this->getJson('/api/supplier-payables')->assertOk()->assertJsonPath('pagination.documents.total',0)->assertJsonCount(0,'obligations');$this->getJson('/api/supplier-payables?invoice='.$this->f['invoice']->id)->assertNotFound(); + $this->clones(50); + $a = $this->getJson('/api/supplier-payables')->assertOk()->assertJsonPath('pagination.documents.total', 51)->assertJsonCount(25, 'documents')->json('documents'); + $b = $this->getJson('/api/supplier-payables?page=2')->assertOk()->assertJsonCount(25, 'documents')->json('documents'); + $this->assertEmpty(array_intersect(array_column($a, 'local_id'), array_column($b, 'local_id'))); + $this->assertGreaterThan($b[0]['local_id'], $a[24]['local_id']); + $id = $this->f['invoice']->id; + $this->getJson('/api/supplier-payables?invoice='.$id)->assertOk()->assertJsonPath('documents.0.local_id', $id)->assertJsonPath('obligations.0.balance_minor', 3000)->assertJsonPath('listing_query.invoice', $id); + $this->getJson('/api/supplier-payables?recognition=recognised')->assertOk()->assertJsonPath('pagination.documents.total', 1); + $this->getJson('/api/supplier-payables?recognition=unrecognised&per_page=100')->assertOk()->assertJsonPath('pagination.documents.total', 50)->assertJsonCount(0, 'obligations'); + $this->getJson('/api/supplier-payables?q=Page%20Alpha')->assertOk()->assertJsonPath('pagination.documents.total', 25); + $this->getJson('/api/supplier-payables?q=%25')->assertOk()->assertJsonPath('pagination.documents.total', 0); + $page = $this->get('/obrigacoes-fornecedores?invoice='.$id)->assertOk()->getContent(); + $this->assertTrue(str_contains($page, 'action="/obrigacoes-fornecedores"'), 'Native page action retained'); + $this->assertTrue(str_contains($page, 'name="invoice"'), 'Invoice filter retained in search form'); + $this->assertTrue(str_contains($page, 'value="'.$id.'"'), 'Original invoice selection retained'); } - public function test_native_audit_changes_require_new_conference_without_using_read_snapshots():void + + public function test_native_page_batches_sources_and_payment_audits_without_writer_locks(): void { - $this->assertSame(3000,$this->service()->listing($this->reader)['obligations'][0]['balance_minor']);$this->duplicateRegistration();$new=$this->service()->listing($this->reader);$old=$this->service()->engine($this->reader)->listing([$this->f['invoice']->id]);$this->assertSame($this->positions($old),$this->positions($new));$this->assertNull($new['obligations'][0]['balance_minor']);$this->assertTrue($new['obligations'][0]['source_conflict']);$this->actingAs($this->f['author']);$r=$this->service()->engine($this->f['author'])->command('prepare_history',$this->f['invoice']->id,'Synthetic new audit after read.',(string)Str::uuid());$this->assertSame('conflict',$r['state']);$this->assertSame(1,DB::table('pa_obligations')->where('tenant_id',$this->f['tenant']->id)->count()); + $this->clones(50); + $queries = []; + $capture = true; + DB::listen(function ($q) use (&$queries, &$capture) { + if ($capture) { + $queries[] = $q->sql; + } + }); + $this->service()->listing($this->reader); + $capture = false; + $small = count($queries); + $this->assertEmpty(array_filter($queries, fn ($q) => str_contains(strtolower($q), 'for update'))); + $queries = []; + $capture = true; + $data = $this->service()->listing($this->reader, null, ['per_page' => 100]); + $capture = false; + $this->assertCount(51, $data['documents']); + $this->assertSame($small + 2, count($queries), 'Only two nonempty proposal/event data queries are added when original recognised invoice enters the window'); + $this->assertCount(2, array_filter($queries, fn ($q) => str_contains($q, 'from "audit_logs"'))); + $this->assertCount(1, array_filter($queries, fn ($q) => str_contains($q, 'from "external_payments"'))); + file_put_contents((string) getenv('STOCK_RECEIPT_ROOT').'/native-page-query.json', json_encode(['documents' => 51, 'page_sizes' => [25, 100], 'page25_queries' => $small, 'page100_queries' => count($queries), 'extra_queries_reason' => 'Proposal/event data SELECTs skipped by paginator for empty evidence windows.', 'audit_selects' => 2, 'payment_selects' => 1, 'no_writer_lock' => true], JSON_PRETTY_PRINT)); } - public function test_native_feature_disabled_preserves_legacy_and_invalid_filters_are_refused():void + + public function test_native_page_refuses_tenant_leaks_revoked_rights_and_stale_role(): void { - foreach(['page=0','per_page=1000','tenant_id=999','recognition=paid','q%5Ba%5D=x'] as $q)$this->getJson('/api/supplier-payables?'.$q)->assertStatus(422);config(['common-payables.paged_read_enabled'=>false]);$this->getJson('/api/supplier-payables?page=1')->assertStatus(503);$this->getJson('/api/supplier-payables?invoice='.$this->f['invoice']->id)->assertOk()->assertJsonPath('obligations.0.balance_minor',3000)->assertJsonMissingPath('pagination'); + DB::table('pa_access')->where('user_id', $this->reader->id)->delete(); + $this->getJson('/api/supplier-payables')->assertForbidden(); + DB::table('pa_access')->insert(['tenant_id' => $this->reader->tenant_id, 'company_id' => 0, 'unit_id' => 0, 'user_id' => $this->reader->id, 'person' => 'native-page-person-'.$this->reader->id, 'action' => 'view']); + DB::table('users')->where('id', $this->reader->id)->update(['purchasing_role' => 'requester']); + $this->getJson('/api/supplier-payables')->assertForbidden(); + DB::table('users')->where('id', $this->reader->id)->update(['purchasing_role' => 'finance']); + $tenant = Tenant::query()->create(['name' => 'Foreign native page tenant']); + $other = User::factory()->create(['tenant_id' => $tenant->id, 'purchasing_role' => PurchasingRole::Finance]); + DB::table('pa_access')->insert(['tenant_id' => $tenant->id, 'company_id' => 0, 'unit_id' => 0, 'user_id' => $other->id, 'person' => 'foreign-native-page', 'action' => 'view']); + $this->actingAs($other); + $this->getJson('/api/supplier-payables')->assertOk()->assertJsonPath('pagination.documents.total', 0)->assertJsonCount(0, 'obligations'); + $this->getJson('/api/supplier-payables?invoice='.$this->f['invoice']->id)->assertNotFound(); } - public function test_native_profiles_expiry_maintenance_and_people_context_do_not_grant_financial_read():void + + public function test_native_audit_changes_require_new_conference_without_using_read_snapshots(): void { - \supplyGrant($this->reader,['finance']);DB::table('organization_memberships')->where('user_id',$this->reader->id)->update(['expires_at'=>now()->subMinute()]);$this->getJson('/api/supplier-payables')->assertForbidden();DB::table('organization_memberships')->where('user_id',$this->reader->id)->update(['expires_at'=>null,'maintenance'=>true]);$this->getJson('/api/supplier-payables')->assertForbidden();DB::table('organization_memberships')->where('user_id',$this->reader->id)->update(['maintenance'=>false]); - $tenant=$this->f['tenant']->id;$this->f['tenant']->update(['rules_provisional'=>false,'work_context_policy'=>['revision'=>1,'enabled'=>['procurement.internal','people.internal']]]);config(['work_context.entitlements.'.$tenant=>['procurement.internal','people.internal']]);DB::table('organization_profiles')->where('tenant_id',$tenant)->update(['work_contexts'=>json_encode(['people.internal'])]);$this->getJson('/api/supplier-payables')->assertForbidden();DB::table('organization_profiles')->where('tenant_id',$tenant)->update(['work_contexts'=>json_encode(['procurement.internal'])]);$this->post('/contexto',['area'=>'procurement','option'=>'procurement.internal'])->assertRedirect('/dashboard');$this->getJson('/api/supplier-payables')->assertOk()->assertJsonPath('obligations.0.balance_minor',3000); + $this->assertSame(3000, $this->service()->listing($this->reader)['obligations'][0]['balance_minor']); + $this->duplicateRegistration(); + $new = $this->service()->listing($this->reader); + $old = $this->service()->engine($this->reader)->listing([$this->f['invoice']->id]); + $this->assertSame($this->positions($old), $this->positions($new)); + $this->assertNull($new['obligations'][0]['balance_minor']); + $this->assertTrue($new['obligations'][0]['source_conflict']); + $this->actingAs($this->f['author']); + $r = $this->service()->engine($this->f['author'])->command('prepare_history', $this->f['invoice']->id, 'Synthetic new audit after read.', (string) Str::uuid()); + $this->assertSame('conflict', $r['state']); + $this->assertSame(1, DB::table('pa_obligations')->where('tenant_id', $this->f['tenant']->id)->count()); } - public function test_native_read_finishes_before_writer_release_and_sees_committed_audits_only():void + + public function test_native_feature_disabled_preserves_legacy_and_invalid_filters_are_refused(): void { - $dir=base_path('../private/native-page-'.bin2hex(random_bytes(6)));mkdir($dir,0700,true);$input=$dir.'/worker.json';file_put_contents($input,json_encode(['actor'=>$this->reader->id,'instance'=>$this->instance],JSON_THROW_ON_ERROR));$process=null;DB::beginTransaction(); - try{DB::table('tenants')->where('id',$this->f['tenant']->id)->lockForUpdate()->firstOrFail();$this->duplicateRegistration();$pipes=[];$process=proc_open([PHP_BINARY,base_path('tests/Support/native-payable-page-worker.php'),$input],[0=>['pipe','r'],1=>['file',$dir.'/stdout','w'],2=>['file',$dir.'/stderr','w']],$pipes,base_path());$this->assertIsResource($process);fclose($pipes[0]);$deadline=microtime(true)+8;do{$status=proc_get_status($process);if(!$status['running'])break;usleep(25000);}while(microtime(true)<$deadline);$this->assertFalse($status['running'],'Read must not wait for writer tenant lock');$exit=proc_close($process);$process=null;if($exit===-1)$exit=$status['exitcode'];$this->assertSame(0,$exit);$r=json_decode(file_get_contents($input.'.result'),true);$this->assertSame(200,$r['status']);$this->assertSame([3000],$r['balances']);$this->assertSame(1,DB::transactionLevel());file_put_contents((string)getenv('STOCK_RECEIPT_ROOT').'/native-page-concurrency.json',json_encode(['reader_completed_before_writer_release'=>true,'uncommitted_audit_not_observed'=>true,'balance_minor'=>3000,'reader_time_ms'=>$r['time_ms']],JSON_PRETTY_PRINT));} - finally{if(is_resource($process)){proc_terminate($process);proc_close($process);}while(DB::transactionLevel()>0)DB::rollBack();} + foreach (['page=0', 'per_page=1000', 'tenant_id=999', 'recognition=paid', 'q%5Ba%5D=x'] as $q) { + $this->getJson('/api/supplier-payables?'.$q)->assertStatus(422); + }config(['common-payables.paged_read_enabled' => false]); + $this->getJson('/api/supplier-payables?page=1')->assertStatus(503); + $this->getJson('/api/supplier-payables?invoice='.$this->f['invoice']->id)->assertOk()->assertJsonPath('obligations.0.balance_minor', 3000)->assertJsonMissingPath('pagination'); } - public function test_native_missing_package_capability_is_503_without_legacy_fallback():void + + public function test_native_profiles_expiry_maintenance_and_people_context_do_not_grant_financial_read(): void { - $dir=base_path('../private/native-page-package-'.bin2hex(random_bytes(6)));mkdir($dir,0700,true);$input=$dir.'/worker.json';file_put_contents($input,json_encode(['actor'=>$this->reader->id,'instance'=>$this->instance],JSON_THROW_ON_ERROR));$pipes=[];$environment=getenv();$environment['COMMON_PAYABLES_PATH']='C:/laragon/www/compras/packages/payables';$p=proc_open([PHP_BINARY,base_path('tests/Support/native-payable-page-worker.php'),$input],[0=>['pipe','r'],1=>['file',$dir.'/stdout','w'],2=>['file',$dir.'/stderr','w']],$pipes,base_path(),$environment);$this->assertIsResource($p);fclose($pipes[0]);$this->assertSame(0,proc_close($p));$r=json_decode(file_get_contents($input.'.result'),true);$this->assertSame(503,$r['status']); + \supplyGrant($this->reader, ['finance']); + DB::table('organization_memberships')->where('user_id', $this->reader->id)->update(['expires_at' => now()->subMinute()]); + $this->getJson('/api/supplier-payables')->assertForbidden(); + DB::table('organization_memberships')->where('user_id', $this->reader->id)->update(['expires_at' => null, 'maintenance' => true]); + $this->getJson('/api/supplier-payables')->assertForbidden(); + DB::table('organization_memberships')->where('user_id', $this->reader->id)->update(['maintenance' => false]); + $tenant = $this->f['tenant']->id; + $this->f['tenant']->update(['rules_provisional' => false, 'work_context_policy' => ['revision' => 1, 'enabled' => ['procurement.internal', 'people.internal']]]); + config(['work_context.entitlements.'.$tenant => ['procurement.internal', 'people.internal']]); + DB::table('organization_profiles')->where('tenant_id', $tenant)->update(['work_contexts' => json_encode(['people.internal'])]); + $this->getJson('/api/supplier-payables')->assertForbidden(); + DB::table('organization_profiles')->where('tenant_id', $tenant)->update(['work_contexts' => json_encode(['procurement.internal'])]); + $this->post('/contexto', ['area' => 'procurement', 'option' => 'procurement.internal'])->assertRedirect('/dashboard'); + $this->getJson('/api/supplier-payables')->assertOk()->assertJsonPath('obligations.0.balance_minor', 3000); + } + + public function test_native_read_finishes_before_writer_release_and_sees_committed_audits_only(): void + { + $dir = base_path('../private/native-page-'.bin2hex(random_bytes(6))); + mkdir($dir, 0700, true); + $input = $dir.'/worker.json'; + file_put_contents($input, json_encode(['actor' => $this->reader->id, 'instance' => $this->instance], JSON_THROW_ON_ERROR)); + $process = null; + DB::beginTransaction(); + try { + DB::table('tenants')->where('id', $this->f['tenant']->id)->lockForUpdate()->firstOrFail(); + $this->duplicateRegistration(); + $pipes = []; + $process = proc_open([PHP_BINARY, base_path('tests/Support/native-payable-page-worker.php'), $input], [0 => ['pipe', 'r'], 1 => ['file', $dir.'/stdout', 'w'], 2 => ['file', $dir.'/stderr', 'w']], $pipes, base_path()); + $this->assertIsResource($process); + fclose($pipes[0]); + $deadline = microtime(true) + 8; + do { + $status = proc_get_status($process); + if (! $status['running']) { + break; + }usleep(25000); + } while (microtime(true) < $deadline); + $this->assertFalse($status['running'], 'Read must not wait for writer tenant lock'); + $exit = proc_close($process); + $process = null; + if ($exit === -1) { + $exit = $status['exitcode']; + }$this->assertSame(0, $exit); + $r = json_decode(file_get_contents($input.'.result'), true); + $this->assertSame(200, $r['status']); + $this->assertSame([3000], $r['balances']); + $this->assertSame(1, DB::transactionLevel()); + file_put_contents((string) getenv('STOCK_RECEIPT_ROOT').'/native-page-concurrency.json', json_encode(['reader_completed_before_writer_release' => true, 'uncommitted_audit_not_observed' => true, 'balance_minor' => 3000, 'reader_time_ms' => $r['time_ms']], JSON_PRETTY_PRINT)); + } finally { + if (is_resource($process)) { + proc_terminate($process); + proc_close($process); + }while (DB::transactionLevel() > 0) { + DB::rollBack(); + } + } + } + + public function test_native_missing_package_capability_is_503_without_legacy_fallback(): void + { + $dir = base_path('../private/native-page-package-'.bin2hex(random_bytes(6))); + mkdir($dir, 0700, true); + $input = $dir.'/worker.json'; + file_put_contents($input, json_encode(['actor' => $this->reader->id, 'instance' => $this->instance], JSON_THROW_ON_ERROR)); + $pipes = []; + $environment = getenv(); + $environment['COMMON_PAYABLES_PATH'] = base_path('packages/payables'); + $p = proc_open([PHP_BINARY, base_path('tests/Support/native-payable-page-worker.php'), $input],[0 => ['pipe', 'r'], 1 => ['file', $dir.'/stdout', 'w'], 2 => ['file', $dir.'/stderr', 'w']],$pipes,base_path(),$environment); + $this->assertIsResource($p); + fclose($pipes[0]); + $this->assertSame(0,proc_close($p)); + $r = json_decode(file_get_contents($input.'.result'),true); + $this->assertSame(503,$r['status']); } } diff --git a/tests/Feature/PublicPreviewTest.php b/tests/Feature/PublicPreviewTest.php index d272f9b..3a23346 100644 --- a/tests/Feature/PublicPreviewTest.php +++ b/tests/Feature/PublicPreviewTest.php @@ -1,31 +1,41 @@ get($path)->assertOk()->assertInertia(fn (Assert $page) => $page - ->component($component) - ->where('auth.user', null) - ->missing('suppliers')->missing('requisitions')->missing('documents') - ->missing('adoptions')->missing('policies')->missing('recommendations')); +// The former public demonstration screens were retired (no parallel simulations): +// their links are preserved as redirects to the real, authenticated modules. + +test('former consultation links redirect to the real modules', function (string $path, string $destination) { + $this->get($path)->assertRedirect($destination); $this->assertGuest(); -})->with([['/consulta', 'preview/index'], ['/proposta/qualificacao', 'preview/qualification'], ['/proposta/admissao', 'preview/admission'], ['/proposta/recomendacao', 'preview/recommendation']]); +})->with([ + ['/consulta', '/dashboard'], + ['/consulta?ecra=suppliers', '/fornecedores'], + ['/consulta?ecra=unknown', '/dashboard'], + ['/consulta/fornecedores', '/fornecedores'], + ['/consulta/dados-bancarios', '/fornecedores'], + ['/consulta/investimento', '/regras-investimento'], + ['/consulta/operacoes-stock', '/stock/operacoes'], + ['/proposta/principal', '/dashboard'], + ['/proposta/qualificacao', '/requisicoes'], + ['/proposta/admissao', '/requisicoes'], + ['/proposta/recomendacao', '/requisicoes'], +]); -test('preview does not expose authenticated account data or log it out', function () { - $user = User::factory()->create(); - $this->actingAs($user)->get('/consulta')->assertOk()->assertInertia(fn (Assert $page) => $page->where('auth.user', null)); - $this->get('/proposta/recomendacao')->assertOk()->assertInertia(fn (Assert $page) => $page->where('auth.user', null)->missing('recommendations')->missing('policies')->missing('documents')); - $this->assertAuthenticatedAs($user); +test('unknown consultation screens are not found', function () { + $this->get('/consulta/inexistente')->assertNotFound(); }); -test('consultation creates no business access or mutation endpoint', function () { - $this->get('/consulta')->assertOk(); +test('redirected modules still require authentication and keep an authenticated session', function () { + $this->get('/consulta')->assertRedirect('/dashboard'); foreach (['/dashboard', '/fornecedores', '/cotacoes', '/conflitos'] as $path) { $this->get($path)->assertRedirect('/login'); } $this->post('/fornecedores', ['name' => 'Tentativa pública'])->assertRedirect('/login'); $this->post('/consulta', [])->assertStatus(405); - $this->post('/proposta/recomendacao', [])->assertStatus(405); expect(User::query()->count())->toBe(0); + + $user = User::factory()->create(); + $this->actingAs($user)->get('/consulta')->assertRedirect('/dashboard'); + $this->assertAuthenticatedAs($user); }); diff --git a/tests/Feature/PurchaseAwardOrderTest.php b/tests/Feature/PurchaseAwardOrderTest.php index bf8d636..ad71afb 100644 --- a/tests/Feature/PurchaseAwardOrderTest.php +++ b/tests/Feature/PurchaseAwardOrderTest.php @@ -1049,7 +1049,7 @@ test('discount evidence and net prices survive award order and printable report' test('native order preserves common ledger account references without creating a journal or changing the chart', function () { $source = getenv('RQ01_LEDGER_QA_SOURCE'); - if ($source !== 'C:/laragon/www/sgf-tempo/packages/general-ledger') { + if ($source !== sgfTempoPath('packages/general-ledger')) { $this->markTestSkipped('Dedicated real common-ledger QA schema required.'); } require_once $source.'/bootstrap.php'; @@ -1077,7 +1077,7 @@ test('native order preserves common ledger account references without creating a test('native order preserves common ledger across partial and consolidated origins', function (string $mode) { $source = getenv('RQ01_LEDGER_QA_SOURCE'); - if ($source !== 'C:/laragon/www/sgf-tempo/packages/general-ledger' || ! method_exists(BudgetControl::class, 'commitOrderParts')) { + if ($source !== sgfTempoPath('packages/general-ledger') || ! method_exists(BudgetControl::class, 'commitOrderParts')) { $this->markTestSkipped('Dedicated common ledger and authorised order-parts QA composition required.'); } require_once $source.'/bootstrap.php'; @@ -1391,7 +1391,7 @@ test('supplier names are frozen at issuance rather than read from live records', test('print escapes supplied HTML and keeps the development and budget notices', function () { $this->selection['justification'] = 'Fundamento escrito para teste de impressão.'; $order = issuePurchaseOrder($this, selectPurchaseAward($this)); - $this->get('/ordens/'.$order->id.'/imprimir')->assertOk()->assertSee('<script>', false)->assertDontSee('', false)->assertSee('Orçamento não verificado')->assertSee('Não autoriza compras reais'); + $this->get('/ordens/'.$order->id.'/imprimir')->assertOk()->assertSee('<script>', false)->assertDontSee('', false)->assertSee('Este documento não preserva confirmação do controlo orçamental')->assertSee('Não autoriza compras reais'); }); test('department heads cannot read or print another departments order', function () { diff --git a/tests/Feature/ReceiptAdapterReplayTest.php b/tests/Feature/ReceiptAdapterReplayTest.php index ae63b6c..44a804c 100644 --- a/tests/Feature/ReceiptAdapterReplayTest.php +++ b/tests/Feature/ReceiptAdapterReplayTest.php @@ -1,8 +1,10 @@ assertMatchesRegularExpression('/^compras_receipts_test_([a-f0-9]{12})$/D',$i->name); - $this->assertSame('stock_receipt_qa_'.substr($i->name,-12),$i->role);$this->assertSame('sgf_modular_regression_'.getenv('SGF_ISOLATED_REGRESSION_RUN'),$i->cluster); - $root=realpath((string)getenv('STOCK_RECEIPT_ROOT'));$this->assertNotFalse($root); - $proof=json_decode(file_get_contents($root.'/receipt-results.json'),true,512,JSON_THROW_ON_ERROR); - $row=DB::table('stock_movements')->where('tenant_id',$proof['link']['tenant'])->where('id',$proof['link']['movement'])->first();$this->assertNotNull($row); - $actor=User::findOrFail($row->moved_by);$this->actingAs($actor);$count=DB::table('stock_movements')->count(); - $hash=json_decode($row->snapshot,true)['inventory_source_hash']; - $result=DB::transaction(function()use($actor,$row,$hash){app(ConflictGuard::class)->lockCompany($actor);return app(ReceiptStockMovement::class)->for($actor)->write($row->goods_receipt_item_id,$hash);}); - $this->assertTrue($result['replayed']);$this->assertSame((int)$row->id,$result['movement_id']);$this->assertSame($count,DB::table('stock_movements')->count()); + skipUnlessIsolatedPostgres($this); + $i = DB::selectOne("SELECT current_database() AS name,current_user AS role,current_setting('cluster_name') AS cluster"); + $this->assertMatchesRegularExpression('/^compras_receipts_test_([a-f0-9]{12})$/D', $i->name); + $this->assertSame('stock_receipt_qa_'.substr($i->name, -12), $i->role); + $this->assertSame('sgf_modular_regression_'.getenv('SGF_ISOLATED_REGRESSION_RUN'), $i->cluster); + $root = realpath((string) getenv('STOCK_RECEIPT_ROOT')); + $this->assertNotFalse($root); + $proof = json_decode(file_get_contents($root.'/receipt-results.json'), true, 512, JSON_THROW_ON_ERROR); + $row = DB::table('stock_movements')->where('tenant_id', $proof['link']['tenant'])->where('id', $proof['link']['movement'])->first(); + $this->assertNotNull($row); + $actor = User::findOrFail($row->moved_by); + $this->actingAs($actor); + $count = DB::table('stock_movements')->count(); + $hash = json_decode($row->snapshot, true)['inventory_source_hash']; + $result = DB::transaction(function () use ($actor, $row, $hash) { + app(ConflictGuard::class)->lockCompany($actor); + + return app(ReceiptStockMovement::class)->for($actor)->write($row->goods_receipt_item_id, $hash); + }); + $this->assertTrue($result['replayed']); + $this->assertSame((int) $row->id, $result['movement_id']); + $this->assertSame($count, DB::table('stock_movements')->count()); } } diff --git a/tests/Feature/RequisitionLedgerAccountsTest.php b/tests/Feature/RequisitionLedgerAccountsTest.php index 2c5aac4..d65ef79 100644 --- a/tests/Feature/RequisitionLedgerAccountsTest.php +++ b/tests/Feature/RequisitionLedgerAccountsTest.php @@ -69,14 +69,14 @@ test('pinned private runtime refuses source fallback and mismatched composition $settings = ['common-finance-bundle.manifest_sha256' => config('common-finance-bundle.manifest_sha256'), 'common-finance-bundle.root' => config('common-finance-bundle.root'), 'general-ledger.path' => config('general-ledger.path')]; try { - foreach (['C:/laragon/www/sgf-tempo/packages/general-ledger', base_path('storage/framework/testing/unapproved-ledger-source')] as $wrong) { + foreach ([sgfTempoPath('packages/general-ledger'), base_path('storage/framework/testing/unapproved-ledger-source')] as $wrong) { putenv('RQ01_LEDGER_QA_SOURCE='.$wrong); expect(fn () => requisitionLedgerQaSource())->toThrow(LogicException::class); } putenv('RQ01_LEDGER_QA_SOURCE='.$source); foreach (['common-finance-bundle.manifest_sha256' => str_repeat('0', 64), 'common-finance-bundle.root' => base_path('storage/framework/testing/unapproved-ledger-source'), - 'general-ledger.path' => 'C:/laragon/www/sgf-tempo/packages/general-ledger'] as $key => $wrong) { + 'general-ledger.path' => sgfTempoPath('packages/general-ledger')] as $key => $wrong) { config([$key => $wrong]); expect(fn () => requisitionLedgerQaSource())->toThrow(LogicException::class); config($settings); diff --git a/tests/Feature/StockOperationsTest.php b/tests/Feature/StockOperationsTest.php index af0ae81..cb693a8 100644 --- a/tests/Feature/StockOperationsTest.php +++ b/tests/Feature/StockOperationsTest.php @@ -120,13 +120,13 @@ test('audit failure rolls back both halves of transfer and operation', function expect(StockOperation::query()->count())->toBe(0)->and(StockMovement::query()->count())->toBe(1); }); -test('operations are immutable and new public screen contains only demonstration props', function () { +test('operations are immutable and the former public screen redirects to the real module', function () { $this->postJson('/stock/operacoes', $this->p)->assertCreated(); $op = StockOperation::query()->firstOrFail(); expect(fn () => $op->update(['reason' => 'rewrite']))->toThrow(LogicException::class); expect(fn () => $op->delete())->toThrow(LogicException::class); $this->get('/stock/operacoes')->assertInertia(fn (Assert $p) => $p->component('stock/operations')->has('operations.data', 1)->where('canOperate', true)); - $this->get('/consulta/operacoes-stock')->assertInertia(fn (Assert $p) => $p->component('preview/index')->where('initialScreen', 'operations')->missing('operations')->where('auth.user', null)); + $this->get('/consulta/operacoes-stock')->assertRedirect('/stock/operacoes'); }); test('invalid precision and missing justification or destination do not write', function ($field, $value) { diff --git a/tests/Feature/SupplierBankTest.php b/tests/Feature/SupplierBankTest.php index 1d13c06..6b733ba 100644 --- a/tests/Feature/SupplierBankTest.php +++ b/tests/Feature/SupplierBankTest.php @@ -147,7 +147,8 @@ test('supplier conflict blocks a previously approved banking revision', function expect(app(SupplierBankWorkflow::class)->state($this->supplier))->toBe('blocked'); }); -test('public bank example exposes no company banking details', function () { +test('former public bank example redirects to the authenticated supplier module', function () { auth()->forgetGuards(); - $this->get('/consulta/dados-bancarios')->assertOk()->assertInertia(fn ($page) => $page->where('initialScreen', 'bank')->where('auth.user', null)->missing('current')->missing('history')); + $this->get('/consulta/dados-bancarios')->assertRedirect('/fornecedores'); + $this->get('/fornecedores')->assertRedirect('/login'); }); diff --git a/tests/Feature/WarehouseReturnIntegrationTest.php b/tests/Feature/WarehouseReturnIntegrationTest.php index eb18508..eea0721 100644 --- a/tests/Feature/WarehouseReturnIntegrationTest.php +++ b/tests/Feature/WarehouseReturnIntegrationTest.php @@ -1,10 +1,24 @@ assertMatchesRegularExpression('/^compras_receipts_test_[a-f0-9]{12}$/D',$i->db);$this->assertSame('stock_receipt_qa_'.substr($i->db,-12),$i->role);$this->assertSame(55439,(int)$i->port);$this->assertSame('sgf_modular_regression_'.getenv('SGF_ISOLATED_REGRESSION_RUN'),$i->cluster); - if(!DB::getSchemaBuilder()->hasTable('users'))Artisan::call('migrate',['--force'=>true]);config(['stock_returns.enabled'=>true]); - $this->f=\receiptFixture('10.000');$this->reviewer=User::factory()->create(['tenant_id'=>$this->f['tenant']->id,'department_id'=>$this->f['issuer']->department_id]); - \supplyGrant($this->f['issuer'],['warehouse_request_prepare','warehouse_return_prepare','warehouse_return_read','warehouse_return_confirm','warehouse']); - \supplyGrant($this->reviewer,['warehouse_request_review']);\supplyGrant($this->f['receiver'],['warehouse','warehouse_request_deliver','warehouse_return_read','warehouse_return_confirm']);\supplyGrant($this->f['otherReceiver'],['warehouse','warehouse_return_read']); - $this->actingAs($this->f['receiver']);app(ReceiptWorkflow::class)->confirm($this->f['receiver'],$this->f['order'],\receiptPayload($this->f,'10.000')); - $this->actingAs($this->f['issuer']);$r=app(WarehouseRequests::class)->draft($this->f['issuer'],['operation_key'=>(string)Str::uuid(),'warehouse_id'=>$this->f['warehouse']->id,'cost_center_id'=>$this->f['r']->cost_center_id,'destination'=>'Synthetic internal workshop','reason'=>'Synthetic authorised internal material use.','priority'=>'normal','lines'=>[['stock_item_id'=>$this->f['stock']->id,'quantity'=>'5.000','use'=>'internal','equipment_id'=>null]]]);$this->requestId=$r->id; - $this->command($this->f['issuer'],'submit',['partial_allowed'=>false]);$this->command($this->reviewer,'authorize',['partial_allowed'=>false]);$this->command($this->f['receiver'],'deliver',['lines'=>[['index'=>0,'quantity'=>'5.000']]]); - $this->delivery=(int)WarehouseRequestEvent::query()->where('warehouse_request_id',$r->id)->where('action','deliver')->value('id');$this->command($this->f['issuer'],'receive',['delivery_event_id'=>$this->delivery]); - $this->payload=['operation_key'=>(string)Str::uuid(),'delivery_event_id'=>$this->delivery,'line_index'=>0,'quantity'=>'3.000','declared_unused'=>true,'evidence'=>'Synthetic unused quantity and physical custody evidence.','reason'=>'Synthetic unused material returned to its original warehouse.'];$this->actingAs($this->f['issuer']); + parent::setUp(); + skipUnlessIsolatedPostgres($this); + $i = DB::selectOne("SELECT current_database() AS db,current_user AS role,inet_server_port() AS port,current_setting('cluster_name') AS cluster"); + $this->assertMatchesRegularExpression('/^compras_receipts_test_[a-f0-9]{12}$/D', $i->db); + $this->assertSame('stock_receipt_qa_'.substr($i->db, -12), $i->role); + $this->assertSame(55439, (int) $i->port); + $this->assertSame('sgf_modular_regression_'.getenv('SGF_ISOLATED_REGRESSION_RUN'), $i->cluster); + if (! DB::getSchemaBuilder()->hasTable('users')) { + Artisan::call('migrate', ['--force' => true]); + }config(['stock_returns.enabled' => true]); + $this->f = \receiptFixture('10.000'); + $this->reviewer = User::factory()->create(['tenant_id' => $this->f['tenant']->id, 'department_id' => $this->f['issuer']->department_id]); + \supplyGrant($this->f['issuer'], ['warehouse_request_prepare', 'warehouse_return_prepare', 'warehouse_return_read', 'warehouse_return_confirm', 'warehouse']); + \supplyGrant($this->reviewer, ['warehouse_request_review']); + \supplyGrant($this->f['receiver'], ['warehouse', 'warehouse_request_deliver', 'warehouse_return_read', 'warehouse_return_confirm']); + \supplyGrant($this->f['otherReceiver'], ['warehouse', 'warehouse_return_read']); + $this->actingAs($this->f['receiver']); + app(ReceiptWorkflow::class)->confirm($this->f['receiver'], $this->f['order'], \receiptPayload($this->f, '10.000')); + $this->actingAs($this->f['issuer']); + $r = app(WarehouseRequests::class)->draft($this->f['issuer'], ['operation_key' => (string) Str::uuid(), 'warehouse_id' => $this->f['warehouse']->id, 'cost_center_id' => $this->f['r']->cost_center_id, 'destination' => 'Synthetic internal workshop', 'reason' => 'Synthetic authorised internal material use.', 'priority' => 'normal', 'lines' => [['stock_item_id' => $this->f['stock']->id, 'quantity' => '5.000', 'use' => 'internal', 'equipment_id' => null]]]); + $this->requestId = $r->id; + $this->command($this->f['issuer'], 'submit', ['partial_allowed' => false]); + $this->command($this->reviewer, 'authorize', ['partial_allowed' => false]); + $this->command($this->f['receiver'], 'deliver', ['lines' => [['index' => 0, 'quantity' => '5.000']]]); + $this->delivery = (int) WarehouseRequestEvent::query()->where('warehouse_request_id', $r->id)->where('action', 'deliver')->value('id'); + $this->command($this->f['issuer'], 'receive', ['delivery_event_id' => $this->delivery]); + $this->payload = ['operation_key' => (string) Str::uuid(), 'delivery_event_id' => $this->delivery, 'line_index' => 0, 'quantity' => '3.000', 'declared_unused' => true, 'evidence' => 'Synthetic unused quantity and physical custody evidence.', 'reason' => 'Synthetic unused material returned to its original warehouse.']; + $this->actingAs($this->f['issuer']); } - private function command(User $actor,string $action,array $extra):void + + private function command(User $actor, string $action, array $extra): void { - $this->actingAs($actor);$r=\App\Models\WarehouseRequest::query()->findOrFail($this->requestId);$d=['operation_key'=>(string)Str::uuid(),'version'=>app(WarehouseFulfilment::class)->progress($r)['version'],'action'=>$action,'reason'=>'Synthetic explicit request intervention.']+$extra; - $this->postJson('/stock/requisicoes/'.$r->id.'/eventos',$d)->assertRedirect(); + $this->actingAs($actor); + $r = WarehouseRequest::query()->findOrFail($this->requestId); + $d = ['operation_key' => (string) Str::uuid(), 'version' => app(WarehouseFulfilment::class)->progress($r)['version'], 'action' => $action, 'reason' => 'Synthetic explicit request intervention.'] + $extra; + $this->postJson('/stock/requisicoes/'.$r->id.'/eventos', $d)->assertRedirect(); } - private function prepare(?array $payload=null){return $this->postJson('/api/stock-returns/prepare',$payload??$this->payload);} - private function confirm(int $id,int $version=1){return $this->postJson('/api/stock-returns/'.$id.'/confirm',['version'=>$version,'received_in_warehouse'=>true,'reason'=>'Synthetic independent physical warehouse receipt.']);} - private function closeProposal(int $id,string $action,int $version=1){return $this->postJson('/api/stock-returns/'.$id.'/'.$action,['version'=>$version,'reason'=>'Synthetic reason for closing without physical movement.']);} - private function balance():int{return (int)StockMovement::query()->sum('quantity_milli');} - public function test_native_receipt_issue_acknowledgement_and_return_same_book_once():void + + private function prepare(?array $payload = null) { - $this->assertSame(5000,$this->balance());$p=$this->prepare()->assertOk()->assertJsonPath('impact.physical_before','5000')->assertJsonPath('impact.physical_after','8000')->json('id');$this->prepare()->assertOk()->assertJsonPath('id',$p)->assertJsonPath('replayed',true);$this->confirm($p)->assertForbidden(); - $prepared=SupplyRecord::query()->findOrFail($p);$this->assertSame($this->f['issuer']->id,$prepared->snapshot['source']['acknowledgement']['actor_id']); - $this->actingAs($this->f['receiver']);$this->postJson('/api/stock-returns/'.$p.'/confirm',['version'=>1,'reason'=>'Synthetic receipt without acknowledgement'])->assertStatus(422);$m=$this->confirm($p)->assertOk()->json('movement_id');$this->confirm($p)->assertOk()->assertJsonPath('movement_id',$m)->assertJsonPath('replayed',true); - $this->assertSame(8000,$this->balance());$this->assertSame(3,StockMovement::query()->count());$this->assertSame(2,StockOperation::query()->count());$this->assertSame(2,SupplyRecord::query()->where('kind','warehouse_return')->count()); - $history=$this->get('/stock/operacoes')->assertOk()->assertInertia(fn($page)=>$page->component('stock/operations')->where('canViewReturns',true)->where('operations.data.0.kind','workshop_return')->where('operations.data.0.snapshot.stock_item.id',$this->f['stock']->id)->where('operations.data.0.snapshot.warehouse.id',$this->f['warehouse']->id)->where('operations.data.0.snapshot.actor.id',$this->f['receiver']->id)->where('operations.data.0.snapshot.responsible.id',$this->f['receiver']->id)); - $historyRoot=realpath((string)getenv('STOCK_RECEIPT_ROOT'));$this->assertNotFalse($historyRoot);file_put_contents($historyRoot.'/native-stock-history-page.json',json_encode($history->viewData('page'),JSON_THROW_ON_ERROR)); - $this->getJson('/api/stock-returns?state=confirmed')->assertOk()->assertJsonPath('pagination.total',1)->assertJsonPath('rows.0.version',2);$this->getJson('/api/stock-returns?state=prepared')->assertOk()->assertJsonPath('pagination.total',0); - $this->assertTrue(DB::table('audit_logs')->where('tenant_id',$this->f['tenant']->id)->where('action','warehouse_return.confirmed')->exists()); - $root=realpath((string)getenv('STOCK_RECEIPT_ROOT'));$this->assertNotFalse($root);file_put_contents($root.'/return-results.json',json_encode(['kind'=>'native_receipt_internal_issue_and_return','tenant'=>$this->f['tenant']->id,'warehouse'=>$this->f['warehouse']->id,'item'=>$this->f['stock']->id,'return_movement'=>$m,'request_id'=>$this->requestId,'physical_milli'=>'8000','native_movements'=>3,'shared_return_manifest_sha256'=>hash_file('sha256',base_path('packages/inventory-return/releases/0.1.0/manifest.json'))],JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR)); + return $this->postJson('/api/stock-returns/prepare', $payload ?? $this->payload); } - public function test_stale_capacity_idempotency_versions_rights_and_context_refuse_effect():void + + private function confirm(int $id, int $version = 1) { - $p=$this->prepare()->assertOk()->json('id');$changed=$this->payload;$changed['quantity']='2.000';$this->prepare($changed)->assertConflict();$second=$this->payload;$second['operation_key']=(string)Str::uuid();$other=$this->prepare($second)->assertOk()->json('id'); - $this->actingAs($this->f['otherReceiver']);$this->confirm($p)->assertForbidden();$this->actingAs($this->f['receiver']);$this->confirm($p,2)->assertStatus(422);$this->confirm($p)->assertOk();$this->confirm($other)->assertConflict();$this->assertSame(8000,$this->balance()); - $this->actingAs($this->f['issuer']);$second['quantity']='2.001';$second['operation_key']=(string)Str::uuid();$this->prepare($second)->assertConflict();$second['quantity']='2.000';$second['operation_key']=(string)Str::uuid();$p=$this->prepare($second)->assertOk()->json('id');$this->actingAs($this->f['receiver']);$this->confirm($p)->assertOk();$this->assertSame(10000,$this->balance()); - config(['stock_returns.enabled'=>false]);$this->getJson('/api/stock-returns')->assertStatus(503);$this->assertSame(10000,$this->balance()); + return $this->postJson('/api/stock-returns/'.$id.'/confirm', ['version' => $version, 'received_in_warehouse' => true, 'reason' => 'Synthetic independent physical warehouse receipt.']); } - public function test_decision_failure_rolls_back_physical_movement_and_retry_recovers():void + + private function closeProposal(int $id, string $action, int $version = 1) { - $p=$this->prepare()->assertOk()->json('id');$this->actingAs($this->f['receiver']);$fault=true;DB::listen(function($q)use(&$fault){if($fault&&preg_match('/insert into .*supply_records/i',$q->sql)){$fault=false;throw new \RuntimeException('Synthetic native return decision failure');}}); - $this->withoutExceptionHandling();try{$this->confirm($p);$this->fail('Missing fault');}catch(\RuntimeException $e){$this->assertSame('Synthetic native return decision failure',$e->getMessage());}$this->withExceptionHandling(); - $this->assertSame(5000,$this->balance());$this->assertSame(2,StockMovement::query()->count());$this->assertSame(1,StockOperation::query()->count());$this->confirm($p)->assertOk();$this->assertSame(8000,$this->balance()); + return $this->postJson('/api/stock-returns/'.$id.'/'.$action, ['version' => $version, 'reason' => 'Synthetic reason for closing without physical movement.']); } - public function test_undeclared_fraction_and_foreign_delivery_are_refused():void + + private function balance(): int { - $d=$this->payload;$d['declared_unused']=false;$this->prepare($d)->assertStatus(422);$d=$this->payload;$d['quantity']='0.0001';$this->prepare($d)->assertStatus(422); - $foreign=User::factory()->create(['tenant_id'=>\App\Models\Tenant::query()->create(['name'=>'Synthetic other native company'])->id]);\supplyGrant($foreign,['warehouse_return_prepare','warehouse_return_confirm','warehouse_return_read','warehouse']);$this->actingAs($foreign);$this->prepare()->assertNotFound();$this->getJson('/api/stock-returns')->assertOk()->assertJsonPath('pagination.total',0); + return (int) StockMovement::query()->sum('quantity_milli'); } - public function test_source_options_and_page_reuse_request_and_acknowledged_line():void + + public function test_native_receipt_issue_acknowledgement_and_return_same_book_once(): void { - $this->getJson('/api/stock-returns/sources?request_id='.$this->requestId)->assertOk()->assertJsonPath('options.0.delivery_event_id',$this->delivery)->assertJsonPath('options.0.item.code',$this->f['stock']->code)->assertJsonPath('can_prepare',true); - $this->get('/stock/devolucoes-internas?request_id='.$this->requestId)->assertOk()->assertHeader('Cache-Control','max-age=0, no-store, private')->assertInertia(fn($page)=>$page->component('stock/returns')->where('requestId',$this->requestId)->where('canPrepare',true)); - $this->getJson('/api/stock-returns?state=wrong')->assertStatus(422);$this->getJson('/api/stock-returns?page=0')->assertStatus(422);$this->getJson('/api/stock-returns?tenant_id=999')->assertStatus(422); - $this->actingAs($this->f['receiver']);$this->getJson('/api/stock-returns/sources?request_id='.$this->requestId)->assertOk()->assertJsonPath('can_prepare',false);$this->assertSame(5000,$this->balance()); - $this->actingAs($this->f['otherReceiver']);$this->get('/stock/operacoes')->assertOk()->assertInertia(fn($page)=>$page->where('canViewReturns',true));$this->get('/stock/devolucoes-internas')->assertOk()->assertInertia(fn($page)=>$page->component('stock/returns')->where('requestId',null)->where('canConfirm',false));$this->get('/stock/devolucoes-internas?request_id='.$this->requestId)->assertForbidden(); + $this->assertSame(5000, $this->balance()); + $p = $this->prepare()->assertOk()->assertJsonPath('impact.physical_before', '5000')->assertJsonPath('impact.physical_after', '8000')->json('id'); + $this->prepare()->assertOk()->assertJsonPath('id', $p)->assertJsonPath('replayed', true); + $this->confirm($p)->assertForbidden(); + $prepared = SupplyRecord::query()->findOrFail($p); + $this->assertSame($this->f['issuer']->id, $prepared->snapshot['source']['acknowledgement']['actor_id']); + $this->actingAs($this->f['receiver']); + $this->postJson('/api/stock-returns/'.$p.'/confirm', ['version' => 1, 'reason' => 'Synthetic receipt without acknowledgement'])->assertStatus(422); + $m = $this->confirm($p)->assertOk()->json('movement_id'); + $this->confirm($p)->assertOk()->assertJsonPath('movement_id', $m)->assertJsonPath('replayed', true); + $this->assertSame(8000, $this->balance()); + $this->assertSame(3, StockMovement::query()->count()); + $this->assertSame(2, StockOperation::query()->count()); + $this->assertSame(2, SupplyRecord::query()->where('kind', 'warehouse_return')->count()); + $history = $this->get('/stock/operacoes')->assertOk()->assertInertia(fn ($page) => $page->component('stock/operations')->where('canViewReturns', true)->where('operations.data.0.kind', 'workshop_return')->where('operations.data.0.snapshot.stock_item.id', $this->f['stock']->id)->where('operations.data.0.snapshot.warehouse.id', $this->f['warehouse']->id)->where('operations.data.0.snapshot.actor.id', $this->f['receiver']->id)->where('operations.data.0.snapshot.responsible.id', $this->f['receiver']->id)); + $historyRoot = realpath((string) getenv('STOCK_RECEIPT_ROOT')); + $this->assertNotFalse($historyRoot); + file_put_contents($historyRoot.'/native-stock-history-page.json', json_encode($history->viewData('page'), JSON_THROW_ON_ERROR)); + $this->getJson('/api/stock-returns?state=confirmed')->assertOk()->assertJsonPath('pagination.total', 1)->assertJsonPath('rows.0.version', 2); + $this->getJson('/api/stock-returns?state=prepared')->assertOk()->assertJsonPath('pagination.total', 0); + $this->assertTrue(DB::table('audit_logs')->where('tenant_id', $this->f['tenant']->id)->where('action', 'warehouse_return.confirmed')->exists()); + $root = realpath((string) getenv('STOCK_RECEIPT_ROOT')); + $this->assertNotFalse($root); + file_put_contents($root.'/return-results.json', json_encode(['kind' => 'native_receipt_internal_issue_and_return', 'tenant' => $this->f['tenant']->id, 'warehouse' => $this->f['warehouse']->id, 'item' => $this->f['stock']->id, 'return_movement' => $m, 'request_id' => $this->requestId, 'physical_milli' => '8000', 'native_movements' => 3, 'shared_return_manifest_sha256' => hash_file('sha256', base_path('packages/inventory-return/releases/0.1.0/manifest.json'))], JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR)); } - public function test_source_issue_with_return_cannot_be_reversed_as_a_whole():void + + public function test_stale_capacity_idempotency_versions_rights_and_context_refuse_effect(): void { - $p=$this->prepare()->assertOk()->json('id');$this->actingAs($this->f['receiver']);$this->confirm($p)->assertOk();$operation=(int)StockOperation::query()->where('kind','issue')->value('id'); - try{app(\App\Services\InventoryReversals::class)->basis(['source_kind'=>'operation','source_operation_id'=>$operation]);$this->fail('Original issue with return must not be reversed');}catch(\Illuminate\Validation\ValidationException $e){$this->assertStringContainsString('devolução física',implode(' ',array_merge(...array_values($e->errors()))));} - $this->assertSame(8000,$this->balance()); + $p = $this->prepare()->assertOk()->json('id'); + $changed = $this->payload; + $changed['quantity'] = '2.000'; + $this->prepare($changed)->assertConflict(); + $second = $this->payload; + $second['operation_key'] = (string) Str::uuid(); + $other = $this->prepare($second)->assertOk()->json('id'); + $this->actingAs($this->f['otherReceiver']); + $this->confirm($p)->assertForbidden(); + $this->actingAs($this->f['receiver']); + $this->confirm($p, 2)->assertStatus(422); + $this->confirm($p)->assertOk(); + $this->confirm($other)->assertConflict(); + $this->assertSame(8000, $this->balance()); + $this->actingAs($this->f['issuer']); + $second['quantity'] = '2.001'; + $second['operation_key'] = (string) Str::uuid(); + $this->prepare($second)->assertConflict(); + $second['quantity'] = '2.000'; + $second['operation_key'] = (string) Str::uuid(); + $p = $this->prepare($second)->assertOk()->json('id'); + $this->actingAs($this->f['receiver']); + $this->confirm($p)->assertOk(); + $this->assertSame(10000, $this->balance()); + config(['stock_returns.enabled' => false]); + $this->getJson('/api/stock-returns')->assertStatus(503); + $this->assertSame(10000, $this->balance()); } - public function test_concurrent_native_confirmation_waits_then_replays_one_movement():void + + public function test_decision_failure_rolls_back_physical_movement_and_retry_recovers(): void + { + $p = $this->prepare()->assertOk()->json('id'); + $this->actingAs($this->f['receiver']); + $fault = true; + DB::listen(function ($q) use (&$fault) { + if ($fault && preg_match('/insert into .*supply_records/i', $q->sql)) { + $fault = false; + throw new \RuntimeException('Synthetic native return decision failure'); + } + }); + $this->withoutExceptionHandling(); + try { + $this->confirm($p); + $this->fail('Missing fault'); + } catch (\RuntimeException $e) { + $this->assertSame('Synthetic native return decision failure', $e->getMessage()); + }$this->withExceptionHandling(); + $this->assertSame(5000, $this->balance()); + $this->assertSame(2, StockMovement::query()->count()); + $this->assertSame(1, StockOperation::query()->count()); + $this->confirm($p)->assertOk(); + $this->assertSame(8000, $this->balance()); + } + + public function test_undeclared_fraction_and_foreign_delivery_are_refused(): void + { + $d = $this->payload; + $d['declared_unused'] = false; + $this->prepare($d)->assertStatus(422); + $d = $this->payload; + $d['quantity'] = '0.0001'; + $this->prepare($d)->assertStatus(422); + $foreign = User::factory()->create(['tenant_id' => Tenant::query()->create(['name' => 'Synthetic other native company'])->id]); + \supplyGrant($foreign, ['warehouse_return_prepare', 'warehouse_return_confirm', 'warehouse_return_read', 'warehouse']); + $this->actingAs($foreign); + $this->prepare()->assertNotFound(); + $this->getJson('/api/stock-returns')->assertOk()->assertJsonPath('pagination.total', 0); + } + + public function test_source_options_and_page_reuse_request_and_acknowledged_line(): void + { + $this->getJson('/api/stock-returns/sources?request_id='.$this->requestId)->assertOk()->assertJsonPath('options.0.delivery_event_id', $this->delivery)->assertJsonPath('options.0.item.code', $this->f['stock']->code)->assertJsonPath('can_prepare', true); + $this->get('/stock/devolucoes-internas?request_id='.$this->requestId)->assertOk()->assertHeader('Cache-Control', 'max-age=0, no-store, private')->assertInertia(fn ($page) => $page->component('stock/returns')->where('requestId', $this->requestId)->where('canPrepare', true)); + $this->getJson('/api/stock-returns?state=wrong')->assertStatus(422); + $this->getJson('/api/stock-returns?page=0')->assertStatus(422); + $this->getJson('/api/stock-returns?tenant_id=999')->assertStatus(422); + $this->actingAs($this->f['receiver']); + $this->getJson('/api/stock-returns/sources?request_id='.$this->requestId)->assertOk()->assertJsonPath('can_prepare', false); + $this->assertSame(5000, $this->balance()); + $this->actingAs($this->f['otherReceiver']); + $this->get('/stock/operacoes')->assertOk()->assertInertia(fn ($page) => $page->where('canViewReturns', true)); + $this->get('/stock/devolucoes-internas')->assertOk()->assertInertia(fn ($page) => $page->component('stock/returns')->where('requestId', null)->where('canConfirm', false)); + $this->get('/stock/devolucoes-internas?request_id='.$this->requestId)->assertForbidden(); + } + + public function test_source_issue_with_return_cannot_be_reversed_as_a_whole(): void + { + $p = $this->prepare()->assertOk()->json('id'); + $this->actingAs($this->f['receiver']); + $this->confirm($p)->assertOk(); + $operation = (int) StockOperation::query()->where('kind', 'issue')->value('id'); + try { + app(InventoryReversals::class)->basis(['source_kind' => 'operation', 'source_operation_id' => $operation]); + $this->fail('Original issue with return must not be reversed'); + } catch (ValidationException $e) { + $this->assertStringContainsString('devolução física', implode(' ', array_merge(...array_values($e->errors())))); + } + $this->assertSame(8000, $this->balance()); + } + + public function test_concurrent_native_confirmation_waits_then_replays_one_movement(): void { $this->nativeRace(); } - private function nativeRace(?int $given=null,?int $workerProposal=null,int $workerStatus=200,bool $parentWithdraw=false,?User $workerActor=null,string $workerAction='confirm'):void + + private function nativeRace(?int $given = null, ?int $workerProposal = null, int $workerStatus = 200, bool $parentWithdraw = false, ?User $workerActor = null, string $workerAction = 'confirm'): void { - $p=$given??$this->prepare()->assertOk()->json('id');$this->actingAs($this->f[$parentWithdraw?'issuer':'receiver']);$root=realpath((string)getenv('STOCK_RECEIPT_ROOT'));$dir=$root.'/return-race-'.bin2hex(random_bytes(6));mkdir($dir,0700,true);$input=$dir.'/worker.json';$application='native_return_'.bin2hex(random_bytes(6));$process=null; - file_put_contents($input,json_encode(['actor'=>($workerActor??$this->f['receiver'])->id,'proposal'=>$workerProposal??$p,'application'=>$application,'action'=>$workerAction],JSON_THROW_ON_ERROR));DB::beginTransaction(); - try{$winner=$parentWithdraw?$this->closeProposal($p,'withdraw')->assertOk()->json('id'):$this->confirm($p)->assertOk()->json('movement_id');$pipes=[];$process=proc_open([PHP_BINARY,base_path('tests/Support/warehouse-return-worker.php'),$input],[0=>['pipe','r'],1=>['file',$dir.'/stdout','w'],2=>['file',$dir.'/stderr','w']],$pipes,base_path());$this->assertIsResource($process);fclose($pipes[0]);$parent=(int)DB::selectOne('SELECT pg_backend_pid() AS id')->id;$wait=null;$deadline=microtime(true)+10; - do{DB::select('SELECT pg_stat_clear_snapshot()');$wait=DB::selectOne("SELECT to_json(pg_blocking_pids(pid)) AS blockers FROM pg_stat_activity WHERE application_name=? AND wait_event_type='Lock'",[$application]);if(!$wait)usleep(25000);}while(!$wait&µtime(true)<$deadline);$this->assertNotNull($wait);$this->assertContains($parent,json_decode($wait->blockers,true));DB::commit(); - $deadline=microtime(true)+15;do{$status=proc_get_status($process);if(!$status['running'])break;usleep(25000);}while(microtime(true)<$deadline);$this->assertFalse($status['running']);$exit=proc_close($process);$process=null;if($exit===-1)$exit=$status['exitcode'];$this->assertSame(0,$exit);$result=json_decode(file_get_contents($input.'.result'),true);$this->assertSame($workerStatus,$result['status']);if($workerStatus===200){$this->assertTrue($result['result']['replayed']);$this->assertSame($winner,$result['result']['movement_id']);} - }finally{if(is_resource($process)){proc_terminate($process);proc_close($process);}while(DB::transactionLevel()>0)DB::rollBack();} - $this->assertSame($parentWithdraw?5000:8000,$this->balance());$this->assertSame($parentWithdraw?2:3,StockMovement::query()->count());$this->assertSame(1,SupplyRecord::query()->where('kind','warehouse_return')->where('state',$parentWithdraw?'withdrawn':'confirmed')->count()); + $p = $given ?? $this->prepare()->assertOk()->json('id'); + $this->actingAs($this->f[$parentWithdraw ? 'issuer' : 'receiver']); + $root = realpath((string) getenv('STOCK_RECEIPT_ROOT')); + $dir = $root.'/return-race-'.bin2hex(random_bytes(6)); + mkdir($dir, 0700, true); + $input = $dir.'/worker.json'; + $application = 'native_return_'.bin2hex(random_bytes(6)); + $process = null; + file_put_contents($input, json_encode(['actor' => ($workerActor ?? $this->f['receiver'])->id, 'proposal' => $workerProposal ?? $p, 'application' => $application, 'action' => $workerAction], JSON_THROW_ON_ERROR)); + DB::beginTransaction(); + try { + $winner = $parentWithdraw ? $this->closeProposal($p, 'withdraw')->assertOk()->json('id') : $this->confirm($p)->assertOk()->json('movement_id'); + $pipes = []; + $process = proc_open([PHP_BINARY, base_path('tests/Support/warehouse-return-worker.php'), $input], [0 => ['pipe', 'r'], 1 => ['file', $dir.'/stdout', 'w'], 2 => ['file', $dir.'/stderr', 'w']], $pipes, base_path()); + $this->assertIsResource($process); + fclose($pipes[0]); + $parent = (int) DB::selectOne('SELECT pg_backend_pid() AS id')->id; + $wait = null; + $deadline = microtime(true) + 10; + do { + DB::select('SELECT pg_stat_clear_snapshot()'); + $wait = DB::selectOne("SELECT to_json(pg_blocking_pids(pid)) AS blockers FROM pg_stat_activity WHERE application_name=? AND wait_event_type='Lock'", [$application]); + if (! $wait) { + usleep(25000); + } + } while (! $wait && microtime(true) < $deadline); + $this->assertNotNull($wait); + $this->assertContains($parent, json_decode($wait->blockers, true)); + DB::commit(); + $deadline = microtime(true) + 15; + do { + $status = proc_get_status($process); + if (! $status['running']) { + break; + }usleep(25000); + } while (microtime(true) < $deadline); + $this->assertFalse($status['running']); + $exit = proc_close($process); + $process = null; + if ($exit === -1) { + $exit = $status['exitcode']; + }$this->assertSame(0, $exit); + $result = json_decode(file_get_contents($input.'.result'), true); + $this->assertSame($workerStatus, $result['status']); + if ($workerStatus === 200) { + $this->assertTrue($result['result']['replayed']); + $this->assertSame($winner, $result['result']['movement_id']); + } + } finally { + if (is_resource($process)) { + proc_terminate($process); + proc_close($process); + }while (DB::transactionLevel() > 0) { + DB::rollBack(); + } + } + $this->assertSame($parentWithdraw ? 5000 : 8000, $this->balance()); + $this->assertSame($parentWithdraw ? 2 : 3, StockMovement::query()->count()); + $this->assertSame(1, SupplyRecord::query()->where('kind', 'warehouse_return')->where('state', $parentWithdraw ? 'withdrawn' : 'confirmed')->count()); } - public function test_competing_native_returns_cannot_exceed_the_original_delivery():void + + public function test_competing_native_returns_cannot_exceed_the_original_delivery(): void { - $p=$this->prepare()->assertOk()->json('id');$d=$this->payload;$d['operation_key']=(string)Str::uuid();$other=$this->prepare($d)->assertOk()->json('id');$this->nativeRace($p,$other,409); + $p = $this->prepare()->assertOk()->json('id'); + $d = $this->payload; + $d['operation_key'] = (string) Str::uuid(); + $other = $this->prepare($d)->assertOk()->json('id'); + $this->nativeRace($p, $other, 409); } - public function test_expired_and_maintenance_profiles_are_revalidated_at_confirmation():void + + public function test_expired_and_maintenance_profiles_are_revalidated_at_confirmation(): void { - $p=$this->prepare()->assertOk()->json('id');$this->actingAs($this->f['receiver']);DB::table('organization_memberships')->where('user_id',$this->f['receiver']->id)->update(['maintenance'=>true]);$this->confirm($p)->assertForbidden();DB::table('organization_memberships')->where('user_id',$this->f['receiver']->id)->update(['maintenance'=>false,'expires_at'=>now()->subMinute()]);$this->confirm($p)->assertForbidden();$this->assertSame(5000,$this->balance());DB::table('organization_memberships')->where('user_id',$this->f['receiver']->id)->update(['expires_at'=>null]);$this->confirm($p)->assertOk();$this->assertSame(8000,$this->balance()); + $p = $this->prepare()->assertOk()->json('id'); + $this->actingAs($this->f['receiver']); + DB::table('organization_memberships')->where('user_id', $this->f['receiver']->id)->update(['maintenance' => true]); + $this->confirm($p)->assertForbidden(); + DB::table('organization_memberships')->where('user_id', $this->f['receiver']->id)->update(['maintenance' => false, 'expires_at' => now()->subMinute()]); + $this->confirm($p)->assertForbidden(); + $this->assertSame(5000, $this->balance()); + DB::table('organization_memberships')->where('user_id', $this->f['receiver']->id)->update(['expires_at' => null]); + $this->confirm($p)->assertOk(); + $this->assertSame(8000, $this->balance()); } - public function test_configured_context_and_permissions_cannot_be_inherited_from_people_profile():void + + public function test_configured_context_and_permissions_cannot_be_inherited_from_people_profile(): void { - $tenant=$this->f['tenant']->id;$this->f['tenant']->update(['rules_provisional'=>false,'work_context_policy'=>['revision'=>1,'enabled'=>['procurement.internal','people.internal']]]);config(['work_context.entitlements.'.$tenant=>['procurement.internal','people.internal']]);DB::table('organization_profiles')->where('tenant_id',$tenant)->update(['work_contexts'=>json_encode(['procurement.internal'])]); - $this->prepare()->assertForbidden();$this->post('/contexto',['area'=>'procurement','option'=>'procurement.internal'])->assertRedirect('/dashboard');$p=$this->prepare()->assertOk()->json('id');$this->actingAs($this->f['receiver']);$this->confirm($p)->assertForbidden();$this->post('/contexto',['area'=>'procurement','option'=>'procurement.internal'])->assertRedirect('/dashboard'); - $profiles=DB::table('organization_memberships')->where('user_id',$this->f['receiver']->id)->pluck('profile_id');DB::table('organization_profiles')->whereIn('id',$profiles)->update(['permissions'=>json_encode(['warehouse','warehouse_request_deliver','warehouse_return_read'])]);\supplyGrant($this->f['receiver'],['warehouse_return_confirm']);$other=DB::table('organization_profiles')->where('tenant_id',$tenant)->whereNotIn('id',$profiles)->orderByDesc('id')->value('id');DB::table('organization_profiles')->where('id',$other)->update(['work_contexts'=>json_encode(['people.internal'])]); - $this->confirm($p)->assertForbidden();$this->assertSame(5000,$this->balance());DB::table('organization_profiles')->where('id',$other)->update(['work_contexts'=>json_encode(['procurement.internal'])]);$this->confirm($p)->assertOk();$this->assertSame(8000,$this->balance()); + $tenant = $this->f['tenant']->id; + $this->f['tenant']->update(['rules_provisional' => false, 'work_context_policy' => ['revision' => 1, 'enabled' => ['procurement.internal', 'people.internal']]]); + config(['work_context.entitlements.'.$tenant => ['procurement.internal', 'people.internal']]); + DB::table('organization_profiles')->where('tenant_id', $tenant)->update(['work_contexts' => json_encode(['procurement.internal'])]); + $this->prepare()->assertForbidden(); + $this->post('/contexto', ['area' => 'procurement', 'option' => 'procurement.internal'])->assertRedirect('/dashboard'); + $p = $this->prepare()->assertOk()->json('id'); + $this->actingAs($this->f['receiver']); + $this->confirm($p)->assertForbidden(); + $this->post('/contexto', ['area' => 'procurement', 'option' => 'procurement.internal'])->assertRedirect('/dashboard'); + $profiles = DB::table('organization_memberships')->where('user_id', $this->f['receiver']->id)->pluck('profile_id'); + DB::table('organization_profiles')->whereIn('id', $profiles)->update(['permissions' => json_encode(['warehouse', 'warehouse_request_deliver', 'warehouse_return_read'])]); + \supplyGrant($this->f['receiver'], ['warehouse_return_confirm']); + $other = DB::table('organization_profiles')->where('tenant_id', $tenant)->whereNotIn('id', $profiles)->orderByDesc('id')->value('id'); + DB::table('organization_profiles')->where('id', $other)->update(['work_contexts' => json_encode(['people.internal'])]); + $this->confirm($p)->assertForbidden(); + $this->assertSame(5000, $this->balance()); + DB::table('organization_profiles')->where('id', $other)->update(['work_contexts' => json_encode(['procurement.internal'])]); + $this->confirm($p)->assertOk(); + $this->assertSame(8000, $this->balance()); } - public function test_return_signals_existing_replenishment_only_once_and_inside_transaction():void + + public function test_return_signals_existing_replenishment_only_once_and_inside_transaction(): void { - $spy=new class extends \App\Services\AutomaticPurchases {public array $calls=[];public function signal(User $actor,int $item,int $warehouse):void {$this->calls[]=['actor'=>$actor->id,'item'=>$item,'warehouse'=>$warehouse,'transaction_level'=>DB::transactionLevel()];}}; - $this->app->instance(\App\Services\AutomaticPurchases::class,$spy);$p=$this->prepare()->assertOk()->json('id');$this->assertCount(0,$spy->calls);$this->actingAs($this->f['receiver']);$this->confirm($p)->assertOk();$this->confirm($p)->assertOk()->assertJsonPath('replayed',true); - $this->assertCount(1,$spy->calls);$this->assertSame($this->f['stock']->id,$spy->calls[0]['item']);$this->assertSame($this->f['warehouse']->id,$spy->calls[0]['warehouse']);$this->assertGreaterThan(0,$spy->calls[0]['transaction_level']);$this->assertSame(8000,$this->balance()); + $spy = new class extends AutomaticPurchases + { + public array $calls = []; + + public function signal(User $actor, int $item, int $warehouse): void + { + $this->calls[] = ['actor' => $actor->id, 'item' => $item, 'warehouse' => $warehouse, 'transaction_level' => DB::transactionLevel()]; + } + }; + $this->app->instance(AutomaticPurchases::class, $spy); + $p = $this->prepare()->assertOk()->json('id'); + $this->assertCount(0, $spy->calls); + $this->actingAs($this->f['receiver']); + $this->confirm($p)->assertOk(); + $this->confirm($p)->assertOk()->assertJsonPath('replayed', true); + $this->assertCount(1, $spy->calls); + $this->assertSame($this->f['stock']->id, $spy->calls[0]['item']); + $this->assertSame($this->f['warehouse']->id, $spy->calls[0]['warehouse']); + $this->assertGreaterThan(0, $spy->calls[0]['transaction_level']); + $this->assertSame(8000, $this->balance()); } - public function test_catalogue_rename_requires_new_review_preserving_original_and_unit_change_refuses():void + + public function test_catalogue_rename_requires_new_review_preserving_original_and_unit_change_refuses(): void { - $name=$this->f['stock']->name;$p=$this->prepare()->assertOk()->json('id');$this->f['stock']->update(['name'=>'Synthetic renamed article']);$this->actingAs($this->f['receiver']);$this->confirm($p)->assertConflict();$this->assertSame(5000,$this->balance()); - $this->actingAs($this->f['issuer']);$this->payload['operation_key']=(string)Str::uuid();$p=$this->prepare()->assertOk()->assertJsonPath('impact.item.name','Synthetic renamed article')->json('id');$this->assertSame($name,SupplyRecord::query()->findOrFail($p)->snapshot['source']['original_item']['name']);$this->actingAs($this->f['receiver']);$this->confirm($p)->assertOk();$this->assertSame(8000,$this->balance()); - $this->f['stock']->update(['unit'=>'KG']);$this->actingAs($this->f['issuer']);$this->payload['operation_key']=(string)Str::uuid();$this->payload['quantity']='1.000';$this->prepare()->assertConflict();$this->assertSame(8000,$this->balance()); + $name = $this->f['stock']->name; + $p = $this->prepare()->assertOk()->json('id'); + $this->f['stock']->update(['name' => 'Synthetic renamed article']); + $this->actingAs($this->f['receiver']); + $this->confirm($p)->assertConflict(); + $this->assertSame(5000, $this->balance()); + $this->actingAs($this->f['issuer']); + $this->payload['operation_key'] = (string) Str::uuid(); + $p = $this->prepare()->assertOk()->assertJsonPath('impact.item.name', 'Synthetic renamed article')->json('id'); + $this->assertSame($name, SupplyRecord::query()->findOrFail($p)->snapshot['source']['original_item']['name']); + $this->actingAs($this->f['receiver']); + $this->confirm($p)->assertOk(); + $this->assertSame(8000, $this->balance()); + $this->f['stock']->update(['unit' => 'KG']); + $this->actingAs($this->f['issuer']); + $this->payload['operation_key'] = (string) Str::uuid(); + $this->payload['quantity'] = '1.000'; + $this->prepare()->assertConflict(); + $this->assertSame(8000, $this->balance()); } - public function test_unavailable_private_package_returns_503_and_rolls_back_before_recovery():void + + public function test_unavailable_private_package_returns_503_and_rolls_back_before_recovery(): void { - $p=$this->prepare()->assertOk()->json('id');$this->actingAs($this->f['receiver']);$root=realpath((string)getenv('STOCK_RECEIPT_ROOT'));$manifest=realpath(base_path('packages/inventory-return/releases/0.1.0/manifest.json'));$this->assertStringStartsWith($root.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR,$manifest);$original=file_get_contents($manifest);$this->assertNotFalse($original); - try{file_put_contents($manifest,'{"synthetic_private_fault":true}');$this->confirm($p)->assertStatus(503);}finally{file_put_contents($manifest,$original);} - $this->assertSame(5000,$this->balance());$this->assertSame(1,StockOperation::query()->count());$this->assertSame(2,StockMovement::query()->count());$this->confirm($p)->assertOk();$this->assertSame(8000,$this->balance()); + $p = $this->prepare()->assertOk()->json('id'); + $this->actingAs($this->f['receiver']); + $root = realpath((string) getenv('STOCK_RECEIPT_ROOT')); + $manifest = realpath(base_path('packages/inventory-return/releases/0.1.0/manifest.json')); + $this->assertStringStartsWith($root.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR, $manifest); + $original = file_get_contents($manifest); + $this->assertNotFalse($original); + try { + file_put_contents($manifest, '{"synthetic_private_fault":true}'); + $this->confirm($p)->assertStatus(503); + } finally { + file_put_contents($manifest, $original); + } + $this->assertSame(5000, $this->balance()); + $this->assertSame(1, StockOperation::query()->count()); + $this->assertSame(2, StockMovement::query()->count()); + $this->confirm($p)->assertOk(); + $this->assertSame(8000, $this->balance()); } - public function test_http_busy_response_leaves_proposal_unconfirmed_then_manual_retry_succeeds():void + + public function test_http_busy_response_leaves_proposal_unconfirmed_then_manual_retry_succeeds(): void { - $p=$this->prepare()->assertOk()->json('id');$this->actingAs($this->f['receiver']);$root=realpath((string)getenv('STOCK_RECEIPT_ROOT'));$dir=$root.'/return-busy-'.bin2hex(random_bytes(6));mkdir($dir,0700,true);$input=$dir.'/worker.json';$appName='native_return_busy_'.bin2hex(random_bytes(6));$process=null;file_put_contents($input,json_encode(['actor'=>$this->f['receiver']->id,'proposal'=>$p,'application'=>$appName,'http'=>true],JSON_THROW_ON_ERROR));DB::beginTransaction(); - try{DB::table('tenants')->where('id',$this->f['tenant']->id)->lockForUpdate()->first();$pipes=[];$process=proc_open([PHP_BINARY,base_path('tests/Support/warehouse-return-worker.php'),$input],[0=>['pipe','r'],1=>['file',$dir.'/stdout','w'],2=>['file',$dir.'/stderr','w']],$pipes,base_path());$this->assertIsResource($process);fclose($pipes[0]);$parent=(int)DB::selectOne('SELECT pg_backend_pid() AS id')->id;$wait=null;$deadline=microtime(true)+10; - do{DB::select('SELECT pg_stat_clear_snapshot()');$wait=DB::selectOne("SELECT to_json(pg_blocking_pids(pid)) AS blockers FROM pg_stat_activity WHERE application_name=? AND wait_event_type='Lock'",[$appName]);if(!$wait)usleep(25000);}while(!$wait&µtime(true)<$deadline);$this->assertNotNull($wait);$this->assertContains($parent,json_decode($wait->blockers,true)); - $deadline=microtime(true)+12;do{$status=proc_get_status($process);if(!$status['running'])break;usleep(25000);}while(microtime(true)<$deadline);$this->assertFalse($status['running']);$exit=proc_close($process);$process=null;if($exit===-1)$exit=$status['exitcode'];$this->assertSame(0,$exit);$r=json_decode(file_get_contents($input.'.result'),true);$this->assertSame(423,$r['status']);$this->assertSame('warehouse_return_busy',$r['result']['code']);$this->assertArrayNotHasKey('exception',$r['result']);$this->assertSame(5000,$this->balance());DB::commit(); - }finally{if(is_resource($process)){proc_terminate($process);proc_close($process);}while(DB::transactionLevel()>0)DB::rollBack();} - $this->assertSame(0,SupplyRecord::query()->where('kind','warehouse_return')->where('state','confirmed')->count());$this->confirm($p)->assertOk();$this->assertSame(8000,$this->balance()); + $p = $this->prepare()->assertOk()->json('id'); + $this->actingAs($this->f['receiver']); + $root = realpath((string) getenv('STOCK_RECEIPT_ROOT')); + $dir = $root.'/return-busy-'.bin2hex(random_bytes(6)); + mkdir($dir, 0700, true); + $input = $dir.'/worker.json'; + $appName = 'native_return_busy_'.bin2hex(random_bytes(6)); + $process = null; + file_put_contents($input, json_encode(['actor' => $this->f['receiver']->id, 'proposal' => $p, 'application' => $appName, 'http' => true], JSON_THROW_ON_ERROR)); + DB::beginTransaction(); + try { + DB::table('tenants')->where('id', $this->f['tenant']->id)->lockForUpdate()->first(); + $pipes = []; + $process = proc_open([PHP_BINARY, base_path('tests/Support/warehouse-return-worker.php'), $input], [0 => ['pipe', 'r'], 1 => ['file', $dir.'/stdout', 'w'], 2 => ['file', $dir.'/stderr', 'w']], $pipes, base_path()); + $this->assertIsResource($process); + fclose($pipes[0]); + $parent = (int) DB::selectOne('SELECT pg_backend_pid() AS id')->id; + $wait = null; + $deadline = microtime(true) + 10; + do { + DB::select('SELECT pg_stat_clear_snapshot()'); + $wait = DB::selectOne("SELECT to_json(pg_blocking_pids(pid)) AS blockers FROM pg_stat_activity WHERE application_name=? AND wait_event_type='Lock'", [$appName]); + if (! $wait) { + usleep(25000); + } + } while (! $wait && microtime(true) < $deadline); + $this->assertNotNull($wait); + $this->assertContains($parent, json_decode($wait->blockers, true)); + $deadline = microtime(true) + 12; + do { + $status = proc_get_status($process); + if (! $status['running']) { + break; + }usleep(25000); + } while (microtime(true) < $deadline); + $this->assertFalse($status['running']); + $exit = proc_close($process); + $process = null; + if ($exit === -1) { + $exit = $status['exitcode']; + }$this->assertSame(0, $exit); + $r = json_decode(file_get_contents($input.'.result'), true); + $this->assertSame(423, $r['status']); + $this->assertSame('warehouse_return_busy', $r['result']['code']); + $this->assertArrayNotHasKey('exception', $r['result']); + $this->assertSame(5000, $this->balance()); + DB::commit(); + } finally { + if (is_resource($process)) { + proc_terminate($process); + proc_close($process); + }while (DB::transactionLevel() > 0) { + DB::rollBack(); + } + } + $this->assertSame(0, SupplyRecord::query()->where('kind', 'warehouse_return')->where('state', 'confirmed')->count()); + $this->confirm($p)->assertOk(); + $this->assertSame(8000, $this->balance()); } - public function test_withdrawal_and_independent_rejection_close_pending_without_stock_effect():void + + public function test_withdrawal_and_independent_rejection_close_pending_without_stock_effect(): void { - $p=$this->prepare()->assertOk()->json('id');$this->closeProposal($p,'reject')->assertForbidden();\supplyGrant($this->f['receiver'],['warehouse_return_prepare']);$this->actingAs($this->f['receiver']);$this->closeProposal($p,'withdraw')->assertForbidden();$this->actingAs($this->f['issuer']);$this->closeProposal($p,'withdraw',2)->assertConflict();$this->closeProposal($p,'withdraw')->assertOk()->assertJsonPath('state','withdrawn');$this->closeProposal($p,'withdraw')->assertOk()->assertJsonPath('replayed',true);$this->prepare()->assertOk()->assertJsonPath('id',$p)->assertJsonPath('state','withdrawn'); - $this->actingAs($this->f['receiver']);$this->confirm($p)->assertConflict();$this->getJson('/api/stock-returns?state=prepared')->assertOk()->assertJsonPath('pagination.total',0);$this->getJson('/api/stock-returns?state=withdrawn')->assertOk()->assertJsonPath('pagination.total',1); - $this->actingAs($this->f['issuer']);$this->payload['operation_key']=(string)Str::uuid();$p=$this->prepare()->assertOk()->json('id');$this->actingAs($this->f['receiver']);$this->closeProposal($p,'reject')->assertOk()->assertJsonPath('state','rejected');$this->closeProposal($p,'reject')->assertOk()->assertJsonPath('replayed',true);$this->confirm($p)->assertConflict();$this->getJson('/api/stock-returns?state=rejected')->assertOk()->assertJsonPath('pagination.total',1); - $this->assertSame(5000,$this->balance());$this->assertSame(2,StockMovement::query()->count());$this->assertSame(1,StockOperation::query()->count());$this->assertSame(4,SupplyRecord::query()->where('kind','warehouse_return')->count());$this->assertSame(1,DB::table('audit_logs')->where('tenant_id',$this->f['tenant']->id)->where('action','warehouse_return.withdrawn')->count()); + $p = $this->prepare()->assertOk()->json('id'); + $this->closeProposal($p, 'reject')->assertForbidden(); + \supplyGrant($this->f['receiver'], ['warehouse_return_prepare']); + $this->actingAs($this->f['receiver']); + $this->closeProposal($p, 'withdraw')->assertForbidden(); + $this->actingAs($this->f['issuer']); + $this->closeProposal($p, 'withdraw', 2)->assertConflict(); + $this->closeProposal($p, 'withdraw')->assertOk()->assertJsonPath('state', 'withdrawn'); + $this->closeProposal($p, 'withdraw')->assertOk()->assertJsonPath('replayed', true); + $this->prepare()->assertOk()->assertJsonPath('id', $p)->assertJsonPath('state', 'withdrawn'); + $this->actingAs($this->f['receiver']); + $this->confirm($p)->assertConflict(); + $this->getJson('/api/stock-returns?state=prepared')->assertOk()->assertJsonPath('pagination.total', 0); + $this->getJson('/api/stock-returns?state=withdrawn')->assertOk()->assertJsonPath('pagination.total', 1); + $this->actingAs($this->f['issuer']); + $this->payload['operation_key'] = (string) Str::uuid(); + $p = $this->prepare()->assertOk()->json('id'); + $this->actingAs($this->f['receiver']); + $this->closeProposal($p, 'reject')->assertOk()->assertJsonPath('state', 'rejected'); + $this->closeProposal($p, 'reject')->assertOk()->assertJsonPath('replayed', true); + $this->confirm($p)->assertConflict(); + $this->getJson('/api/stock-returns?state=rejected')->assertOk()->assertJsonPath('pagination.total', 1); + $this->assertSame(5000, $this->balance()); + $this->assertSame(2, StockMovement::query()->count()); + $this->assertSame(1, StockOperation::query()->count()); + $this->assertSame(4, SupplyRecord::query()->where('kind', 'warehouse_return')->count()); + $this->assertSame(1, DB::table('audit_logs')->where('tenant_id', $this->f['tenant']->id)->where('action', 'warehouse_return.withdrawn')->count()); } - public function test_withdrawal_wins_before_confirmation_without_a_movement():void + + public function test_withdrawal_wins_before_confirmation_without_a_movement(): void { - $p=$this->prepare()->assertOk()->json('id');$this->nativeRace($p,$p,409,true); + $p = $this->prepare()->assertOk()->json('id'); + $this->nativeRace($p, $p, 409, true); } - public function test_confirmation_wins_before_withdrawal_without_duplicate_terminal_state():void + + public function test_confirmation_wins_before_withdrawal_without_duplicate_terminal_state(): void { - $p=$this->prepare()->assertOk()->json('id');$this->nativeRace($p,$p,409,false,$this->f['issuer'],'withdraw'); + $p = $this->prepare()->assertOk()->json('id'); + $this->nativeRace($p, $p, 409, false, $this->f['issuer'], 'withdraw'); } - public function test_return_changes_physical_history_without_silently_changing_gross_issue_forecast():void + + public function test_return_changes_physical_history_without_silently_changing_gross_issue_forecast(): void { - $history=app(\App\Services\SupplyHistory::class);$date=now()->toDateString(); - $before=$history->analyse($this->f['stock']->id,$this->f['warehouse']->id,$date,$date); - $p=$this->prepare()->assertOk()->json('id');$this->actingAs($this->f['receiver']);$this->confirm($p)->assertOk(); - $after=$history->analyse($this->f['stock']->id,$this->f['warehouse']->id,$date,$date); - $this->assertSame(5000,$before['total_milli']);$this->assertSame(5000,$after['total_milli']); - $this->assertSame($before['daily_mean_milli'],$after['daily_mean_milli']); - $this->assertSame(5000,$before['series'][0]['balance_milli']);$this->assertSame(8000,$after['series'][0]['balance_milli']); - $this->assertSame(1,$after['movement_types']['workshop_return_in']);$this->assertNotSame($before['source_hash'],$after['source_hash']); - $this->assertSame($before['convention'],$after['convention']);$this->assertSame(3,$after['movement_count']); + $history = app(SupplyHistory::class); + $date = now()->toDateString(); + $before = $history->analyse($this->f['stock']->id, $this->f['warehouse']->id, $date, $date); + $p = $this->prepare()->assertOk()->json('id'); + $this->actingAs($this->f['receiver']); + $this->confirm($p)->assertOk(); + $after = $history->analyse($this->f['stock']->id, $this->f['warehouse']->id, $date, $date); + $this->assertSame(5000, $before['total_milli']); + $this->assertSame(5000, $after['total_milli']); + $this->assertSame($before['daily_mean_milli'], $after['daily_mean_milli']); + $this->assertSame(5000, $before['series'][0]['balance_milli']); + $this->assertSame(8000, $after['series'][0]['balance_milli']); + $this->assertSame(1, $after['movement_types']['workshop_return_in']); + $this->assertNotSame($before['source_hash'], $after['source_hash']); + $this->assertSame($before['convention'], $after['convention']); + $this->assertSame(3, $after['movement_count']); + $this->assertSame(8000, $this->balance()); + file_put_contents((string) getenv('STOCK_RECEIPT_ROOT').'/return-forecast-boundary.json', json_encode(['gross_issue_milli' => 5000, 'returned_milli' => 3000, 'physical_before_milli' => 5000, 'physical_after_milli' => 8000, 'historical_mean_unchanged' => true, 'source_hash_changed' => true, 'planning_convention_unchanged' => true, 'net_consumption_forecast_implemented' => false], JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR)); + } + + public function test_history_pages_and_batch_preparer_lookup_cover_the_full_pending_universe(): void + { + $p = $this->prepare()->assertOk()->json('id'); + $row = SupplyRecord::query()->findOrFail($p)->getAttributes(); + unset($row['id']); + for ($i = 0; $i < 50; $i++) { + $copy = $row; + $key = (string) Str::uuid(); + $copy['record_key'] = $key; + $copy['operation_key'] = $key; + $data = json_decode($copy['data'], true, 512, JSON_THROW_ON_ERROR); + $data['operation_key'] = $key; + $copy['data'] = json_encode($data, JSON_THROW_ON_ERROR); + $copy['input_hash'] = hash('sha256', $copy['data']); + DB::table('supply_records')->insert($copy); + } + $queries = []; + $capture = true; + DB::listen(function ($q) use (&$queries, &$capture) { + if ($capture && str_starts_with(strtolower($q->sql), 'select') && str_contains($q->sql, '"supply_records"')) { + $queries[] = $q->sql; + } + }); + $first = $this->getJson('/api/stock-returns')->assertOk()->assertJsonPath('pagination.total', 51)->assertJsonPath('pagination.last_page', 3)->assertJsonCount(25, 'rows')->json('rows'); + $capture = false; + $this->assertLessThanOrEqual(4,count($queries)); + $second = $this->getJson('/api/stock-returns?page=2')->assertOk()->assertJsonCount(25,'rows')->json('rows'); + $this->assertEmpty(array_intersect(array_column($first,'id'),array_column($second,'id'))); + $this->assertGreaterThan($second[0]['id'],$first[24]['id']); + $this->getJson('/api/stock-returns?page=3')->assertOk()->assertJsonCount(1,'rows'); + $this->actingAs($this->f['receiver']); + $this->confirm($p)->assertOk(); + $this->getJson('/api/stock-returns?state=prepared')->assertOk()->assertJsonPath('pagination.total',50); + $this->getJson('/api/stock-returns?state=confirmed')->assertOk()->assertJsonPath('pagination.total',1); $this->assertSame(8000,$this->balance()); - file_put_contents((string)getenv('STOCK_RECEIPT_ROOT').'/return-forecast-boundary.json',json_encode(['gross_issue_milli'=>5000,'returned_milli'=>3000,'physical_before_milli'=>5000,'physical_after_milli'=>8000,'historical_mean_unchanged'=>true,'source_hash_changed'=>true,'planning_convention_unchanged'=>true,'net_consumption_forecast_implemented'=>false],JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR)); - } - public function test_history_pages_and_batch_preparer_lookup_cover_the_full_pending_universe():void - { - $p=$this->prepare()->assertOk()->json('id');$row=SupplyRecord::query()->findOrFail($p)->getAttributes();unset($row['id']);for($i=0;$i<50;$i++){$copy=$row;$key=(string)Str::uuid();$copy['record_key']=$key;$copy['operation_key']=$key;$data=json_decode($copy['data'],true,512,JSON_THROW_ON_ERROR);$data['operation_key']=$key;$copy['data']=json_encode($data,JSON_THROW_ON_ERROR);$copy['input_hash']=hash('sha256',$copy['data']);DB::table('supply_records')->insert($copy);} - $queries=[];$capture=true;DB::listen(function($q)use(&$queries,&$capture){if($capture&&str_starts_with(strtolower($q->sql),'select')&&str_contains($q->sql,'"supply_records"'))$queries[]=$q->sql;});$first=$this->getJson('/api/stock-returns')->assertOk()->assertJsonPath('pagination.total',51)->assertJsonPath('pagination.last_page',3)->assertJsonCount(25,'rows')->json('rows');$capture=false;$this->assertLessThanOrEqual(4,count($queries)); - $second=$this->getJson('/api/stock-returns?page=2')->assertOk()->assertJsonCount(25,'rows')->json('rows');$this->assertEmpty(array_intersect(array_column($first,'id'),array_column($second,'id')));$this->assertGreaterThan($second[0]['id'],$first[24]['id']);$this->getJson('/api/stock-returns?page=3')->assertOk()->assertJsonCount(1,'rows'); - $this->actingAs($this->f['receiver']);$this->confirm($p)->assertOk();$this->getJson('/api/stock-returns?state=prepared')->assertOk()->assertJsonPath('pagination.total',50);$this->getJson('/api/stock-returns?state=confirmed')->assertOk()->assertJsonPath('pagination.total',1);$this->assertSame(8000,$this->balance()); - file_put_contents((string)getenv('STOCK_RECEIPT_ROOT').'/return-history-metrics.json',json_encode(['fixture_records'=>51,'page_size'=>25,'supply_record_selects_for_page'=>count($queries),'pages_disjoint'=>true,'state_filters_cover_latest_versions'=>true,'not_a_load_capacity_benchmark'=>true],JSON_PRETTY_PRINT|JSON_THROW_ON_ERROR)); + file_put_contents((string) getenv('STOCK_RECEIPT_ROOT').'/return-history-metrics.json',json_encode(['fixture_records' => 51, 'page_size' => 25, 'supply_record_selects_for_page' => count($queries), 'pages_disjoint' => true, 'state_filters_cover_latest_versions' => true, 'not_a_load_capacity_benchmark' => true],JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR)); } } diff --git a/tests/Pest.php b/tests/Pest.php index c634ac0..d7164ae 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -1,6 +1,7 @@ extend('toBeOne', function () { | */ -function something() +/** + * Root of the sibling SGF checkout (common finance sources), portable across machines. + * Defaults to the folder next to this repository, e.g. C:/laragon/www/sgf-tempo on Laragon. + */ +function sgfTempoPath(string $relative = ''): string { - // .. + $root = getenv('SGF_TEMPO_ROOT') ?: dirname(__DIR__, 2).'/sgf-tempo'; + $path = rtrim(str_replace('\\', '/', $root), '/'); + + return $relative === '' ? $path : $path.'/'.ltrim($relative, '/'); +} + +/** Tests that assert the identity of an isolated PostgreSQL QA database cannot run on SQLite. */ +function skipUnlessIsolatedPostgres(PHPUnit\Framework\TestCase $test): void +{ + if (DB::connection()->getDriverName() !== 'pgsql') { + $test->markTestSkipped('Requires the isolated PostgreSQL QA database (see tests/Concurrency).'); + } } diff --git a/tests/Support/RequisitionLedgerQaRuntime.php b/tests/Support/RequisitionLedgerQaRuntime.php index 0410d22..aa46355 100644 --- a/tests/Support/RequisitionLedgerQaRuntime.php +++ b/tests/Support/RequisitionLedgerQaRuntime.php @@ -13,7 +13,7 @@ function requisitionLedgerQaSource(): ?string if (! is_string($source) || $source === '') { return null; } - if ($source === 'C:/laragon/www/sgf-tempo/packages/general-ledger') { + if ($source === sgfTempoPath('packages/general-ledger')) { if (config('common-finance-bundle.manifest_sha256') === '182e10ceec556e120ecb14b57d17f0132ce0b555041cb054cdf9d17bcc1d51df') { throw new LogicException('A pinned private composition cannot fall back to the canonical development source.'); } diff --git a/tests/Unit/BudgetDistributionPlanTest.php b/tests/Unit/BudgetDistributionPlanTest.php index 79fac69..fe67780 100644 --- a/tests/Unit/BudgetDistributionPlanTest.php +++ b/tests/Unit/BudgetDistributionPlanTest.php @@ -8,7 +8,15 @@ use Tempo\Finance\Budget\BudgetFailure; if (! class_exists(BudgetControl::class)) { require_once (getenv('COMMON_BUDGET_PATH') ?: __DIR__.'/../../packages/budget-control').'/bootstrap.php'; } -require_once 'C:/laragon/www/sgf-tempo/packages/budget-control/src/BudgetDistributionPlan.php'; +$distributionPlanSource = sgfTempoPath('packages/budget-control/src/BudgetDistributionPlan.php'); +if (! class_exists(BudgetDistributionPlan::class) && is_file($distributionPlanSource)) { + require_once $distributionPlanSource; +} +beforeEach(function () { + if (! class_exists(BudgetDistributionPlan::class)) { + $this->markTestSkipped('BudgetDistributionPlan lives in the SGF common source; set SGF_TEMPO_ROOT to run it.'); + } +}); function distributionPlanFixture(): array { From 9f719695e3450676dfeb66ad0d657d747ba8d39b Mon Sep 17 00:00:00 2001 From: Osmane Nala Date: Mon, 30 Nov 2026 23:01:42 +0200 Subject: [PATCH 05/19] CI: incluir testes de frontend e corrigir os existentes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - npm test (vitest) passa a fazer parte de composer ci:check. - Página Clientes associada ao guia de configuração da empresa. - Tipo do componente no teste de dados bancários sem any implícito. Co-Authored-By: Claude Opus 5.5 --- composer.json | 1 + package.json | 3 ++- resources/js/lib/journey-help.ts | 2 ++ tests/frontend/supplier-bank-accounts.test.tsx | 3 ++- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index baa6750..357b2cb 100644 --- a/composer.json +++ b/composer.json @@ -73,6 +73,7 @@ "@runtime:check", "npm run check", "npm run types:check", + "npm test", "@test" ], "types:check": [ diff --git a/package.json b/package.json index b3d05db..3d81a30 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "dev": "vp dev", "check": "vp check", "check:fix": "vp check --fix", - "types:check": "tsc --noEmit" + "types:check": "tsc --noEmit", + "test": "vitest run" }, "dependencies": { "@inertiajs/react": "^3.0.0", diff --git a/resources/js/lib/journey-help.ts b/resources/js/lib/journey-help.ts index 9c73dff..e9e6730 100644 --- a/resources/js/lib/journey-help.ts +++ b/resources/js/lib/journey-help.ts @@ -1078,6 +1078,7 @@ export const journeyHelp: JourneyHelp[] = [ 'company/geography-review', 'company/candidate-portal', 'company/submission-forms', + 'company/clients', ], 'Adaptar cadastros, funções e opções às decisões da empresa.', [ @@ -1085,6 +1086,7 @@ export const journeyHelp: JourneyHelp[] = [ 'Nos dados da empresa, registe a denominação social, NUEL, NUIT, contactos e representante legal. Conserve os zeros iniciais dos identificadores.', 'Adicione cada conta bancária separadamente, com a sua moeda, banco, balcão, titular e identificadores. Distinga o balcão bancário da sucursal da empresa.', 'Nos estabelecimentos, identifique a sede e acrescente as sucursais com os respectivos endereços e contactos. Guarde com o motivo da alteração.', + 'Em Clientes, registe as entidades clientes dos serviços de contratação e das operações comerciais; cada processo conserva a identificação aceite na sua preparação.', 'Defina apenas funções, competências e condições aprovadas.', 'Reveja o efeito das alterações antes de confirmar.', ], diff --git a/tests/frontend/supplier-bank-accounts.test.tsx b/tests/frontend/supplier-bank-accounts.test.tsx index 0a6789e..c526f1f 100644 --- a/tests/frontend/supplier-bank-accounts.test.tsx +++ b/tests/frontend/supplier-bank-accounts.test.tsx @@ -1,5 +1,6 @@ import { App } from '@inertiajs/react'; import type { Page } from '@inertiajs/core'; +import type { ComponentProps } from 'react'; import { renderToString } from 'react-dom/server'; import { expect, test } from 'vitest'; import Bank from '@/pages/suppliers/bank'; @@ -23,7 +24,7 @@ const accounts = [ }, ]; function render( - Component: typeof Bank | typeof Payments, + Component: ComponentProps['initialComponent'], props: Record, ) { const page = { From ec934455e71490fdd40499788edc04f4458018eb Mon Sep 17 00:00:00 2001 From: Osmane Nala Date: Mon, 30 Nov 2026 23:01:42 +0200 Subject: [PATCH 06/19] =?UTF-8?q?Aplicar=20Pint=20e=20formata=C3=A7=C3=A3o?= =?UTF-8?q?=20de=20frontend;=20delimitar=20o=20=C3=A2mbito=20do=20lint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Só formatação automática (pint, vp check --fix), sem alterar comportamento. Excluídos da formatação os registos e artefactos com bytes fixos: docs/, integrations/, storage/, tmp/, output/, resources/data/, tests/Fixtures/, compras-release.json e AGENTS*.md. Scripts operacionais, integrations e auxiliares de teste ficam fora do lint (usam new Function; limpeza na fase 2). Co-Authored-By: Claude Opus 5.5 --- .../Controllers/CommonStockReadController.php | 75 +- .../Controllers/WarehouseReturnController.php | 36 +- app/Models/SupplyRecord.php | 3 +- app/Services/CustomerSales.php | 1 - app/Services/ImportParties.php | 4 +- app/Services/SgfInvoiceDispatches.php | 8 +- app/Services/SgfInvoiceGateway.php | 73 +- app/Services/StockIssueMovement.php | 31 +- app/Services/WarehouseReturnMovement.php | 3 +- app/Services/WarehouseReturns.php | 54 +- config/stock_read.php | 1 + ...0_000001_create_sgf_invoice_dispatches.php | 94 +- pint.json | 2 +- resources/js/pages/company/clients.tsx | 9 +- resources/js/pages/stock/returns.tsx | 568 +++- scripts/agreement-source-http.mjs | 21 +- scripts/alternative-task-integration-http.mjs | 21 +- scripts/approval-routing-check.mjs | 21 +- scripts/approval-search-pilot-http.mjs | 21 +- scripts/approved-attention-http.mjs | 21 +- scripts/audit-metadata-http.mjs | 21 +- scripts/audit-pagination-http.mjs | 24 +- scripts/award-task-integration-http.mjs | 21 +- scripts/benchmark-pilot-http.mjs | 21 +- scripts/budget-distribution-pilot-http.mjs | 31 +- scripts/build-compras-release.mjs | 121 +- .../build-internal-requisition-candidate.php | 6 +- scripts/candidate-geography-http.mjs | 25 +- scripts/candidate-territory-http.mjs | 21 +- scripts/check-compras-release.mjs | 75 +- scripts/check-public-demo-assets.mjs | 65 +- scripts/check-standalone-published-assets.mjs | 116 +- scripts/commercial-pilot-http.mjs | 21 +- scripts/compare-compras-installation.php | 6 +- scripts/coordination-export-http.mjs | 21 +- scripts/coordination-filters-http.mjs | 21 +- .../coordination-task-integration-http.mjs | 21 +- scripts/correction-source-http.mjs | 21 +- scripts/draft-preparation-pilot-http.mjs | 21 +- scripts/equipment-integration-http.mjs | 21 +- scripts/final-review-inventory.mjs | 22 +- scripts/finance-integration-http.mjs | 21 +- scripts/formal-task-integration-http.mjs | 21 +- scripts/geography-installation-http.mjs | 21 +- scripts/geography-review-http.mjs | 21 +- scripts/history-source-http.mjs | 21 +- scripts/history-task-integration-http.mjs | 21 +- scripts/internal-supply-integration-http.mjs | 21 +- scripts/inventory-pagination-http.mjs | 21 +- scripts/inventory-task-integration-http.mjs | 21 +- scripts/lib/native-inertia-client.mjs | 162 +- scripts/lib/sgf-purchasing-home-overlay.mjs | 40 +- scripts/lot-pagination-http.mjs | 21 +- scripts/lot-quality-task-integration-http.mjs | 21 +- scripts/lot-task-integration-http.mjs | 21 +- scripts/menu-code-check.mjs | 39 +- scripts/mfa-foundation-http.mjs | 21 +- scripts/mfa-management-http.mjs | 21 +- scripts/needed-attention-http.mjs | 21 +- scripts/notice-consultation-http.mjs | 21 +- scripts/operational-geography-http.mjs | 21 +- scripts/order-cancellation-http.mjs | 16 +- .../organization-activation-preview-http.mjs | 21 +- scripts/payable-history-pg.php | 8 +- scripts/payable-insights-pilot-http.mjs | 21 +- scripts/people-dossier-http.mjs | 21 +- scripts/people-reports-check.mjs | 19 +- scripts/pilot-access-activation-http.mjs | 31 +- scripts/pilot-approval-activation-http.mjs | 21 +- scripts/pilot-evaluation-activation-http.mjs | 21 +- scripts/pilot-export-http.mjs | 21 +- scripts/pilot-market-activation-http.mjs | 26 +- .../pilot-replenishment-activation-http.mjs | 29 +- scripts/pilot-submission-activation-http.mjs | 21 +- scripts/policy-source-http.mjs | 21 +- scripts/prepare-audit-access-pilot.php | 2 +- scripts/prepare-sgf-operational.php | 2 +- scripts/preview-production-candidate.mjs | 142 +- scripts/quotation-task-integration-http.mjs | 21 +- scripts/receipt-block-installation-http.mjs | 21 +- scripts/receipt-print-http.mjs | 21 +- scripts/received-availability-http.mjs | 21 +- scripts/repair-synthetic-profile-labels.php | 1 + scripts/replenishment-health-http.mjs | 21 +- scripts/replenishment-pilot-http.mjs | 21 +- scripts/requisition-audit-http.mjs | 21 +- scripts/requisition-ledger-qa-check.mjs | 2311 ++++++++++++++--- .../requisition-ledger-runtime-artifact.mjs | 84 +- scripts/requisition-native-http-check.mjs | 433 ++- scripts/requisition-office-http-check.mjs | 859 ++++-- scripts/reservation-source-http.mjs | 21 +- scripts/search-expansion-http.mjs | 21 +- scripts/sgf-admin-ui-build.mjs | 171 +- scripts/sgf-corrected-proof.php | 2 +- scripts/sgf-demo-8039-http.mjs | 406 ++- scripts/sgf-demo-8039.php | 190 +- scripts/sgf-read-8039-http.mjs | 253 +- scripts/sgf-read-8039.php | 154 +- scripts/sgf-read-candidate.php | 63 +- scripts/sgf-sourcing-candidate.php | 81 +- scripts/sgf-sourcing-core-proof.php | 99 +- scripts/sgf-sourcing-demo-http.mjs | 217 +- scripts/sgf-sourcing-demo.php | 215 +- scripts/sgf-sourcing-install.php | 82 +- scripts/sgf-sourcing-isolated.mjs | 500 +++- scripts/standalone-configuration-race.mjs | 142 +- scripts/standalone-finance-preview.mjs | 147 +- scripts/standalone-inventory-preview.mjs | 187 +- scripts/suggestion-task-integration-http.mjs | 21 +- ...lier-improvement-task-integration-http.mjs | 21 +- ...supplier-quality-task-integration-http.mjs | 21 +- scripts/supplier-task-integration-http.mjs | 21 +- scripts/supply-line-source-http.mjs | 21 +- scripts/supply-navigation-check.mjs | 18 +- scripts/supply-pagination-http.mjs | 21 +- scripts/supply-task-integration-http.mjs | 21 +- scripts/task-deadlines-http.mjs | 21 +- scripts/upgrade-client-registry.php | 3 +- scripts/warehouse-delivery-print-http.mjs | 21 +- scripts/warehouse-exchange-http.mjs | 21 +- scripts/warehouse-http-source-http.mjs | 29 +- scripts/warehouse-pilot-readiness-http.mjs | 21 +- scripts/warehouse-task-pilot-status-http.mjs | 21 +- scripts/warehouse-workdesk-http.mjs | 21 +- scripts/workflow-task-inbox-http.mjs | 21 +- tests/Concurrency/run-common-budget.php | 105 +- tests/Concurrency/warehouse-worker.php | 2 +- .../StandaloneBusinessCompositionTest.php | 19 +- tests/Feature/WarehousePilotJourneyTest.php | 2 +- .../Integration/SgfInvoiceDispatchesTest.php | 491 ++-- tests/Support/ReceiptFixture.php | 4 +- tests/Support/common-receipt-worker.php | 55 +- tests/Support/financial-preparation.test.mjs | 114 +- tests/Support/native-inertia-client.test.mjs | 31 +- tests/Support/native-payable-page-worker.php | 41 +- tests/Support/sgf-admin-candidate-checks.php | 92 +- tests/Support/sgf-corrected-proof.php | 2 +- tests/Support/sgf-corrected-update.php | 8 +- tests/Support/sgf-sourcing-controls.php | 48 +- tests/Support/sgf-sourcing-copy.php | 172 +- tests/Support/sgf-sourcing-http.mjs | 382 ++- tests/Support/sgf-sourcing-worker.php | 39 +- tests/Support/sgf-update-fixture.php | 16 +- tests/Support/warehouse-return-worker.php | 56 +- tests/Unit/WarehouseHttpSourceTest.php | 1 - tests/scripts/compras-release-check.mjs | 176 +- .../sgf-purchasing-home-overlay.test.mjs | 38 +- vite.config.ts | 14 + 148 files changed, 9455 insertions(+), 2413 deletions(-) diff --git a/app/Http/Controllers/CommonStockReadController.php b/app/Http/Controllers/CommonStockReadController.php index 7f6287e..ef3c73d 100644 --- a/app/Http/Controllers/CommonStockReadController.php +++ b/app/Http/Controllers/CommonStockReadController.php @@ -5,49 +5,60 @@ namespace App\Http\Controllers; use App\Enums\PurchasingRole; use App\Models\User; use App\Services\OrganizationAccess; -use Illuminate\Http\Request; +use Illuminate\Database\QueryException; use Illuminate\Http\JsonResponse; +use Illuminate\Http\Request; use Illuminate\Support\Facades\DB; +use Tempo\Inventory\InventoryReadSession; final class CommonStockReadController extends Controller { public function index(Request $request): JsonResponse { // Native authority, reloaded on every request; no SGF grants or identity assumptions. - $user=User::query()->findOrFail($this->staffIdentity($request)->id); - abort_unless($user->tenant_id!==null && $user->hasFunctions([PurchasingRole::Admin,PurchasingRole::Warehouse,PurchasingRole::Procurement,PurchasingRole::Finance]) - && !app(OrganizationAccess::class)->maintenanceOnly($user),403); - $d=$request->validate(['view'=>'sometimes|in:items,warehouses,balances,movements','search'=>'nullable|string|max:100', - 'warehouse_id'=>'sometimes|integer|min:1','page'=>'sometimes|integer|min:1|max:100000','per_page'=>'sometimes|integer|min:1|max:100','snapshot'=>'sometimes|string|max:8192']); - abort_if(array_diff(array_keys($request->query()),array_keys($d))!==[],422); - $filters=['view'=>$d['view']??'balances','search'=>$d['search']??'','warehouse_id'=>isset($d['warehouse_id'])?(int)$d['warehouse_id']:null, - 'page'=>(int)($d['page']??1),'per_page'=>(int)($d['per_page']??25)]; - $binding=config('stock_read.synthetic_sources.'.$user->tenant_id.':'.$user->id); - if(!$binding)return response()->json(['status'=>'unavailable','message'=>'Fonte autorizada de stock ainda não ligada a este contexto.'],503)->header('Cache-Control','no-store'); - abort_unless(app()->environment('testing')&&DB::connection()->getDriverName()==='pgsql',403); - $identity=DB::selectOne("SELECT current_database() AS name,current_user AS role,inet_server_port() AS port,current_setting('cluster_name') AS cluster"); - abort_unless(preg_match('/^stock_read_compras_([a-f0-9]{12})$/D',$identity->name,$m) - && $identity->role==='stock_read_qa_'.$m[1] && (int)$identity->port===55439 - && preg_match('/^[a-f0-9]{12}$/D',(string)config('stock_read.qa_run')) - && $identity->cluster==='sgf_modular_regression_'.config('stock_read.qa_run'),403); - abort_unless(preg_match('/^sgf_stock_read_[a-f0-9]{12}$/D',$binding['schema']??'')&&($binding['append_only']??false)===true - && ($binding['source_tenant_id']??null)===(int)$user->tenant_id,503,'Fonte de stock incompatível.'); - if($filters['warehouse_id']!==null)abort_unless(in_array($filters['warehouse_id'],$binding['warehouse_ids'],true),403); - $root=base_path('packages/inventory-read/releases/0.1.0'); - $bytes=is_file($root.'/manifest.json')?file_get_contents($root.'/manifest.json'):false; - abort_unless(is_string($bytes)&&hash_equals(config('stock_read.package_manifest_sha256'),hash('sha256',$bytes)),503,'Pacote de consulta incompatível.'); - $manifest=json_decode($bytes,true,512,JSON_THROW_ON_ERROR); - foreach(['bootstrap.php','src/InventoryReader.php','src/InventoryReadSession.php'] as $file) { - $actual=is_file($root.'/'.$file)?hash_file('sha256',$root.'/'.$file):false; - abort_unless(is_string($actual)&&isset($manifest['files'][$file])&&hash_equals($manifest['files'][$file],$actual),503,'Pacote de consulta incompatível.'); + $user = User::query()->findOrFail($this->staffIdentity($request)->id); + abort_unless($user->tenant_id !== null && $user->hasFunctions([PurchasingRole::Admin, PurchasingRole::Warehouse, PurchasingRole::Procurement, PurchasingRole::Finance]) + && ! app(OrganizationAccess::class)->maintenanceOnly($user), 403); + $d = $request->validate(['view' => 'sometimes|in:items,warehouses,balances,movements', 'search' => 'nullable|string|max:100', + 'warehouse_id' => 'sometimes|integer|min:1', 'page' => 'sometimes|integer|min:1|max:100000', 'per_page' => 'sometimes|integer|min:1|max:100', 'snapshot' => 'sometimes|string|max:8192']); + abort_if(array_diff(array_keys($request->query()), array_keys($d)) !== [], 422); + $filters = ['view' => $d['view'] ?? 'balances', 'search' => $d['search'] ?? '', 'warehouse_id' => isset($d['warehouse_id']) ? (int) $d['warehouse_id'] : null, + 'page' => (int) ($d['page'] ?? 1), 'per_page' => (int) ($d['per_page'] ?? 25)]; + $binding = config('stock_read.synthetic_sources.'.$user->tenant_id.':'.$user->id); + if (! $binding) { + return response()->json(['status' => 'unavailable', 'message' => 'Fonte autorizada de stock ainda não ligada a este contexto.'], 503)->header('Cache-Control', 'no-store'); + } + abort_unless(app()->environment('testing') && DB::connection()->getDriverName() === 'pgsql', 403); + $identity = DB::selectOne("SELECT current_database() AS name,current_user AS role,inet_server_port() AS port,current_setting('cluster_name') AS cluster"); + abort_unless(preg_match('/^stock_read_compras_([a-f0-9]{12})$/D', $identity->name, $m) + && $identity->role === 'stock_read_qa_'.$m[1] && (int) $identity->port === 55439 + && preg_match('/^[a-f0-9]{12}$/D', (string) config('stock_read.qa_run')) + && $identity->cluster === 'sgf_modular_regression_'.config('stock_read.qa_run'), 403); + abort_unless(preg_match('/^sgf_stock_read_[a-f0-9]{12}$/D', $binding['schema'] ?? '') && ($binding['append_only'] ?? false) === true + && ($binding['source_tenant_id'] ?? null) === (int) $user->tenant_id, 503, 'Fonte de stock incompatível.'); + if ($filters['warehouse_id'] !== null) { + abort_unless(in_array($filters['warehouse_id'], $binding['warehouse_ids'], true), 403); + } + $root = base_path('packages/inventory-read/releases/0.1.0'); + $bytes = is_file($root.'/manifest.json') ? file_get_contents($root.'/manifest.json') : false; + abort_unless(is_string($bytes) && hash_equals(config('stock_read.package_manifest_sha256'), hash('sha256', $bytes)), 503, 'Pacote de consulta incompatível.'); + $manifest = json_decode($bytes, true, 512, JSON_THROW_ON_ERROR); + foreach (['bootstrap.php', 'src/InventoryReader.php', 'src/InventoryReadSession.php'] as $file) { + $actual = is_file($root.'/'.$file) ? hash_file('sha256', $root.'/'.$file) : false; + abort_unless(is_string($actual) && isset($manifest['files'][$file]) && hash_equals($manifest['files'][$file], $actual), 503, 'Pacote de consulta incompatível.'); } require_once $root.'/bootstrap.php'; - $fingerprint=hash('sha256',json_encode(['compras',$user->tenant_id,$user->id,$request->session()->get('work_context'),$binding,array_diff_key($filters,['page'=>true])],JSON_THROW_ON_ERROR)); - try { $result=(new \Tempo\Inventory\InventoryReadSession(DB::connection()))->read($binding,$fingerprint,$filters,$d['snapshot']??null); } - catch(\Illuminate\Database\QueryException $e){ - if(!in_array($e->errorInfo[0]??null,['42P01','42703','42883','57014'],true))throw $e; - return response()->json(['status'=>'unavailable','message'=>'A fonte de stock está indisponível ou incompatível. Actualize a consulta mais tarde.'],503)->header('Cache-Control','no-store'); + $fingerprint = hash('sha256', json_encode(['compras', $user->tenant_id, $user->id, $request->session()->get('work_context'), $binding, array_diff_key($filters, ['page' => true])], JSON_THROW_ON_ERROR)); + try { + $result = (new InventoryReadSession(DB::connection()))->read($binding, $fingerprint, $filters, $d['snapshot'] ?? null); + } catch (QueryException $e) { + if (! in_array($e->errorInfo[0] ?? null, ['42P01', '42703', '42883', '57014'], true)) { + throw $e; + } + + return response()->json(['status' => 'unavailable', 'message' => 'A fonte de stock está indisponível ou incompatível. Actualize a consulta mais tarde.'], 503)->header('Cache-Control','no-store'); } + return response()->json($result)->header('Cache-Control','no-store'); } } diff --git a/app/Http/Controllers/WarehouseReturnController.php b/app/Http/Controllers/WarehouseReturnController.php index 94263e0..8a58ce9 100644 --- a/app/Http/Controllers/WarehouseReturnController.php +++ b/app/Http/Controllers/WarehouseReturnController.php @@ -43,14 +43,21 @@ final class WarehouseReturnController extends Controller } /** @param callable():array $run */ - private function response(callable $run,bool $readOnly=false): JsonResponse + private function response(callable $run, bool $readOnly = false): JsonResponse { try { - $result=$readOnly?DB::transaction(function()use($run){if(DB::getDriverName()==='pgsql'&&DB::transactionLevel()===1)DB::statement('SET TRANSACTION ISOLATION LEVEL REPEATABLE READ READ ONLY');return $run();}):$run(); + $result = $readOnly ? DB::transaction(function () use ($run) { + if (DB::getDriverName() === 'pgsql' && DB::transactionLevel() === 1) { + DB::statement('SET TRANSACTION ISOLATION LEVEL REPEATABLE READ READ ONLY'); + } + +return $run(); + }) : $run(); + return response()->json($result)->header('Cache-Control', 'no-store'); } catch (QueryException $e) { if (($e->errorInfo[0] ?? null) === '55P03') { - return response()->json(['code'=>'warehouse_return_busy','message' => 'Devolução ocupada. Aguarde e repita manualmente a conferência.'], 423)->header('Cache-Control', 'no-store'); + return response()->json(['code' => 'warehouse_return_busy', 'message' => 'Devolução ocupada. Aguarde e repita manualmente a conferência.'], 423)->header('Cache-Control', 'no-store'); } throw $e; } @@ -83,12 +90,25 @@ final class WarehouseReturnController extends Controller $d['version'] = (int) $d['version']; $d['received_in_warehouse'] = true; - return $this->response(fn () => $flow->confirm($this->actor($r),$id,$d)); + return $this->response(fn () => $flow->confirm($this->actor($r), $id, $d)); } - public function withdraw(Request $r,int $id,WarehouseReturns $flow): JsonResponse {return $this->close($r,$id,$flow,'withdrawn');} - public function reject(Request $r,int $id,WarehouseReturns $flow): JsonResponse {return $this->close($r,$id,$flow,'rejected');} - private function close(Request $r,int $id,WarehouseReturns $flow,string $state): JsonResponse + + public function withdraw(Request $r, int $id, WarehouseReturns $flow): JsonResponse { - $d=$r->validate(['version'=>'required|integer|min:1','reason'=>'required|string|min:10|max:1000']);abort_if(array_diff(array_keys($r->all()),array_keys($d))!==[],422);$d['version']=(int)$d['version'];return $this->response(fn()=>$flow->close($this->actor($r),$id,$d,$state)); + return $this->close($r, $id, $flow, 'withdrawn'); + } + + public function reject(Request $r, int $id, WarehouseReturns $flow): JsonResponse + { + return $this->close($r, $id, $flow, 'rejected'); + } + + private function close(Request $r, int $id, WarehouseReturns $flow, string $state): JsonResponse + { + $d = $r->validate(['version' => 'required|integer|min:1', 'reason' => 'required|string|min:10|max:1000']); + abort_if(array_diff(array_keys($r->all()), array_keys($d)) !== [], 422); + $d['version'] = (int) $d['version']; + + return $this->response(fn () => $flow->close($this->actor($r), $id, $d, $state)); } } diff --git a/app/Models/SupplyRecord.php b/app/Models/SupplyRecord.php index d4dec94..cabe483 100644 --- a/app/Models/SupplyRecord.php +++ b/app/Models/SupplyRecord.php @@ -4,13 +4,14 @@ namespace App\Models; use App\Models\Concerns\BelongsToTenant; use Illuminate\Database\Eloquent\Model; +use Illuminate\Support\Carbon; /** * @property array $data * @property array $snapshot * @property int $version * @property string $record_key - * @property \Illuminate\Support\Carbon $created_at + * @property Carbon $created_at */ class SupplyRecord extends Model { diff --git a/app/Services/CustomerSales.php b/app/Services/CustomerSales.php index 5469241..e101c59 100644 --- a/app/Services/CustomerSales.php +++ b/app/Services/CustomerSales.php @@ -13,7 +13,6 @@ use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Validator; use Tempo\Finance\GeneralLedger\LedgerSchema; use Tempo\Finance\GeneralLedger\Receivables; -use Tempo\Finance\GeneralLedger\ReceivablesSchema; /** Native actor/catalogue adapter. All customer financial writes belong to the common core. */ final class CustomerSales diff --git a/app/Services/ImportParties.php b/app/Services/ImportParties.php index ea0057b..0673d6d 100644 --- a/app/Services/ImportParties.php +++ b/app/Services/ImportParties.php @@ -42,8 +42,8 @@ final class ImportParties 'issues' => $this->issues($actor, $order, $record)]); $suppliers = Supplier::query()->when(! $canSelect, fn ($q) => $q->whereRaw('1=0'))->where('status', 'active')->where('blocked', false) ->where('next_review', '>=', today())->when($search !== '', fn ($q) => $q->where(fn ($match) => $match - ->whereRaw('LOWER(name) LIKE ?', ['%'.addcslashes(mb_strtolower($search), '%_\\').'%']) - ->orWhereRaw('LOWER(nuit) LIKE ?', ['%'.addcslashes(mb_strtolower($search), '%_\\').'%']))) + ->whereRaw('LOWER(name) LIKE ?', ['%'.addcslashes(mb_strtolower($search), '%_\\').'%']) + ->orWhereRaw('LOWER(nuit) LIKE ?', ['%'.addcslashes(mb_strtolower($search), '%_\\').'%']))) ->orderBy('name')->orderBy('id')->paginate(20, ['id', 'name', 'nuit', 'version'], 'party_suppliers_page')->withQueryString(); $instructions = app(SupplyPlanning::class)->latest('import_document')->where('purchase_order_id', $order->id) ->where('snapshot->import_key', $current->record_key)->where('data->type', 'written_instructions') diff --git a/app/Services/SgfInvoiceDispatches.php b/app/Services/SgfInvoiceDispatches.php index ccfd783..6b2756c 100644 --- a/app/Services/SgfInvoiceDispatches.php +++ b/app/Services/SgfInvoiceDispatches.php @@ -288,7 +288,7 @@ final class SgfInvoiceDispatches $state = $this->state($row); $out = $this->summary($row); - return array_replace($out,['connection_id' => $row->connection_id, 'mapping_id' => $row->mapping_id, 'document' => json_decode($row->document,true), 'reason' => $row->reason, + return array_replace($out, ['connection_id' => $row->connection_id, 'mapping_id' => $row->mapping_id, 'document' => json_decode($row->document, true), 'reason' => $row->reason, 'impact' => $state['impact'] ?? null, 'approval_hash' => $row->phase === 'previewed' ? ($state['approval_hash'] ?? null) : null, 'lease_until' => $row->lease_until]); } @@ -299,14 +299,14 @@ final class SgfInvoiceDispatches if (! is_array($x)) { return $x; }if (! array_is_list($x)) { - ksort($x,SORT_STRING); + ksort($x, SORT_STRING); }foreach ($x as &$item) { $item = $normalise($item); } -return $x; + return $x; }; - return hash('sha256',json_encode($normalise($v),JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)); + return hash('sha256', json_encode($normalise($v), JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES)); } } diff --git a/app/Services/SgfInvoiceGateway.php b/app/Services/SgfInvoiceGateway.php index 1eb85e9..6c5a4ad 100644 --- a/app/Services/SgfInvoiceGateway.php +++ b/app/Services/SgfInvoiceGateway.php @@ -5,39 +5,56 @@ namespace App\Services; use App\Models\User; use Illuminate\Support\Facades\Http; use LogicException; +use Tempo\SgcInvoiceClient\InvoiceClient; /** Prepared gateway only; no event listener, route, scheduled job or automatic transmission. */ final class SgfInvoiceGateway { - public function clientFor(User $actor,string $connection): \Tempo\SgcInvoiceClient\InvoiceClient + public function clientFor(User $actor, string $connection): InvoiceClient { - if(config('sgf_invoice.enabled')!==true)throw new LogicException('SGF invoice gateway disabled.'); - $all=config('sgf_invoice.connections',[]);$c=$all[$connection]??null; - abort_unless(is_array($c)&&($c['enabled']??false)===true&&auth()->id()===$actor->id,403); - $current=User::where('tenant_id',$actor->tenant_id)->findOrFail($actor->id); - abort_unless(($c['source_scope']['tenant_id']??null)===$current->tenant_id&&$current->hasFunctions(['finance']) - &&!app(OrganizationAccess::class)->maintenanceOnly($current),403); - $path=config('sgf_invoice.client_package');$pin=config('sgf_invoice.client_package_sha256'); - $actual=is_string($path)&&is_file($path)?hash_file('sha256',$path):false; - if(!is_string($path)||is_link($path)||!is_file($path)||!is_string($pin)||!preg_match('/^[a-f0-9]{64}$/D',$pin) - ||!is_string($actual)||!hash_equals($pin,$actual))throw new LogicException('Verified client package required.'); - if(class_exists(\Tempo\SgcInvoiceClient\InvoiceClient::class,false)){ - $loaded=(new \ReflectionClass(\Tempo\SgcInvoiceClient\InvoiceClient::class))->getFileName(); - $loadedHash=is_string($loaded)&&is_file($loaded)?hash_file('sha256',$loaded):false; - if(!is_string($loadedHash)||!hash_equals($pin,$loadedHash))throw new LogicException('Client version changed; restart separately.'); - }else require_once $path; - $configurationHash=hash('sha256',json_encode($c,JSON_THROW_ON_ERROR)); - return new \Tempo\SgcInvoiceClient\InvoiceClient($c['client_id'],$c['token'],$c['context_version'],$c['source_scope'],$c['target_scope'], - function(string $method,string $url,array $headers,?array $body)use($actor,$connection,$configurationHash):array{ + if (config('sgf_invoice.enabled') !== true) { + throw new LogicException('SGF invoice gateway disabled.'); + } + $all = config('sgf_invoice.connections', []); + $c = $all[$connection] ?? null; + abort_unless(is_array($c) && ($c['enabled'] ?? false) === true && auth()->id() === $actor->id, 403); + $current = User::where('tenant_id', $actor->tenant_id)->findOrFail($actor->id); + abort_unless(($c['source_scope']['tenant_id'] ?? null) === $current->tenant_id && $current->hasFunctions(['finance']) + && ! app(OrganizationAccess::class)->maintenanceOnly($current), 403); + $path = config('sgf_invoice.client_package'); + $pin = config('sgf_invoice.client_package_sha256'); + $actual = is_string($path) && is_file($path) ? hash_file('sha256', $path) : false; + if (! is_string($path) || is_link($path) || ! is_file($path) || ! is_string($pin) || ! preg_match('/^[a-f0-9]{64}$/D', $pin) + || ! is_string($actual) || ! hash_equals($pin, $actual)) { + throw new LogicException('Verified client package required.'); + } + if (class_exists(InvoiceClient::class, false)) { + $loaded = (new \ReflectionClass(InvoiceClient::class))->getFileName(); + $loadedHash = is_string($loaded) && is_file($loaded) ? hash_file('sha256', $loaded) : false; + if (! is_string($loadedHash) || ! hash_equals($pin, $loadedHash)) { + throw new LogicException('Client version changed; restart separately.'); + } + } else { + require_once $path; + } + $configurationHash = hash('sha256', json_encode($c, JSON_THROW_ON_ERROR)); + + return new InvoiceClient($c['client_id'], $c['token'], $c['context_version'], $c['source_scope'], $c['target_scope'], + function (string $method, string $url, array $headers, ?array $body) use ($actor, $connection, $configurationHash): array { // Recheck the originating person's authority immediately before every network operation. - $now=config('sgf_invoice.connections',[])[$connection]??null; - if(config('sgf_invoice.enabled')!==true||!is_array($now)||!hash_equals($configurationHash,hash('sha256',json_encode($now,JSON_THROW_ON_ERROR))) - ||auth()->id()!==$actor->id)return ['status'=>403,'json'=>null]; - $current=User::where('tenant_id',$actor->tenant_id)->find($actor->id); - if(!$current||!$current->hasFunctions(['finance'])||app(OrganizationAccess::class)->maintenanceOnly($current))return ['status'=>403,'json'=>null]; - $http=Http::withHeaders($headers)->acceptJson()->asJson()->withoutRedirecting()->connectTimeout(3)->timeout(15); - $response=$method==='GET'?$http->get($url):$http->post($url,$body); - return ['status'=>$response->status(),'json'=>$response->json()]; - },$c['origin']); + $now = config('sgf_invoice.connections', [])[$connection] ?? null; + if (config('sgf_invoice.enabled') !== true || ! is_array($now) || ! hash_equals($configurationHash, hash('sha256', json_encode($now, JSON_THROW_ON_ERROR))) + || auth()->id() !== $actor->id) { + return ['status' => 403, 'json' => null]; + } + $current = User::where('tenant_id', $actor->tenant_id)->find($actor->id); + if (! $current || ! $current->hasFunctions(['finance']) || app(OrganizationAccess::class)->maintenanceOnly($current)) { + return ['status' => 403, 'json' => null]; + } + $http = Http::withHeaders($headers)->acceptJson()->asJson()->withoutRedirecting()->connectTimeout(3)->timeout(15); + $response = $method === 'GET' ? $http->get($url) : $http->post($url, $body); + + return ['status' => $response->status(), 'json' => $response->json()]; + }, $c['origin']); } } diff --git a/app/Services/StockIssueMovement.php b/app/Services/StockIssueMovement.php index 99982b5..7ee5a14 100644 --- a/app/Services/StockIssueMovement.php +++ b/app/Services/StockIssueMovement.php @@ -1,24 +1,35 @@ getDriverName()){'pgsql'=>'public','sqlite'=>'main','mysql','mariadb'=>DB::connection()->getDatabaseName(),default=>throw new \LogicException('Driver não suportado.')}; - return new \Tempo\Inventory\IssueMovementWriter(DB::connection(),$schema,(int)$actor->tenant_id,(int)$actor->id,function()use($actor){app(CurrentActor::class)->lock($actor,[PurchasingRole::Warehouse]);}); + $schema = match (DB::connection()->getDriverName()) { + 'pgsql' => 'public','sqlite' => 'main','mysql','mariadb' => DB::connection()->getDatabaseName(),default => throw new \LogicException('Driver não suportado.') + }; + + return new IssueMovementWriter(DB::connection(), $schema, (int) $actor->tenant_id, (int) $actor->id, function () use ($actor) { + app(CurrentActor::class)->lock($actor, [PurchasingRole::Warehouse]); + }); } } diff --git a/app/Services/WarehouseReturnMovement.php b/app/Services/WarehouseReturnMovement.php index 2bbc4ba..b2f8398 100644 --- a/app/Services/WarehouseReturnMovement.php +++ b/app/Services/WarehouseReturnMovement.php @@ -8,7 +8,8 @@ use Tempo\Inventory\DeliveryReturnWriter; final class WarehouseReturnMovement { - public const MANIFEST_SHA256='2850a4f5cb678acfe3a9dbc7a7d62eb233bc72722ad0de374681c2679c90557c'; + public const MANIFEST_SHA256 = '2850a4f5cb678acfe3a9dbc7a7d62eb233bc72722ad0de374681c2679c90557c'; + private function fileHash(string $file): string { $hash = is_file($file) ? hash_file('sha256', $file) : false; diff --git a/app/Services/WarehouseReturns.php b/app/Services/WarehouseReturns.php index 90842f7..9cf9ea6 100644 --- a/app/Services/WarehouseReturns.php +++ b/app/Services/WarehouseReturns.php @@ -46,9 +46,9 @@ final class WarehouseReturns private function lock(User $actor, string $action): User { - $timeout=config('stock_returns.lock_timeout_ms',2000); - abort_unless(is_int($timeout)&&$timeout>=100&&$timeout<=10000,503,'Tempo de espera de conferência inválido.'); - DB::select("SELECT set_config('lock_timeout',?,true)",[$timeout.'ms']); + $timeout = config('stock_returns.lock_timeout_ms', 2000); + abort_unless(is_int($timeout) && $timeout >= 100 && $timeout <= 10000, 503, 'Tempo de espera de conferência inválido.'); + DB::select("SELECT set_config('lock_timeout',?,true)", [$timeout.'ms']); app(ConflictGuard::class)->lockCompany($actor); $fresh = app(CurrentActor::class)->lock($actor); @@ -111,7 +111,7 @@ final class WarehouseReturns } } -return null; + return null; } /** @@ -172,15 +172,16 @@ return null; abort_unless($old->created_by === $actor->id && hash_equals($old->input_hash, $hash), 409, 'Chave utilizada com outros dados.'); $this->request($old->snapshot['source']['request_id']); - $state=SupplyRecord::query()->where('kind','warehouse_return')->where('record_key',$old->record_key)->orderByDesc('version')->value('state'); - return ['id' => $old->id, 'state'=>$state, 'impact' => $this->impact($old->snapshot['source']), 'replayed' => true]; + $state = SupplyRecord::query()->where('kind', 'warehouse_return')->where('record_key', $old->record_key)->orderByDesc('version')->value('state'); + + return ['id' => $old->id, 'state' => $state, 'impact' => $this->impact($old->snapshot['source']), 'replayed' => true]; } $source = $this->source($actor, $d); abort_unless($source['requester_id'] === $actor->id, 403, 'A declaração de excedente pertence ao destinatário original.'); $record = SupplyRecord::query()->create(['tenant_id' => $actor->tenant_id, 'kind' => 'warehouse_return', 'record_key' => $d['operation_key'], 'version' => 1, 'state' => 'prepared', 'stock_item_id' => $source['item']['id'], 'warehouse_id' => $source['warehouse']['id'], 'created_by' => $actor->id, 'data' => $d, 'snapshot' => ['source' => $source, 'source_hash' => $this->hash($source), 'declared_unused' => true], 'reason' => $d['reason'], 'operation_key' => $d['operation_key'], 'input_hash' => $hash, 'created_at' => now()]); app(RequisitionWorkflow::class)->audit($actor, 'warehouse_return.prepared', null, null, ['record_id' => $record->id, 'request_id' => $source['request_id'], 'impact' => $this->impact($source), 'declared_unused' => true]); - return ['id' => $record->id, 'state'=>'prepared', 'impact' => $this->impact($source), 'replayed' => false]; + return ['id' => $record->id, 'state' => 'prepared', 'impact' => $this->impact($source), 'replayed' => false]; }); } @@ -199,7 +200,8 @@ return null; abort_if($p->created_by === $actor->id, 403, 'Recepção deve ser independente da declaração.'); $done = SupplyRecord::query()->where('kind', 'warehouse_return')->where('record_key', $p->record_key)->where('version', 2)->first(); if ($done) { - abort_unless($done->state==='confirmed',409,'Proposta encerrada sem movimento. Prepare uma nova proposta se necessário.'); + abort_unless($done->state === 'confirmed', 409, 'Proposta encerrada sem movimento. Prepare uma nova proposta se necessário.'); + return ['id' => $done->id, 'movement_id' => $done->data['movement_id'], 'replayed' => true]; } abort_unless($d['version'] === 1 && $d['received_in_warehouse'] === true, 422, 'Confirme a recepção física da versão conferida.'); @@ -218,22 +220,32 @@ return null; } /** - * @param array $d + * @param array $d * @return array */ - public function close(User $actor,int $id,array $d,string $state): array + public function close(User $actor, int $id, array $d, string $state): array { - abort_unless(in_array($state,['withdrawn','rejected'],true),422); - $action=$state==='withdrawn'?'prepare':'confirm';$this->authorize($actor,$action); - return DB::transaction(function()use($actor,$id,$d,$state,$action){ - $actor=$this->lock($actor,$action);$p=SupplyRecord::query()->where('kind','warehouse_return')->where('version',1)->lockForUpdate()->findOrFail($id);$this->request($p->snapshot['source']['request_id']); - abort_unless($state==='withdrawn'?$p->created_by===$actor->id:$p->created_by!==$actor->id,403,'Retirada pertence ao preparador; recusa exige conferência independente.'); - $done=SupplyRecord::query()->where('kind','warehouse_return')->where('record_key',$p->record_key)->where('version',2)->first(); - if($done){abort_unless($done->state===$state,409,'A proposta já tem outra decisão terminal.');return ['id'=>$done->id,'state'=>$done->state,'replayed'=>true];} - abort_unless($d['version']===1,409,'Versão de proposta desactualizada.');$book=app(StockWorkflow::class)->balance($p->stock_item_id,$p->warehouse_id); - $closed=SupplyRecord::query()->create(['tenant_id'=>$actor->tenant_id,'kind'=>'warehouse_return','record_key'=>$p->record_key,'version'=>2,'state'=>$state,'stock_item_id'=>$p->stock_item_id,'warehouse_id'=>$p->warehouse_id,'created_by'=>$actor->id,'data'=>['prepared_id'=>$p->id,'action'=>$state,'reason'=>$d['reason']],'snapshot'=>['source'=>$p->snapshot['source'],'before'=>$book['quantity'],'after'=>$book['quantity'],'preparer_id'=>$p->created_by],'reason'=>$d['reason'],'operation_key'=>(string)Str::uuid(),'input_hash'=>$this->hash($d+['action'=>$state]),'created_at'=>now()]); - app(RequisitionWorkflow::class)->audit($actor,'warehouse_return.'.$state,null,null,['record_id'=>$closed->id,'declaration_id'=>$p->id,'reason'=>$d['reason'],'before'=>$book['quantity'],'after'=>$book['quantity'],'physical_effect'=>0]); - return ['id'=>$closed->id,'state'=>$state,'replayed'=>false]; + abort_unless(in_array($state, ['withdrawn', 'rejected'], true), 422); + $action = $state === 'withdrawn' ? 'prepare' : 'confirm'; + $this->authorize($actor, $action); + + return DB::transaction(function () use ($actor, $id, $d, $state, $action) { + $actor = $this->lock($actor, $action); + $p = SupplyRecord::query()->where('kind', 'warehouse_return')->where('version', 1)->lockForUpdate()->findOrFail($id); + $this->request($p->snapshot['source']['request_id']); + abort_unless($state === 'withdrawn' ? $p->created_by === $actor->id : $p->created_by !== $actor->id, 403, 'Retirada pertence ao preparador; recusa exige conferência independente.'); + $done = SupplyRecord::query()->where('kind', 'warehouse_return')->where('record_key', $p->record_key)->where('version', 2)->first(); + if ($done) { + abort_unless($done->state === $state, 409, 'A proposta já tem outra decisão terminal.'); + + return ['id' => $done->id, 'state' => $done->state, 'replayed' => true]; + } + abort_unless($d['version'] === 1, 409, 'Versão de proposta desactualizada.'); + $book = app(StockWorkflow::class)->balance($p->stock_item_id, $p->warehouse_id); + $closed = SupplyRecord::query()->create(['tenant_id' => $actor->tenant_id, 'kind' => 'warehouse_return', 'record_key' => $p->record_key, 'version' => 2, 'state' => $state, 'stock_item_id' => $p->stock_item_id, 'warehouse_id' => $p->warehouse_id, 'created_by' => $actor->id, 'data' => ['prepared_id' => $p->id, 'action' => $state, 'reason' => $d['reason']], 'snapshot' => ['source' => $p->snapshot['source'], 'before' => $book['quantity'], 'after' => $book['quantity'], 'preparer_id' => $p->created_by], 'reason' => $d['reason'], 'operation_key' => (string) Str::uuid(), 'input_hash' => $this->hash($d + ['action' => $state]), 'created_at' => now()]); + app(RequisitionWorkflow::class)->audit($actor, 'warehouse_return.'.$state, null, null, ['record_id' => $closed->id, 'declaration_id' => $p->id, 'reason' => $d['reason'], 'before' => $book['quantity'], 'after' => $book['quantity'], 'physical_effect' => 0]); + + return ['id' => $closed->id, 'state' => $state, 'replayed' => false]; }); } diff --git a/config/stock_read.php b/config/stock_read.php index 3197e88..ecb8d94 100644 --- a/config/stock_read.php +++ b/config/stock_read.php @@ -1,4 +1,5 @@ [], 'qa_run' => env('SGF_ISOLATED_REGRESSION_RUN'), diff --git a/database/migrations/2026_11_10_000001_create_sgf_invoice_dispatches.php b/database/migrations/2026_11_10_000001_create_sgf_invoice_dispatches.php index 957e870..c2c4f79 100644 --- a/database/migrations/2026_11_10_000001_create_sgf_invoice_dispatches.php +++ b/database/migrations/2026_11_10_000001_create_sgf_invoice_dispatches.php @@ -2,45 +2,81 @@ use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; -use Illuminate\Support\Facades\{DB,Schema}; +use Illuminate\Support\Facades\DB; +use Illuminate\Support\Facades\Schema; -return new class extends Migration { - public function up():void +return new class extends Migration +{ + public function up(): void { - if(!in_array(DB::getDriverName(),['pgsql','sqlite'],true))throw new LogicException('SGF dispatch schema requires PostgreSQL/SQLite.'); - Schema::create('sgf_invoice_dispatches',function(Blueprint $t){ - $t->id();$t->foreignId('tenant_id')->constrained('tenants')->restrictOnDelete(); + if (! in_array(DB::getDriverName(), ['pgsql', 'sqlite'], true)) { + throw new LogicException('SGF dispatch schema requires PostgreSQL/SQLite.'); + } + Schema::create('sgf_invoice_dispatches', function (Blueprint $t) { + $t->id(); + $t->foreignId('tenant_id')->constrained('tenants')->restrictOnDelete(); $t->foreignId('supplier_id')->constrained('suppliers')->restrictOnDelete(); - $t->string('reference',120);$t->string('number',100);$t->string('connection_id',64);$t->string('mapping_id',64); - $t->json('mapping_snapshot');$t->char('mapping_hash',64);$t->json('document');$t->text('reason'); - $t->unsignedInteger('source_version')->default(1);$t->unsignedInteger('version')->default(1); - $t->string('phase',32)->default('draft');$t->boolean('ever_sending')->default(false); - $t->text('state_ciphertext')->nullable();$t->char('approval_hash',64)->nullable(); - $t->foreignId('preview_actor_id')->nullable()->constrained('users')->restrictOnDelete();$t->char('source_context_hash',64)->nullable(); - $t->uuid('operation_key')->nullable()->unique();$t->uuid('lease_id')->nullable();$t->timestamp('lease_until')->nullable(); - $t->json('receipt')->nullable();$t->foreignId('created_by')->constrained('users')->restrictOnDelete();$t->timestamps(); - $t->unique(['tenant_id','reference']);$t->unique(['tenant_id','supplier_id','number'],'sgf_dispatch_document_unique'); - $t->index(['tenant_id','id']);$t->index(['tenant_id','phase','id']); + $t->string('reference', 120); + $t->string('number', 100); + $t->string('connection_id', 64); + $t->string('mapping_id', 64); + $t->json('mapping_snapshot'); + $t->char('mapping_hash', 64); + $t->json('document'); + $t->text('reason'); + $t->unsignedInteger('source_version')->default(1); + $t->unsignedInteger('version')->default(1); + $t->string('phase', 32)->default('draft'); + $t->boolean('ever_sending')->default(false); + $t->text('state_ciphertext')->nullable(); + $t->char('approval_hash', 64)->nullable(); + $t->foreignId('preview_actor_id')->nullable()->constrained('users')->restrictOnDelete(); + $t->char('source_context_hash', 64)->nullable(); + $t->uuid('operation_key')->nullable()->unique(); + $t->uuid('lease_id')->nullable(); + $t->timestamp('lease_until')->nullable(); + $t->json('receipt')->nullable(); + $t->foreignId('created_by')->constrained('users')->restrictOnDelete(); + $t->timestamps(); + $t->unique(['tenant_id', 'reference']); + $t->unique(['tenant_id', 'supplier_id', 'number'], 'sgf_dispatch_document_unique'); + $t->index(['tenant_id', 'id']); + $t->index(['tenant_id', 'phase', 'id']); }); - Schema::create('sgf_invoice_dispatch_events',function(Blueprint $t){ - $t->id();$t->foreignId('dispatch_id')->constrained('sgf_invoice_dispatches')->restrictOnDelete(); - $t->foreignId('tenant_id')->constrained('tenants')->restrictOnDelete();$t->unsignedInteger('version'); - $t->foreignId('actor_id')->constrained('users')->restrictOnDelete();$t->string('action',40);$t->text('reason'); - $t->json('before_state')->nullable();$t->json('after_state');$t->timestamp('created_at'); - $t->unique(['dispatch_id','version']);$t->index(['tenant_id','dispatch_id','id']); + Schema::create('sgf_invoice_dispatch_events', function (Blueprint $t) { + $t->id(); + $t->foreignId('dispatch_id')->constrained('sgf_invoice_dispatches')->restrictOnDelete(); + $t->foreignId('tenant_id')->constrained('tenants')->restrictOnDelete(); + $t->unsignedInteger('version'); + $t->foreignId('actor_id')->constrained('users')->restrictOnDelete(); + $t->string('action', 40); + $t->text('reason'); + $t->json('before_state')->nullable(); + $t->json('after_state'); + $t->timestamp('created_at'); + $t->unique(['dispatch_id', 'version']); + $t->index(['tenant_id', 'dispatch_id', 'id']); }); - if(DB::getDriverName()==='pgsql'){ + if (DB::getDriverName() === 'pgsql') { DB::unprepared("CREATE FUNCTION sgf_dispatch_preserve() RETURNS trigger LANGUAGE plpgsql AS \$\$ BEGIN RAISE EXCEPTION 'Preserve SGF dispatch audit/history'; END; \$\$;"); DB::unprepared('CREATE TRIGGER sgf_dispatch_event_immutable BEFORE UPDATE OR DELETE ON sgf_invoice_dispatch_events FOR EACH ROW EXECUTE FUNCTION sgf_dispatch_preserve()'); DB::unprepared('CREATE TRIGGER sgf_dispatch_no_delete BEFORE DELETE ON sgf_invoice_dispatches FOR EACH ROW EXECUTE FUNCTION sgf_dispatch_preserve()'); - }elseif(DB::getDriverName()==='sqlite'){ - foreach(['UPDATE','DELETE']as$action)DB::unprepared("CREATE TRIGGER sgf_dispatch_events_".strtolower($action)." BEFORE $action ON sgf_invoice_dispatch_events BEGIN SELECT RAISE(ABORT,'Preserve SGF dispatch audit'); END"); + } elseif (DB::getDriverName() === 'sqlite') { + foreach (['UPDATE', 'DELETE'] as $action) { + DB::unprepared('CREATE TRIGGER sgf_dispatch_events_'.strtolower($action)." BEFORE $action ON sgf_invoice_dispatch_events BEGIN SELECT RAISE(ABORT,'Preserve SGF dispatch audit'); END"); + } DB::unprepared("CREATE TRIGGER sgf_dispatch_no_delete BEFORE DELETE ON sgf_invoice_dispatches BEGIN SELECT RAISE(ABORT,'Preserve SGF dispatch history'); END"); - }else throw new LogicException('SGF dispatch schema validated only for PostgreSQL/SQLite.'); + } else { + throw new LogicException('SGF dispatch schema validated only for PostgreSQL/SQLite.'); + } } - public function down():void + + public function down(): void { - Schema::dropIfExists('sgf_invoice_dispatch_events');Schema::dropIfExists('sgf_invoice_dispatches'); - if(DB::getDriverName()==='pgsql')DB::unprepared('DROP FUNCTION IF EXISTS sgf_dispatch_preserve()'); + Schema::dropIfExists('sgf_invoice_dispatch_events'); + Schema::dropIfExists('sgf_invoice_dispatches'); + if (DB::getDriverName() === 'pgsql') { + DB::unprepared('DROP FUNCTION IF EXISTS sgf_dispatch_preserve()'); + } } }; diff --git a/pint.json b/pint.json index 0c0f5f2..9ad308a 100644 --- a/pint.json +++ b/pint.json @@ -1,4 +1,4 @@ { "preset": "laravel", - "exclude": ["packages"] + "exclude": ["packages", "integrations"] } diff --git a/resources/js/pages/company/clients.tsx b/resources/js/pages/company/clients.tsx index 4b77fac..7a945e2 100644 --- a/resources/js/pages/company/clients.tsx +++ b/resources/js/pages/company/clients.tsx @@ -115,10 +115,11 @@ export default function Clients({ onSubmit={(event) => { event.preventDefault(); const data = new FormData(event.currentTarget); - const search = data.get('search'); - router.get('/empresa/clientes', { - search: typeof search === 'string' ? search : '', - }); + const search = data.get('search'); + router.get('/empresa/clientes', { + search: + typeof search === 'string' ? search : '', + }); }} > { const q = BigInt(value); return `${q / 1000n},${(q % 1000n).toString().padStart(3, '0')}`; }; -const states: Record = {prepared:'Por confirmar',confirmed:'Confirmada',withdrawn:'Retirada',rejected:'Recusada'}; +type Row = { + id: number; + prepared_id: number; + version: number; + state: string; + reason: string; + evidence: string; + preparer_id: number; + author_id: number; + created_at: string; + impact: Impact; +}; +type Option = { + delivery_event_id: number; + line_index: number; + delivered_milli: string; + item: Impact['item']; +}; +const milli = (value: string) => { + const q = BigInt(value); + return `${q / 1000n},${(q % 1000n).toString().padStart(3, '0')}`; +}; +const states: Record = { + prepared: 'Por confirmar', + confirmed: 'Confirmada', + withdrawn: 'Retirada', + rejected: 'Recusada', +}; export function WarehouseReturnImpact({ impact: p }: { impact: Impact }) { - return

Stock físico: {milli(p.physical_before)} → {milli(p.physical_after)}. Devolução: {milli(p.return_quantity_milli)} {p.item.unit}. Entrega ainda não devolvida: {milli(p.not_returned_before)} → {milli(p.not_returned_after)}. {p.item.code} · {p.warehouse.code} · Saída original #{p.original_movement_id}.

; + return ( +

+ Stock físico: {milli(p.physical_before)} → {milli(p.physical_after)} + . Devolução: {milli(p.return_quantity_milli)} {p.item.unit}. Entrega + ainda não devolvida: {milli(p.not_returned_before)} →{' '} + {milli(p.not_returned_after)}. {p.item.code} · {p.warehouse.code} · + Saída original #{p.original_movement_id}. +

+ ); } -async function api(url: string, body?: object, signal?: AbortSignal): Promise { - const token = document.cookie.split('; ').find((c) => c.startsWith('XSRF-TOKEN='))?.slice(11); - const response = await fetch(url, { method: body ? 'POST' : 'GET', credentials: 'same-origin', signal, headers: { Accept: 'application/json', 'Content-Type': 'application/json', 'X-Requested-With': 'XMLHttpRequest', ...(token ? { 'X-XSRF-TOKEN': decodeURIComponent(token) } : {}) }, ...(body ? { body: JSON.stringify(body) } : {}) }); - const result = await response.json(); if (!response.ok) throw new Error(result.errors ? Object.values(result.errors).flat().join(' ') : result.message || `Pedido recusado (${response.status})`); return result; +async function api( + url: string, + body?: object, + signal?: AbortSignal, +): Promise { + const token = document.cookie + .split('; ') + .find((c) => c.startsWith('XSRF-TOKEN=')) + ?.slice(11); + const response = await fetch(url, { + method: body ? 'POST' : 'GET', + credentials: 'same-origin', + signal, + headers: { + Accept: 'application/json', + 'Content-Type': 'application/json', + 'X-Requested-With': 'XMLHttpRequest', + ...(token ? { 'X-XSRF-TOKEN': decodeURIComponent(token) } : {}), + }, + ...(body ? { body: JSON.stringify(body) } : {}), + }); + const result = await response.json(); + if (!response.ok) + throw new Error( + result.errors + ? Object.values(result.errors).flat().join(' ') + : result.message || `Pedido recusado (${response.status})`, + ); + return result; } -export default function WarehouseReturns({ requestId, actorId, canPrepare, canConfirm, canWithdraw=false }: { requestId: number | null; actorId: number; canPrepare: boolean; canConfirm: boolean; canWithdraw?:boolean }) { - const [history, setHistory] = useState<{ rows: Row[]; pagination: Page } | null>(null), [sources, setSources] = useState<{ options: Option[]; pagination: Page } | null>(null); - const [page, setPage] = useState(1), [sourcePage, setSourcePage] = useState(1), [state, setState] = useState('all'), [reload, setReload] = useState(0), [error, setError] = useState(''), [busy, setBusy] = useState(false), [preview, setPreview] = useState<{ id: number; impact: Impact; state?:string } | null>(null); - const generation = useRef(0), command = useRef<{ data: string; key: string } | null>(null); - useEffect(() => { const n = ++generation.current, abort = new AbortController(); setHistory(null); setSources(null); setError(''); - Promise.all([api<{ rows: Row[]; pagination: Page }>(`/api/stock-returns?page=${page}&state=${state}`, undefined, abort.signal), requestId ? api<{ options: Option[]; pagination: Page }>(`/api/stock-returns/sources?request_id=${requestId}&source_page=${sourcePage}`, undefined, abort.signal) : Promise.resolve(null)]) - .then(([h, s]) => { if (n === generation.current) { setHistory(h); setSources(s); } }).catch((e: Error) => { if (!abort.signal.aborted && n === generation.current) setError(e.message); }); - return () => { generation.current++; abort.abort(); }; +export default function WarehouseReturns({ + requestId, + actorId, + canPrepare, + canConfirm, + canWithdraw = false, +}: { + requestId: number | null; + actorId: number; + canPrepare: boolean; + canConfirm: boolean; + canWithdraw?: boolean; +}) { + const [history, setHistory] = useState<{ + rows: Row[]; + pagination: Page; + } | null>(null), + [sources, setSources] = useState<{ + options: Option[]; + pagination: Page; + } | null>(null); + const [page, setPage] = useState(1), + [sourcePage, setSourcePage] = useState(1), + [state, setState] = useState('all'), + [reload, setReload] = useState(0), + [error, setError] = useState(''), + [busy, setBusy] = useState(false), + [preview, setPreview] = useState<{ + id: number; + impact: Impact; + state?: string; + } | null>(null); + const generation = useRef(0), + command = useRef<{ data: string; key: string } | null>(null); + useEffect(() => { + const n = ++generation.current, + abort = new AbortController(); + setHistory(null); + setSources(null); + setError(''); + Promise.all([ + api<{ rows: Row[]; pagination: Page }>( + `/api/stock-returns?page=${page}&state=${state}`, + undefined, + abort.signal, + ), + requestId + ? api<{ options: Option[]; pagination: Page }>( + `/api/stock-returns/sources?request_id=${requestId}&source_page=${sourcePage}`, + undefined, + abort.signal, + ) + : Promise.resolve(null), + ]) + .then(([h, s]) => { + if (n === generation.current) { + setHistory(h); + setSources(s); + } + }) + .catch((e: Error) => { + if (!abort.signal.aborted && n === generation.current) + setError(e.message); + }); + return () => { + generation.current++; + abort.abort(); + }; }, [requestId, actorId, page, sourcePage, state, reload]); - useEffect(() => { setPreview(null); command.current = null; setPage(1); setSourcePage(1); }, [requestId, actorId]); - async function prepare(e: FormEvent) { e.preventDefault(); const n = generation.current; setBusy(true); setError(''); const fields = Object.fromEntries(new FormData(e.currentTarget)), choice = sources?.options.find((o) => `${o.delivery_event_id}:${o.line_index}` === fields.source); - if (!choice) { setError('Seleccione uma entrega recebida.'); setBusy(false); return; } - const body = { delivery_event_id: choice.delivery_event_id, line_index: choice.line_index, quantity: fields.quantity, declared_unused: fields.declared_unused === 'on', reason: fields.reason, evidence: fields.evidence }, data = JSON.stringify(body); - if (command.current?.data !== data) command.current = { data, key: crypto.randomUUID() }; - try { const p = await api<{ id: number; impact: Impact }>('/api/stock-returns/prepare', { ...body, operation_key: command.current.key }); if (n === generation.current) { setPreview(p); setReload((x) => x + 1); } } catch (err) { if (n === generation.current) setError((err as Error).message); } finally { setBusy(false); } + useEffect(() => { + setPreview(null); + command.current = null; + setPage(1); + setSourcePage(1); + }, [requestId, actorId]); + async function prepare(e: FormEvent) { + e.preventDefault(); + const n = generation.current; + setBusy(true); + setError(''); + const fields = Object.fromEntries(new FormData(e.currentTarget)), + choice = sources?.options.find( + (o) => + `${o.delivery_event_id}:${o.line_index}` === fields.source, + ); + if (!choice) { + setError('Seleccione uma entrega recebida.'); + setBusy(false); + return; + } + const body = { + delivery_event_id: choice.delivery_event_id, + line_index: choice.line_index, + quantity: fields.quantity, + declared_unused: fields.declared_unused === 'on', + reason: fields.reason, + evidence: fields.evidence, + }, + data = JSON.stringify(body); + if (command.current?.data !== data) + command.current = { data, key: crypto.randomUUID() }; + try { + const p = await api<{ id: number; impact: Impact }>( + '/api/stock-returns/prepare', + { ...body, operation_key: command.current.key }, + ); + if (n === generation.current) { + setPreview(p); + setReload((x) => x + 1); + } + } catch (err) { + if (n === generation.current) setError((err as Error).message); + } finally { + setBusy(false); + } } - async function confirm(e: FormEvent, row: Row) { e.preventDefault(); const n = generation.current; setBusy(true); setError(''); const fields = Object.fromEntries(new FormData(e.currentTarget)); - try { await api(`/api/stock-returns/${row.prepared_id}/confirm`, { version: 1, received_in_warehouse: fields.received_in_warehouse === 'on', reason: fields.reason }); if (n === generation.current) { setPreview(null); setReload((x) => x + 1); } } catch (err) { if (n === generation.current) setError((err as Error).message); } finally { setBusy(false); } + async function confirm(e: FormEvent, row: Row) { + e.preventDefault(); + const n = generation.current; + setBusy(true); + setError(''); + const fields = Object.fromEntries(new FormData(e.currentTarget)); + try { + await api(`/api/stock-returns/${row.prepared_id}/confirm`, { + version: 1, + received_in_warehouse: fields.received_in_warehouse === 'on', + reason: fields.reason, + }); + if (n === generation.current) { + setPreview(null); + setReload((x) => x + 1); + } + } catch (err) { + if (n === generation.current) setError((err as Error).message); + } finally { + setBusy(false); + } } - async function close(e:FormEvent,row:Row,action:'withdraw'|'reject'){e.preventDefault();const n=generation.current;setBusy(true);setError('');const fields=Object.fromEntries(new FormData(e.currentTarget));try{await api(`/api/stock-returns/${row.prepared_id}/${action}`,{version:1,reason:fields.reason});if(n===generation.current){setPreview(null);setReload(x=>x+1);}}catch(err){if(n===generation.current)setError((err as Error).message);}finally{setBusy(false);}} - return <>
- {requestId ? 'Consultar a requisição de origem' : 'Voltar ao Painel Inicial'} - {error &&

{error}

} - {canPrepare && requestId && sources &&
-