Sync Laravel updates: test transactions, PostgreSQL schemas and strict input
Merged
BI
2d ago+4697+4697+0123456789012345678901234567890123456789-2076-2076-0123456789012345678901234567890123456789
Laravel Updates
- #62194, #62201 — Roll back every open transaction level after each
RefreshDatabasetest, so a test that leaves a transaction open no longer leaks it. Add theWithoutMigrationEventsattribute for classes or methods whose test connections should not dispatch database events, such as executed queries, while the database is migrated, and document it. - #62213 — Qualify dropped and renamed PostgreSQL indexes with their table's schema, so indexes on schema-qualified tables are found regardless of the search path.
- #62215 — Flush Redis cache tags one tag at a time in both tagging modes. Each chunk of entries is removed only from the tag it was read from, so the work per script no longer grows with the number of tags being flushed.
- #62217, #62254, facade update — Add a
strictflag tostr(),string(),integer(),float()andboolean(), which returns the default for values that are not valid for the type instead of coercing them.array()now converts object values withArr::from(). Run the shared input tests against requests, fluents, validated input, component attributes, URIs and command input. Document strict retrieval and regenerate the Request facade. - #62179 — Add
between,exactly,maxandminto the array rule builder, with documentation. The parser takes the builder's rules as a list, so quoted keys may contain pipes. - #62178 — Compare values that are not valid UTF-8 case-sensitively in
distinct:ignore_caseinstead of throwing. - #62225 — Convert collections to arrays when updating JSON paths, so MySQL and MariaDB store them as JSON like arrays.
- #62204 — Add
restoreOrCreate()andcreateOrRestore()to has-one-through and has-many-through relations. - #62210 — Accept armenian, basque, catalan, greek, hindi, serbian and yiddish as PostgreSQL full text languages.
- #62208 — Return non-integer failed job IDs as strings from the database provider, and document the ID types each provider returns.
- #62183 — Make
schedule:interruptfail when interruption polling is disabled, asschedule:pausedoes. - #62200 — Accept exit code and exception shorthands for faked processes that are started, matching
run(). - #62182 — Read bus job attributes through
ReadsClassAttributesdirectly. - #62202 — Port the
install:broadcastingtests for the Reactapp.tsxandapp.jsxentry files. Record in the foundation README that the command configures Echo in the application file only for React apps. - #62176 — Port
ApiAuthenticationWithEloquentTestand run it in the MySQL CI jobs. - #62190, #62175, #62203, #62206, #62205, #62211, #62226 — Add the upstream tests for behavior Hypervel already had: GMT
down --retrydates, unencodable JSON in JSON paths and object casts, transaction manager rollback after a failed commit, models with a disabled primary key, reconnecting after a connection is lost during rollback, and thePaginator::links()return type.
Additional Hypervel changes
- Roll back every open transaction level after each
DatabaseTransactionstest too. It rolled back one level and, unlike Laravel, does not disconnect, so a leaked transaction stayed open until the connection returned to the pool. - Report a failed reconnect before a query as a
QueryException, as Laravel does, instead of letting the rawPDOExceptionescape. This covers lost-connection retries and missing connections in buffered and streaming queries. Custom drivers identify their own exceptions through the protectedisDriverErrormethod, which is documented with the other driver extension points. - Treat a schema named
0as a schema. PostgreSQL index qualification, the PostgreSQL and MySQL metadata queries, the PostgreSQL, MySQL and SQLite schema filters, SQLite index creation, index drops and truncation,DatabaseTruncationanddb:showlabels had ignored it and acted on the default schema instead. - Follow the PostgreSQL connector's
search_path,schema,publicprecedence when listing current schemas, so an explicitly empty search path lists none. Dropping all tables, views and types, andDatabaseTruncation, then do nothing instead of acting on every schema.hasView()returns false when there is no current schema instead of searching every schema. - Resolve a closure default once in strict
string(),integer()andfloat(), and return the filtered number when strictinteger()orfloat()receives a numericStringableinstead of casting the object. The cache repository'sinteger()andfloat()and the pagination page resolver had the sameStringablecast and now use the filtered value too. - Report later case-insensitive duplicates in
distinct:ignore_casewhen an earlier value is not valid UTF-8, and keep a value with a trailing newline distinct from the same value without one. - Read objects assigned to built-in class casts back in the cast's own form. Eloquent caches an assigned object and returns it on later reads, so a
Collectionassigned toAsArrayObject, aLazyCollectionassigned toAsCollection, arrays assigned to a mapped collection, a plain object assigned toAsFluentor aUuidassigned toAsBinaryread back unchanged, and some broketoArray()or later writes. Casts can now decline to cache an assigned object through an optionalshouldCacheObject()method, and the next read builds the value from the stored attributes. Objects already in the cast's form keep their identity and in-place edits. Generators assigned to collection and array object casts are now stored with their items instead of as{}. The enum casts' write types include the string and integer values they accept, andAsFluentaccepts arrays or objects. - Remove the
ComponentAttributeBag::array()override, which existed only for the old cast; the bag keeps the inheritedarray()method. Remove unreachable fallbacks for test methods that do not exist, and name the query-count test cases after their real method. - Create the SQLite test database file only when tests run on SQLite. MySQL, MariaDB and PostgreSQL runs left an empty file named after the server database in the working directory.
Formatting, source and type-fixture analysis, affected tests and Testbench package checks pass. The database changes were also tested on SQLite, MySQL, MariaDB and PostgreSQL, and the Redis tag flushing against a live Redis server. CI runs the full suite on every supported database.
[!NOTE]
Sync Laravel updates: test transactions, PostgreSQL schemas, and strict input
- Adds strict-mode options to
InteractsWithData string, boolean, integer, and float accessors; strict mode returns the resolved default for invalid or unrecognized values instead of coercing them
- Makes connection reconnects query-aware via
Connection.reconnectForQuery and PdoConnection.isDriverError: reconnect failures classified as driver errors become QueryExceptions tied to the failed query, while other reconnect exceptions rethrow
- Fixes schema handling across MySQL, PostgreSQL, and SQLite grammars plus
PostgresBuilder and DatabaseTruncation: empty-string and "0" schemas are treated as explicit schema values, empty search paths skip drop-all and truncation operations, and schema-qualified index drop/rename SQL qualifies the index name
- Adds size constraints (
min, max, between, exactly) to Rule::array(), restoreOrCreate/createOrRestore on HasOneOrManyThrough, a WithoutMigrationEvents attribute, and per-tag chunk flushing in Redis tag cache (AllTag/Flush.php, AnyTag/Flush.php) so each chunk is removed only from the tag it was scanned from
- Eloquent object casts gain a
shouldCacheObject hook (HasAttributes.php); many test suites are consolidated onto a shared TestsInteractsWithDataContract trait
- Behavioral Change: strict-mode accessors return the default for booleans and other invalid values while non-strict accessors keep coercing,
ComponentAttributeBag drops its array() override and inherits InteractsWithData::array(), Redis flush script payloads drop the tag-count argument, and TestCase unit-test attribute reflection failures now propagate instead of returning false
Macroscope summarized 7431126.
Summary by CodeRabbit
-
New Features
- Added strict input conversion options for strings, booleans, integers, and floats, with support for custom defaults.
- Added size constraints to fluent array validation rules and restore-or-create options for through relationships.
- Added an option to suppress migration events during test database refreshes.
- Expanded PostgreSQL full-text language support.
-
Bug Fixes
- Improved Redis tag flushing so shared entries are handled separately for each tag.
- Improved database reconnection and query error handling, schema handling, and object casting.
- Corrected numeric conversion and pagination for numeric string-like values.
- Prevented scheduling interrupts when interruption is disabled.
-
Documentation
- Expanded guidance for strict input conversion, array validation, migration events, database drivers, and broadcasting setup.