Repository navigation
refactor(specs): name the alias summary "summary" - #13745
Conversation
An operation carries its short title in the standard `summary` field and its prose in `description`. A method alias in `x-appwrite.methods[]` mirrors an operation, but carried the same short title under `desc` while keeping `description` as a separate sibling, so `desc` read like an abbreviation of the field sitting next to it. Emit `summary` instead, and rename the PHP side to match: Method::$desc becomes $summary with getSummary(), and the 16 call sites pass `summary:`. Route::getDesc() is Utopia's and is untouched. No consumer changes. The generator never read the key, deriving an alias summary from its name. Vibes already reads `additionalMethod.summary || additionalMethod.desc`, so it takes the new field on the first branch and its fallback can be dropped once historical specs stop mattering. While here, validateDesc() validates a description, so it is renamed to validateDescription() to keep it distinct from the new summary.
|
| $this->assertSame('', $canonical['x-appwrite']['methods'][0]['summary']); | ||
| $this->assertSame('Update presence for a user', $canonical['x-appwrite']['methods'][1]['summary']); |
There was a problem hiding this comment.
These assertions repeat the exact summary passed into the fixture and its default empty value. They therefore test simple value propagation rather than an independently defined observable contract. This violates the repository directive not to mirror source configuration in assertions; the repository requirement must be satisfied before merging by replacing this with a behavior-level test and leaving schema or key validation to the appropriate linter.
Context Used: Call out and harshly judge implementation-coupled tests. We don't mirror source code, configuration, or version pins in assertions. We test observable behavior; use linters for syntax and schema checks. (source)
Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/unit/SDK/Specification/FormatTest.php
Line: 1548-1549
Comment:
**Fixture Values Mirrored**
These assertions repeat the exact summary passed into the fixture and its default empty value. They therefore test simple value propagation rather than an independently defined observable contract. This violates the repository directive not to mirror source configuration in assertions; the repository requirement must be satisfied before merging by replacing this with a behavior-level test and leaving schema or key validation to the appropriate linter.
**Context Used:** Call out and harshly judge implementation-coupled tests. We don't mirror source code, configuration, or version pins in assertions. We test observable behavior; use linters for syntax and schema checks. ([source](https://app.greptile.com/review/custom-context?memory=instruction-0))
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
What
Renames the method-alias short-title field in
x-appwrite.methods[]fromdescto the standard OpenAPI namesummary, and renames the PHP field behind it.Why
An OpenAPI operation carries its short title in
summaryand its prose indescription, and the producer already does that for real operations (OpenAPI3.php:310,'summary' => $route->getDesc()). Method aliases don't exist in OpenAPI, so they're packed intox-appwrite.methods[]as mini-operations — and there the same short title was calleddesc, sitting directly beside adescriptionfield holding the long prose:{ "summary": "Create document", // the operation "description": "Create a new Document. Before…", "x-appwrite": { "methods": [{ "name": "createDocuments", "desc": "Create documents", // the alias's summary, under another name "description": "Create new Documents. Before…" }] } }So
descreads like an abbreviation of the field next to it while actually meaning something else. That is both an abbreviation the style guide rules out and a non-standard name for something OpenAPI can express, which is what appwrite-labs/cloud#5799 is cleaning up.Changes
OpenAPI3.php:359emits'summary' => $methodObj->getSummary().Appwrite\SDK\Method::$desc→$summary,getDesc()→getSummary(), and the 16 call sites across 10 files passsummary:.Route::getDesc()is Utopia's and is untouched, including its use for the operation summary.validateDesc()is renamedvalidateDescription()— it validates a description, and the old name collided conceptually with the new summary.Effect on the canonical document
77 aliases: 13 carry a populated summary (
"Create documents","Upsert presence","Create Text Embedding"…), 64 are empty strings today and stay empty strings. No value changes, only the key.Consumers
Neither consumer needs a change.
desc.createAliasedOperation()derives an alias summary fromalias['name']and its description fromalias['description'].additionalMethod.summary || additionalMethod.desc || operation.summary(src/lib/api-explorer/parse-spec.ts:154), so it picks up the new field on the first branch with no flag day. Dropping the now-deaddescfallback is an independent tidy-up for whenever historical specs stop mattering.Testing
testCanonicalDocumentListsEveryAliasVariantnow gives one of its two aliasessummary: 'Update presence for a user'and asserts the emittedsummaryfor both aliases, so the alias keeps a summary distinct from its name and description.vendor/bin/phpunit tests/unit/SDK/Specification/FormatTest.php— 42 tests, 250 assertions, OKvendor/bin/phpunit --testsuite unit— 1275 tests; the only failures are 19 errors plusExtensionsTest::testMaxminddb, which reproduce identically on a cleanmainin this environment (missingmaxminddbextension and image/font deps)composer lint— Pint passed