fix: pin CLI template @appwrite.io/console to 15.3.0 and dedupe generated query flags#1653
Conversation
Greptile SummaryThis PR delivers two targeted fixes to keep CLI template generation passing against the 1.9.x console spec, plus correctness fixes in the Python and Dart SDK templates.
Confidence Score: 5/5All changes are narrowly scoped bug fixes with no architectural side effects; safe to merge. The CLI deduplication logic correctly identifies flag-group collisions and skips only the affected groups, leaving other groups intact. The console SDK pin, Python Model-suffix fix, and Dart enum import guard are all mechanically straightforward and directionally correct. No incorrect branching, missing guard, or data-loss path was found. No files require special attention. Important Files Changed
Reviews (5): Last reviewed commit: "(fix): handle service-model name collisi..." | Re-trigger Greptile |
|
Good catch — the |
…es and nested enums in dart model tests
This PR carries the fixes needed for the full validation matrix to pass against the current 1.9.x specs (synced in appwrite/specs#86). Four independent issues, all surfaced by the new spec:
1. Pin
@appwrite.io/consoleto15.3.0in the CLI templateThe CLI depends on the console web SDK. The template pinned a caret range:
sdk-for-cliis already pinned to exactly15.3.0(appwrite/sdk-for-cli@f232e97), so every regeneration reverted it back to^15.1.1— which can resolve to console SDKs missing the new APIs (organization memberships, OAuth2 PAR, TablesDB migrations, addons) and fail the build with errors like:package-lock.json.twigandbun.lock.twigwere regenerated viascripts/update-lockfiles.sh cli(with npm 11 — an earlier regeneration with npm 10 dropped thelibcfields on optional native-binary entries, caught by Greptile and fixed).An exact pin keeps the template byte-identical with the generated repo and makes console bumps an explicit, reviewed change here.
2. CLI: generated query flags collided with spec-declared parameters
The CLI generator adds convenience flags (
--filter,--sort-*,--limit,--offset,--cursor-*,--select) to any command whose method has aqueriesarray parameter. The new cloudusageendpoints (listEvents,listGauges) declare literallimit/offsetparameters alongsidequeries, so the generated command registered the same option twice and Commander threw at startup:The generated flag groups are now tracked in a constant and a group is skipped when any of its option names collides with a parameter the method already declares — the spec-declared options win:
The same constant now also feeds the
buildQueriesbuilder params, removing the previously duplicated hardcoded lists.3. Python: service/model name collision broke generic responses
The new
organizationservice returns theorganizationmodel. The service template aliases the import on collision:…but the generic-response paths still emitted the bare name in the return annotation and the response parsing:
On Python ≤ 3.13, return annotations are evaluated at function-definition time, so importing the module raised:
(this was the
python (server)validation failure — it doesn't reproduce on Python 3.14, which defers annotation evaluation). The collision alias is now applied in all three places (return annotation, docstring,.with_data()call):4. Dart: enum properties in nested model-test fixtures
The model test template handles enum properties at the top level, but its
sub_schemamacro (used for embedded models) fell through to the string branch, soorganization_test.dartbuilt the nestedBillingPlanwith a raw string:The macro now emits enum literals, matching the top-level behavior:
…and the
enums.dartimport condition also triggers when an enum appears only in a nested schema (previously it only checked the definition's own properties). This was thedart (server)validation failure (dart analyzeexit 3).Verification
All generated from the current 1.9.x specs into clean output dirs:
bun run linux-x64binary compiletsc+npm run buildnode dist/cli.cjs usage list-events --help--limit/--offsetpython -m unittest(full suite)dart analyzevendor/bin/rector process --dry-run