Repository navigation
refactor(app): decode the capture-group separate ack through its generated model - #18491
Conversation
…rated model tests/unit/test_app_client_schema_inventory.py:: test_inventory_openapi_route_response_decode_migration_complete has been red on main since 373126c (#17297). Its one violation is separateConversationFromCaptureGroup, which hand-decodes a REST response that has a declared DTO: final body = jsonDecode(response.body); final status = body is Map ? body['status'] : null; POST /v1/conversations/{conversation_id}/capture-group/separate returns StatusResponse in the app-client contract, so the migration gate expects the decode to run through the generated wire model rather than a raw field access. StatusResponse is the canonical {'status': str} ack shared by 47 routes, so it is added to the misc group -- next to the other cross-cutting response schemas -- rather than to conversation, and misc_wire.g.dart is regenerated. Behavior is unchanged: the same 'unchanged' discriminator selects the same result, and the existing catch still maps a malformed body to separated. Verified: 12 passed (was 1 failed, 11 passed), reproduced red at 373126c and green at 373126c^; generate_dart_models.py --all --check rc=0. The added lines are format-clean under the pinned Flutter 3.44.5 toolchain; the file's other regions are left untouched because main's copy already differs from what that toolchain's dart format emits. Co-Authored-By: Claude Opus 5 <[email protected]>
|
Verified end to end — this un-breaks the schema-inventory gate on main. Reproduced independently in detached worktrees:
Per-file notes:
The commit message's bisection claim checks out: 373126c is #17297. No CI/workflow files touched; required checks green including Dart Analyze & Tests and the Backend unit suite. Leaving formal approval to a human maintainer. 🤖 Automated review on behalf of the maintainers. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
kodjima33
left a comment
There was a problem hiding this comment.
refactor(app), not a bug/feature fix by title -- approve-only per policy regardless of score, even though it fixes a real red test inherited by every PR (test_inventory_openapi_route_response_decode_migration_complete). CI green (46/46).
…arate-generated-decode # Conflicts: # app/lib/backend/http/api/conversations.dart
|
Conflicts resolved on
Checked before removing it rather than assuming: What this PR now contributes, on top of
5 files, +24/−22. The approval predates this merge, so it may need re-confirming. |
kodjima33
left a comment
There was a problem hiding this comment.
Trusted contributor; fixes a real red-on-main test regression, scoped diff, CI green.
Summary
tests/unit/test_app_client_schema_inventory.py::test_inventory_openapi_route_response_decode_migration_completehas been red onmainsince373126c05e(#17297). Every PR that mergesmainpast that commit inherits the failure inBackend unit shard 3/4.The single violation is
separateConversationFromCaptureGroupinapp/lib/backend/http/api/conversations.dart, which hand-decodes a REST response that has a declared DTO:POST /v1/conversations/{conversation_id}/capture-group/separatereturnsStatusResponsein the app-client contract, so the migration gate expects that decode to run through the generated wire model rather than a raw field access.What changed
StatusResponseadded to themiscgenerator group. It is the canonical{'status': str}ack shared by 47 routes, so it belongs next to the other cross-cutting response schemas (FcmTokenResponse,RebuildResponse,ErrorResponse) rather than inconversation.misc_wire.g.dartregenerated, addingGeneratedStatusResponse.Behavior is unchanged: the same
unchangeddiscriminator selects the same result, and the existingcatchstill maps a malformed body toseparated.Verification
test_app_client_schema_inventory.py373126c05e373126c05e^generate_dart_models.py --all --checkBisected on pristine detached worktrees rather than inferred, so the regression point is pinned rather than guessed.
A note on formatting
The added lines are format-clean under the pinned Flutter 3.44.5 toolchain (Dart 3.12.2). The rest of
conversations.dartis deliberately left untouched:main's copy already differs from what that toolchain'sdart format --line-length 120emits, in four regions unrelated to this change, so reformatting them here would bury a two-line fix in unrelated churn. Worth a separate look at whether the committed file and the pinned toolchain have drifted apart.🤖 Generated with Claude Code