Skip to content

docs(query): document the join alias default and population stddev - #2074

Open
abnegate wants to merge 1 commit into
mainfrom
fix/join-alias-optional
Open

abnegate wants to merge 1 commit into
mainfrom
fix/join-alias-optional

Conversation

@abnegate

Copy link
Copy Markdown
Member

What

  • Join docs: the join docblocks (web, react-native, dart, php, kotlin, android) say that without an alias the join is named after the table ID.
  • Tests: each SDK's query tests (node, php, python, go, dart, kotlin, swift) pin the alias-less ON-list join and cross join. They send no alias, and the server applies its default.
  • stddev and variance: documented as population statistics. The database library maps them to STDDEV_POP and VAR_POP on every engine.

Why

  • Server default: an alias-less join used to be rejected with Join alias is required. The database library now defaults the alias to the joined table ID when that ID is a valid alias, and otherwise returns a 400 naming the reason. (Server work is in utopia-php/query, utopia-php/database and appwrite/appwrite.)
  • No signature changes: every SDK already serialized the alias-less forms correctly. The overloaded forms ship in released SDKs (web 29.0.0, node 30.0.1, python 25.0.0), so removing them would be a breaking change.

Verification

Each SDK was generated from server-ce main specs and its query tests run locally:

SDK Result
node 92/92 (jest), format:check + lint clean
php Join tests 8/8, pint clean
python pass, black clean
go pass, gofmt clean
dart 91 pass
kotlin 29/29, ktlint 1.8.0 clean
swift join tests 7/7 (swift test; CI only builds swift)

Before/after: these tests also pass on main, because the SDKs never had the bug. The fail-before proof is at the server layer: the database library's unit and e2e tests, plus the appwrite API E2E. The new SDK tests pin the wire contract that the server default relies on.

🤖 Generated with Claude Code

The server now names an alias-less join after its table ID, so every
SDK's alias-less join forms (column form, ON-list form, crossJoin) are
first-class rather than rejected. The join docblocks say so, and each
SDK's query tests pin that those forms send no alias and leave the
default to the server.

stddev and variance map to STDDEV_POP and VAR_POP on every engine, so
their docblocks now say population instead of leaving it ambiguous.

The deno templates are left alone: deno is no longer a generator target.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hansi-codes

hansi-codes Bot commented Oct 16, 2026

Copy link
Copy Markdown

🔵 Tier A · Mergeable after minor fixes

The only issue is a minor documentation omission: the server applies the fallback only when the table ID is a valid alias.

This PR updates the generated query documentation to describe alias-less joins and clarify that stddev and variance use population statistics. It also adds query serialization tests for alias-less nested joins and cross joins across the affected SDKs.

Verdict New comments Fixed Still open
✅ Approved 1 0 0
Finding Where
🟡 Qualify the default for IDs that are not valid aliases templates/web/src/query.ts.twig:827
Fix with agent prompt
### Issue 1
templates/web/src/query.ts.twig:827
**Qualify the default for IDs that are not valid aliases**

One caveat is missing here: the server applies this default only when `table` is valid as an alias; otherwise it returns 400. This reads as an unconditional default for every collection ID, so please qualify the limitation in this and the mirrored SDK docs.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
📂 Walkthrough · 13
File Change
templates/android/library/src/main/java/io/package/Query.kt.twig Clarifies population aggregate statistics and alias-less join documentation.
templates/dart/lib/query.dart.twig Clarifies aggregate statistics and documents the alias-less join default.
templates/dart/test/query_test.dart.twig Adds serialization tests for nested joins and cross joins without aliases.
templates/go/query_test.go.twig Adds serialization tests for nested joins and cross joins without aliases.
templates/kotlin/src/main/kotlin/io/appwrite/Query.kt.twig Clarifies population aggregate statistics and alias-less join documentation.
templates/kotlin/src/test/kotlin/io/appwrite/QueryTest.kt.twig Adds serialization tests for nested joins and cross joins without aliases.
templates/node/test/query.test.js.twig Adds serialization tests for nested joins and cross joins without aliases.
templates/php/src/Query.php.twig Clarifies aggregate statistics and documents the alias-less join default.
templates/php/tests/QueryTest.php.twig Adds serialization tests for nested joins and cross joins without aliases.
templates/python/test/test_query.py.twig Adds serialization tests for nested joins and cross joins without aliases.
templates/react-native/src/query.ts.twig Documents the alias-less join default.
templates/swift/Tests/Tests.swift.twig Adds serialization tests for nested joins and cross joins without aliases.
templates/web/src/query.ts.twig Clarifies population aggregate statistics and documents the alias-less join default.

Reviewed f99c4c2 · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@hansi-codes hansi-codes Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Tier A · Looks good to merge. Summary


/**
* Inner join. `table` is the joined collection/table ID.
* Inner join. `table` is the joined collection/table ID; without an alias the join is named after it.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Qualify the default for IDs that are not valid aliases

One caveat is missing here: the server applies this default only when table is valid as an alias; otherwise it returns 400. This reads as an unconditional default for every collection ID, so please qualify the limitation in this and the mirrored SDK docs.

Prompt To Fix With AI
This is a comment left during a code review.
Path: templates/web/src/query.ts.twig
Line: 827

Comment:
**Qualify the default for IDs that are not valid aliases**

One caveat is missing here: the server applies this default only when `table` is valid as an alias; otherwise it returns 400. This reads as an unconditional default for every collection ID, so please qualify the limitation in this and the mirrored SDK docs.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

🟡 Minor · documentation · Reply if this doesn't apply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant