test(ensemble): page header dispose and upload path guard coverage#2233
Draft
cursor[bot] wants to merge 2 commits into
Draft
test(ensemble): page header dispose and upload path guard coverage#2233cursor[bot] wants to merge 2 commits into
cursor[bot] wants to merge 2 commits into
Conversation
Cover PageState teardown when listenTitleBarHeightStorage and collapsible header storage bindings are enabled, so periodic timers and subscriptions cannot fire after dispose. Co-authored-by: Sharjeel Yunus <sharjeelyunus@users.noreply.github.com>
Extend upload security coverage so the multipart upload entry point throws FormatException before any network I/O when a bound file path contains "..". Co-authored-by: Sharjeel Yunus <sharjeelyunus@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds regression tests for two recently merged risk areas:
PageStateheader lifecycle (storage-driven title bar height and collapsible header) and the multipart upload path traversal guard onUploadUtils.uploadFiles.Related Issue
Cron-driven test coverage automation (no linked issue).
Type of Change
What Has Changed
modules/ensemble/test/widget/page_header_lifecycle_test.dart: Widget test that mounts aPagewhose header opts intolistenTitleBarHeightStoragewithtitleBarHeightbound toensemble.storage.*, plus an enabled collapsible header whosevisibleexpression usesensemble.storage.*. After pumping past the periodic timer intervals, the page is torn down and we assert no async exceptions (guards against timers or stream subscriptions firing after dispose; aligns with fix2c45e427).modules/ensemble/test/upload_path_security_test.dart:expectLateronUploadUtils.uploadFileswith aFilewhosepathcontains.., assertingFormatExceptionbefore any network work (extendsbbb76c62beyond the pureuploadPathContainsParentSegmenthelper).Risky behavior now covered
ModelChangeEventsubscriptions must be cancelled when thePageis disposed; leaking them can callsetStateon defunct state or multiply listeners (the production fix addressed duplicate registration and missing timer cancellation).uploadFilesAPI rejects unsafe paths, not only the string helper, so refactors cannot drop the guard at the call site.How to Test
From
modules/ensemble:Note: The automation sandbox did not have the Flutter SDK on
PATH; CI / local runs should execute the commands above.Screenshots / Videos
N/A (tests only).
Checklist
flutter analyzeand addressed any new warningsflutter testand all tests pass (not run in agent environment — please verify in CI)Why these tests materially reduce regression risk
SinglePageModel→PageState.initState→ timers/subscriptions) and fails loudly if dispose cleanup regresses, which is a common source of flaky CI and user crashes after navigation.