[Feature] Guard platform-gated file pickers so #150 cannot regress #505
Labels
No labels
accepted
bug
declined
docs
duplicate
enhancement
good first issue
in-progress
needs-info
privacy
security
triage
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
LibreKAT/Ocideck#505
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem / motivation
Issue #150 reported that buttons on the settings page did nothing in the web
demo. The cause was
FilePicker.getDirectoryPath(), which has no webimplementation — the click silently did nothing. It was fixed in
4fa92fa8(PR #148) by hiding those controls behind
supportsLocalProjectFolders.Nothing prevents that fix from being undone. No file under
test/referencessupportsLocalProjectFoldersorplatform_features, and it cannot: the flagcomes in through a conditional import (
lib/platform/platform_features.dart:3)with no injection point, so under
flutter teston the VM it is alwaystrueand the web branch never runs. There is no
--platform chrometarget in theMakefile. A newly added picker button without the platform check would pass the
full gate.
Proposed solution
A static rule in
tool/check_web_hardening.dart: everyFilePickercall in thewidget layer that reads a
pathmust sit behind a platform gate. That filealready exists and already runs in
make check-web; it currently knows nothingabout
FilePicker. Verify the rule in both directions — zero on the repo, andan alarm on a planted violation.
The six call sites that must stay gated:
lib/widgets/dialogs/parts/settings_dialog_storage.dart:73and:436lib/widgets/panels/slide_list_panel.dart:902lib/widgets/shell/shell_actions.dart:33lib/widgets/shell/shell_actions_connections.dart:107lib/state/deck_provider.dart:282Marp / file-format impact
None. This is a build-time check; it touches no deck data.
Alternatives considered
A widget test — rejected: it proves nothing here, because the broken branch is
unreachable under
flutter test. Full browser test infrastructure — out ofproportion for one class of mistake.
Correction to the proposed solution above:
tool/check_web_hardening.dartis the wrong home. It readsbuild/web— the output of a web build — and so cannot reason about source at all.The rule belongs in
tool/check_conventions.dart, which is the source-level convention gate: it already carries the ratchets, the layer rules andaudienceBoundary, and it is wired intomake checkrather than the slowermake check-web.Also flipping the order with #506: the new rule should land on a zero baseline, which means the logo picker must be gated first. The "can it go red" requirement is met by a planted-violation test inside the check's own test, which is stronger than a one-off manual red run.