Skip to content

fix(app): decode the speech profile error body through its generated model - #15187

Merged
kodjima33 merged 1 commit into
BasedHardware:mainfrom
singhharsh1708:fix/app-speech-profile-error-decode
Sep 21, 2026
Merged

kodjima33 merged 1 commit into
BasedHardware:mainfrom
singhharsh1708:fix/app-speech-profile-error-decode

Conversation

@singhharsh1708

@singhharsh1708 singhharsh1708 commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

test_app_client_schema_inventory.py::test_inventory_openapi_route_response_decode_migration_complete is failing on main, so every backend shard is red and no backend PR can go green.

The cause is mine. #15058 added _errorDetail to app/lib/backend/http/api/speech_profile.dart to read detail out of a failed upload response, and it did that with a bare jsonDecode plus a map lookup. The inventory contract classifies a response_decode site as a violation unless it is generated-backed, so uploadProfile started reporting raw_response_decode_site_count: 2 and the migration assertion fails.

misc_wire.GeneratedErrorResponse already models that body and carries detail, so _errorDetail now goes through it. The behaviour is unchanged: a string detail is returned, anything else or an unparseable body still yields null, and the dialog logic on top of it is untouched.

$ cd backend && python -m pytest tests/unit/test_app_client_schema_inventory.py -q
12 passed in 2.40s

$ cd app && flutter test test/providers/speech_profile_provider_test.dart
00:00 +29: All tests passed!

$ dart analyze lib/backend/http/api/speech_profile.dart
No issues found!

Failure-Class: none

Review in cubic

…model

The raw jsonDecode I added in BasedHardware#15058 made uploadProfile report raw response decode sites, which fails test_inventory_openapi_route_response_decode_migration_complete and takes every backend shard red on main. misc_wire.GeneratedErrorResponse already models that body.
@singhharsh1708

Copy link
Copy Markdown
Contributor Author

Context for anyone hitting red backend shards right now: main has two independent failures. This PR fixes one of them, which is mine from #15058. The other is #15195, where #15099 gave enable_app_endpoint a request parameter and the test that calls it directly was not updated; PR for that is #15194. Both need to land before a backend PR can be green.

@singhharsh1708

Copy link
Copy Markdown
Contributor Author

Worth flagging that this one is blocking other PRs. test_app_client_schema_inventory.py::test_inventory_openapi_route_response_decode_migration_complete fails on current main, and it is the _errorDetail decode sites in speech_profile.dart that this PR moves onto the generated model.

On fdcae0a with no changes, backend unit has three red files:

tests/unit/test_app_client_schema_inventory.py::test_inventory_openapi_route_response_decode_migration_complete
tests/unit/test_setup_completed_url_uid_query.py (2 tests)
tests/unit/test_app_enable_install_count.py (2 tests)

This PR fixes the first, #15194 fixes the other two. Every open backend PR is currently showing failing shards for exactly those three files and nothing else.

@Git-on-my-level

Copy link
Copy Markdown
Member

Thanks @singhharsh1708 — verified, this is a clean fix.

What I checked in app/lib/backend/http/api/speech_profile.dart:

  • _errorDetail now routes the error body through misc_wire.GeneratedErrorResponse.fromJson(...) instead of a bare jsonDecode + map lookup, removing the raw response-decode site in the uploadProfile path. That's exactly what test_inventory_openapi_route_response_decode_migration_complete in backend/tests/unit/test_app_client_schema_inventory.py gates on (zero raw_response_decode_site_count across the operation manifest), so this should un-red the backend shards.
  • Behavior parity holds: GeneratedErrorResponse.detail is typed dynamic, so a list-valued detail (e.g. FastAPI validation errors) still parses and then fails the detail is String check, returning null exactly like the old guard; a missing detail makes fromJson throw, which the existing catch (_) maps to null — same observable result as before.
  • The generated model is pre-existing (misc_wire.g.dart is untouched by this PR) and matches the decode-through-generated-model pattern already used throughout this file.
  • Nothing else changed: dialog logic and all other call sites are identical to main, and CI is green on this head including Backend Hermetic Merge Gate and Dart Analyze & Tests.

Appreciate the description owning the #15058 fallout — that context made this easy to verify. Leaving for routine maintainer merge.

🤖 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 need human response.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Genuine fix for a self-caused CI regression: routes the speech-profile error body through the existing generated model (misc_wire.GeneratedErrorResponse) instead of a bare jsonDecode, satisfying the inventory contract's response_decode rule. Small (+6/-4), behavior-preserving, tests pass, CI green.

@kodjima33
kodjima33 merged commit 19b9040 into BasedHardware:main Sep 21, 2026
43 of 44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flutter flutter work positive-signal Automation verified a genuine fix/quality contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants