Skip to content

Handle offline survey metadata requests - #10081

Open
AIlhomov wants to merge 2 commits into
flutter:masterfrom
AIlhomov:fix/offline-survey-metadata
Open

AIlhomov wants to merge 2 commits into
flutter:masterfrom
AIlhomov:fix/offline-survey-metadata

Conversation

@AIlhomov

@AIlhomov AIlhomov commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Addresses the survey-metadata request failure in #8562.

The issue's screenshot shows a ClientException from the survey metadata URL. fetchSurveyContent catches Error, which does not catch this exception. When offline, the request can throw an uncaught exception.

Catch ClientException, log it at fine level, and return no survey. Keep the existing handling of non-200 responses and metadata type errors. Other exceptions retain their existing behavior. This does not address the separate font-loading problem mentioned in the discussion.

The tests now use MockClient instead of making a real network request, including a failed request followed by a successful one. A release note is included.

Testing

  • With unchanged production code and the new tests: 16 passed, 2 failed. Both failures are the transport-error cases.
  • With the fix: 61 manager/framework tests passed.
  • An isolated Chrome transport probe passed all 3 cases: valid response, non-200 response, and network exception.
  • Repository-wide dt presubmit passed, including analysis and formatting checks.
  • Built and manually ran the full release app. Blocking the survey metadata request produced an uncaught ClientException on the original code; the patched app handled the same failure. Navigation and Settings remained usable. After removing the block and reloading, the metadata request returned HTTP 200.

The manual check targets the survey request. It does not test every offline feature.

Tests use the repository's pinned Flutter SDK. Dependency resolution follows flutter pub get; no dependency or lockfile changes are included in this PR.

Pre-launch Checklist

General checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read the Flutter Style Guide recently, and have followed its advice.
  • I signed the CLA.
  • I updated/added relevant documentation (doc comments with ///).

Issues checklist

Tests checklist

  • I added new tests to check the change I am making...
  • OR there is a reason for not adding tests, which I explained in the PR description.

AI-tooling checklist

  • I did not use any AI tooling in creating this PR.
  • OR I did use AI tooling, and...
    • I read the AI contributions guidelines and agree to follow them.
    • I reviewed all AI-generated code before opening this PR.
    • I understand and am able to discuss the code in this PR.
    • I have verifed the accuracy of any AI-generated text included in the PR description.
    • I commit to verifying the accuracy of any AI-generated code or text that I upload in response to review comments.

Feature-change checklist

  • This PR does not change the DevTools UI or behavior and...
    • I added the release-notes-not-required label or left a comment requesting the label be added.
  • OR this PR does change the DevTools UI or behavior and...
    • I added an entry to packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md.
    • I included before/after screenshots and/or a GIF demo of the new UI to my PR description. (Not applicable: no visual UI change; before/after regression and manual browser results are described above.)
    • I ran the DevTools app locally to manually verify my changes.

build.yaml badge

If you need help, consider asking for help on Discord.

@AIlhomov
AIlhomov requested a review from a team as a code owner November 9, 2026 20:52
@AIlhomov
AIlhomov requested review from srawlins and removed request for a team November 9, 2026 20:52

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces robust error handling for network failures when fetching survey metadata in SurveyService by catching ClientException and logging it, preventing unhandled exceptions. It also adds comprehensive unit tests using MockClient to cover various success, failure, and recovery scenarios. The review feedback points out that the release note entry should be updated to use the past tense ('Handled' instead of 'Handle') to adhere to the repository style guide.

Comment on lines +18 to +19
* Handle network failures when fetching survey metadata without an unhandled
exception. [#8562](https://github.com/flutter/devtools/issues/8562)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

[CONCERN] Release note entries must be written in the past tense (e.g., 'Handled' instead of 'Handle') to adhere to the repository style guide.

Suggested change
* Handle network failures when fetching survey metadata without an unhandled
exception. [#8562](https://github.com/flutter/devtools/issues/8562)
* Handled network failures when fetching survey metadata without an unhandled
exception. [#8562](https://github.com/flutter/devtools/issues/8562)
References
  1. Entries are past tense (e.g. 'Added ...'), and the sentence ends with a period. (link)

This branch has not been deployed

No deployments
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