Repository navigation
Conversation
utopia-php/database 8 requires PHP 8.5, so usage has to run on 8.5 before it can take the 8.0 schema API. The image moves to php:8.5.8-cli-alpine and the vendor stage to composer:2.8, the same tags the database image builds from; the vendor stage already installs with --ignore-platform-reqs and the final stage keeps pdo_mysql. On its own this changes nothing else: the full suite passes on the 8.5 image against the locked utopia-php/database 7.0.0 (378 tests). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
appwrite and cloud require utopia-php/usage ^0.16.4, and every 0.16.x requires utopia-php/database ^7.0.0, so database 8.0.0 cannot be installed next to usage until a usage release requires it. Database 8 removed the createCollection(string $id, array $attributes, array $indexes) signature this adapter called, so setup() now builds the collection from Collection, Attribute and Index models. The definitions still come from Metric's schema arrays, converted with Attribute::fromArray() and Index::fromArray(), so the collection is the one 0.16.5 created: the MariaDB table is identical, and the stored metadata matches on every field 0.16.5 stored. The only difference is the ClickHouse-only indexType hint, which database 7 kept verbatim in the index metadata and the 8.0 Index model does not carry; this adapter never read it. testSetupCreatesTheCollection0165Created pins the equivalence field by field. Before the port, every DatabaseTest errors against database 8 because setup() cannot create the collection. contains() compiles through containsString(): utopia-php/query 0.6 deprecates the contains() factory, and every column in this collection is a scalar, so it is the same substring match. The database constraint is a temporary root alias of dev-feat-query-lib; the 8.* constraint and the 0.17.x-dev branch alias follow once database publishes its own branch alias. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
0.17.0 is the first usage release that installs next to utopia-php/database 8: it requires PHP 8.5 and database 8, and the Database adapter builds the same collection through the 8.0 schema API. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The lock now points at d82a7ec54, the head the port's test matrix was run against. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Gauges already split multi-node resources on ordinal. Counters such as dedicated-database inbound, outbound and compute need the same column so a chart can tell members apart. setup() adds it to existing event tables. The daily MV stays grouped on resource identity only, so billing still sums every member. Co-authored-by: Cursor <cursoragent@cursor.com> (cherry picked from commit 1dc2314)
3 tasks done
|
usage 0.16.x requires utopia-php/database ^7.0.0, so database 8.0.0 cannot be installed next to usage in appwrite or cloud until a usage release asks for 8. us-01 ported the code behind a temporary "dev-feat-query-lib as 7.0.0" root alias, which also claims a version below database's current 7.3.12 release. Requiring 8.* instead resolves through the branch's own 8.0.x-dev alias today and through the 8.0.0 tag once it exists, with no root alias to unwind. The branch alias for dev-feat-query-lib and dev-main lets consumers require this work before 0.17.0 is tagged. minimum-stability dev with prefer-stable true is needed only while 8.0.x-dev is untagged; stable is restored with the tag. The remaining constraint edits are wildcards for the same versions, and README's requirement line follows "php": ">=8.5". Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
PR #42 conflicted with main after #43 moved usage to utopia-php/client 0.5's names, so GitHub ran no CI on it and it could not merge. Conflicts: - composer.json: both sides edited the require block. Kept this branch's file (database 8.*, PHP 8.5, wildcard constraints, dev stability with prefer-stable, the 0.17.x-dev branch alias) and took main's "utopia-php/client": "^0.5" line as main wrote it. - composer.lock: both sides changed the content hash. Rebuilt from this branch's lock with a partial update of utopia-php/client only, so client moves 0.4.3 -> 0.5.1 (the same entry as main's lock) and no other package moves; database stays dev-feat-query-lib 8b716e3c1c through its 8.0.x-dev alias. With -W, composer/semver would also have moved (3.4.4 -> 3.5.0), which client 0.5 does not need. src/Usage/Adapter/ClickHouse.php merged cleanly and takes main's Utopia\Client\Client import: client 0.5 moved the class, and the old Utopia\Client name is only an alias until client's next major (appwrite's in-repo packages/client, which replaces utopia-php/client there, has no such alias). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The merge of main brought "utopia-php/client": "^0.5" and the Utopia\Client\Client import, so the 0.17.0 entry's claim that client is written as the 0.4.* wildcard and resolves to the same version no longer held. The wildcard line now names the three constraints it still covers, and a separate line records the client 0.5 requirement. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The merge of main (da77966) took main's "utopia-php/client": "^0.5" line as main wrote it, so the branch had a caret constraint again after 24ace64 wrote every constraint as a wildcard. For a 0.x version ^0.5 and 0.5.* are the same range (>=0.5.0 <0.6.0): client stays on 0.5.1 and the lock changes only its content-hash. The 0.17.0 CHANGELOG line names the constraint, so it follows. phpunit/phpunit keeps ^9.5, the one range left, because no wildcard expresses >=9.5 <10. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The train wrote the constraints it changed as wildcards under a house rule that has since been withdrawn: constraints are carets again. psr/http-client, utopia-php/client, utopia-php/cache and phpstan/phpstan take main's (and 0.16.6's) form again, ^1.0, ^0.5, ^4.0 and ^2.0. For client this undoes 6a39ba1, which had rewritten main's ^0.5 as 0.5.*. utopia-php/database, which the train moved to 8, takes the caret of that range, ^8.0. Each caret is the same range as the wildcard it replaces, and every locked version satisfies it (database through its 8.0.x-dev branch alias), so composer update --lock modifies nothing and the lock changes only its content-hash. The 0.17.0 CHANGELOG spells database and client as carets and drops the bullet that called the other three constraints wildcards: they equal 0.16.6's again. utopia-php/query keeps main's own 0.6.*. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ClickHouseColumnTypeTest reflected into the adapter's private
getColumnType() and compared the type string of 22 dimension columns,
the ordinal on events and gauges among them. It never touched a table:
a column that stopped storing, filtering or returning values passed,
while a storage-only change such as dropping LowCardinality failed.
What callers can see of those types is that a missing value is NULL
and every value is kept as the string written. ClickHouseTest now
checks that through the public API:
- For events and gauges, ordinals '0', '1' and 10 read back as '0',
'1' and '10', and a row without one reads back null. equal('10')
and isNull() each match only their row, and grouping by ordinal
lists each member in order, with the rows without one apart.
- The daily rollup still totals every member. The event ordinal test
said so but only summed the raw table.
- Every event dimension, taken from Metric::EVENT_COLUMNS, filters and
reads back as written and is null when omitted. The previous list
held 24 of the 47 columns and read none of them back.
A non-nullable or FixedString(1) ordinal fails the new tests; a plain
Nullable(String) passes them, where the removed test failed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
testEveryEventDimensionRoundTrips built its tags from Metric::EVENT_COLUMNS and asserted over the same list, so a dimension dropped from that list dropped out of the test too: with weatherCode left out of EVENT_COLUMNS it still passed, checking 46 columns. Its '<column>-value' strings, 34 bytes at most, also let a cap on stored values go unnoticed. The dimensions are now written out in the test, grouped by what callers send (request, resource, network, location, client), with values shaped like real input: a 135-byte Accept header, a route with placeholders, an IPv6 address, a non-ASCII city, a postal code with a space, a negative coordinate, uppercase codes and numeric-looking identifiers. For each one, equal() returns only the event that carries it, with the value as written, and isNull() returns only the event without it. Removing or renaming a dimension now fails the test; storage-only changes such as dropping LowCardinality still pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
|
Usage now lives in |
2 tasks done
abnegate
added a commit
to appwrite/appwrite
that referenced
this pull request
Sep 29, 2026
utopia-php/usage#42 moved usage onto utopia-php/database 8: typed Attribute and Index models for the schema, the event ordinal dimension, PHP 8.5. Main absorbed usage into packages/usage (#13956) and the mirror closed #42 in favour of a change here, so this applies #42's final head (bf9ab997fa) to the package: every line it changed, in the package layout, with its tests. The package requires database ^8.0 with dev stability until 8.0.0 is tagged, because bin/monorepo check and test resolve it from Packagist, where it exists only as 8.0.x-dev; the mirror's branch alias does not apply to a split package. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
feat: add ordinal event dimension column): theordinaldimension now comes fromMetric, through the 8.0 schema API, and feat: add ordinal event dimension column #40 is closed in favour of this PR.utopia-php/usage: ^0.16.4, and every 0.16.x requiresutopia-php/database: ^7.0.0, so database 8.0.0(Use query lib database#823) cannot be installed next to usage until a usage release requires it. This PR is that release.
setup()callscreateCollection(new Collection(id: …, attributes: […], indexes: […]))instead of the removedcreateCollection(string $id, array $attributes, array $indexes). The definitions still come fromMetric::getEventSchema()andMetric::getEventIndexes(), now converted withAttribute::fromArray()andIndex::fromArray()(SQL::getAttributeDocuments()/getIndexDocuments()return those models, which are stillDocuments); the adapter's owntypeandordinalcolumns useAttribute::string()andIndex::key().contains()compiles throughcontainsString(). utopia-php/query 0.6 deprecates thecontains()factory, whichraises
E_USER_DEPRECATEDon PHP 8.4+. usage'scontainsis a substring match and every column in the collection is ascalar, so
containsString()is the same query;containsAny()keeps its own factory."php": ">=8.5"(database 8's own minimum); the test image builds fromphp:8.5.8-cli-alpineandcomposer:2.8, the tags the database image uses, and still installspdo_mysql.UsageQuery, theUtopia\Query\Methodhandling and the ClickHouse adapter are unchanged; mainalready speaks
Methodthroughout.The collection is unchanged
SHOW CREATE TABLEfor the collection this branch creates on database 8 is byte-for-byte the table 0.16.5creates on database 7.0.0: 51 columns and 27 indexes, including the
path(255),accept(255)andqueryKeys(255)prefix indexes.
$id,type,size,required,signed,array,filtersandformatfor all 51 attributes;$id,type,attributes,lengthsandordersfor all 27 indexes;create("any")anddocumentSecurity: trueon the collection. The only differences arewhat the 8.0 models always store (
key,default: null,formatOptions: [],ttl: 1) and the ClickHouse-onlyindexTypehint, which database 7 kept verbatim in the index metadata and database 8'sIndexmodel does not carry.The Database adapter never read it; the ClickHouse adapter still reads it from
Metric.DatabaseTest::testSetupCreatesTheCollection0165Createdpins this. It runssetup()in a fresh namespace and comparesgetCollection()attribute by attribute and index by index against the array definitions 0.16.5 passed tocreateCollection(). Before the port, the wholeDatabaseTestclass errors against database 8:createCollection(): Argument #1 ($collection) must be of type Utopia\Database\Collection, string given.7.
setup()leaves it alone, and writes,find,sum, gaugegetTotal,count,purgeandhealthCheckall workagainst it.
CHANGELOG (0.17.0, unreleased)
php:8.5.8-cli-alpine.Collection,AttributeandIndexmodels). The collection is unchanged, andsetup()still leaves an existing collection alone,so a collection created by 0.16 is reused as it is.
SQL::getAttributeDocuments()andSQL::getIndexDocuments()returnUtopia\Database\AttributeandUtopia\Database\Indexmodels, which are stillDocuments. The index models no longer carry the ClickHouse-onlyindexTypehint; the ClickHouse adapter reads it fromMetric::getEventIndexes()/Metric::getGaugeIndexes()asbefore.
contains()throughcontainsString()instead of the deprecatedcontains()factory. Matching is unchanged: a substring match on the column.Test plan
docker composeon thephp:8.5.8-cli-alpineimage against utopia-php/databasedev-feat-query-lib(2034b6a0a): OK (379 tests, 1724 assertions)DatabaseTestwith the database library swapped for each in-flight Use query lib database#823 fix branch (39branches on top of 482e752): 42 of 42 pass on every one, and on every one the MariaDB table and the stored metadata
match what 0.16.5 creates
composer lint(Pint) andcomposer check(PHPStan, level max): cleanRelease
"utopia-php/database": "dev-feat-query-lib as 7.0.0"is temporary. A follow-up commit on this branch switches to"utopia-php/database": "8.*", adds the0.17.x-devbranch alias fordev-feat-query-libanddev-main, and setsminimum-stability: devwithprefer-stable: trueuntil database 8.0.0 is tagged. After that tag: restoreminimum-stability: stable, lock database 8.0.0, merge, tag 0.17.0.Notes
(
ReflectionMethod::setAccessible()/ReflectionProperty::setAccessible(), deprecated in 8.5) and a few from teststhat call
Query::contains(). They come from test code only; nothing undersrc/raises one, and PHPUnit 9 does notfail on them.
origin/codex/query-method-constants(0afa7a8) is superseded and not included: main already compares against theMethodenum everywhere and deliberately removed theUsageQueryhelpers it patched.🤖 Generated with Claude Code